B5 PHP

Inside VCL for PHP / Delphi for PHP PHP• Delphi for PHP• Inside VCL for PHP / VCL4PHP• Component
Go!

2Delphi for PHP

3

Delphi for PHP• Delphi for PHP

Delphi•Delphi IDE•DelphiPHP

VCL for PHP
4

Delphi for PHP

• PHP

Ruby

Python

LL• Delphi for PHP

5

Web

•

C/SWeb6

WebRAD

• Web

Webp

Webp

DBDB
Delphi for PHP

Delphi

Delphi7

Delphi for PHP

MVC• MVC(Model View Controler)

Delphi for PHP

View
View+Controller
PageController
Model
DataModule
ModelDBDB8

Ajax• Delphi for PHP
for PHP• Xajax

Ajax
PHP

xajax VCLJavaScript

0.2.5 (stable release)
0.5• http://www.xajaxproject.org/en/home/9Inside VCL for PHP / VCL4PHP

10

VCL for PHP• Delphi for PHP
Object

VCL for PHP
Collection

DatabaseEditor

ComponentEditor
Field
POST/GET

Filer

Xml
ReaderPersistent
PropertyEditor

Persistent

11

Page

Object•Page
ObjectPersistent

Component
Control

FocusControl

ScrollingControl

CustomPage

Page

Delphi for PHP
xml.php

IDE

12

FocusControl

ObjectObjectsystem.in.php(98)function __construct(){
global $input;}Persistent//Assign the global input object so it can be used from inside$this->input=$input;classes.inc.php(1195)
function __construct($aowner=null){//Calls the inherited constructor
parent::__construct($aowner);//List of children$this->components=new Collection();Component//Initializes the owner$this->owner=null;controls.inc.php(796)function __construct($aowner=null){$this->_font=new Font();$this->_font->_control=$this;//Initializes the name$this->_name="";$this->_controlstate=0;

Control

FocusControl//Calls inherited constructor
parent::__construct($aowner);

if ($aowner!=null){//If there is an owner
if (is_object($aowner)){//Stores it$this->owner=$aowner;}

controls.inc.php(2283)
function __construct($aowner=null){//Creates the controls list.
$this->controls=new Collection();//Adds itself to the list of components from theowner$this->owner->insertComponent($this);//Calls inherited constructor.
parent::__construct($aowner);$this->_layout=new Layout();$this->_layout->_control=$this;
}

}
else{
throw new Exception("Owner must be anobject");
}}}

13

•
loadResource(__FILE__)
Page Show()<?php
require_once("vcl/vcl.inc.php");//Includes
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");//Class definition
class Unit1 extends Page{
public $Button1 = null;public $Label1 = null;function Button1Click($sender, $params){

global $application;
global $Unit1;//Creates the form
$Unit1=new Unit1($application);//Read from resource file
$Unit1->loadResource(__FILE__);//Shows the form
$Unit1->show();
?>}}

※

1

114

Page

Component

Persistent__construct($application)

LoadResouce(__FILE__)

readFromResource()

unserialize()

ControlunserializeChildren()loadedChildren()loaded()preinit()show()
init()※

Page

Object15

PublishedPublic• Delphi for PHP• Public• Published• Public<Public
protected $_test=null;>function readtest() { return $this->_test; }function writetest($value) { $this->_test=$value; }function defaulttest() { return null; }Publish<Publishedprotected $_test=null;>function gettest() { return $this->_test; }function settest($value) { $this->_test=$value; }function defaulttest() { return null; }Default※16

• VCL for PHP

Delphi VCL

set/get•

PHP__get() __set()
Object• get + hogehoge / set + hogehoge

Published• read + hogehoge / write + hogehogte

Public17

Published• Persistent• PHP5•

Serialize()set

SerializeChildren+••18•Persistent
UnSerialize

Serialize /Serialize PHP

shutdown_function
forms.inc.php(58)function VCLShutdown(){global $application;//This is the moment to store all properties in the session to retrieve them later$application->serializeChildren();//Uncomment this to get what is stored on the session at the last step of your scripts/*
echo "<pre>";print_r($_SESSION);
echo "<pre>";*/}register_shutdown_function("VCLShutdown");

19

ANameObjectAname__get()Object__set()‘get’.Aname‘get’.Aname‘set’.Aname‘set’.Aname(‘read’.Aname‘read’.Aname‘write’.Aname‘write’.Aname())

Component20•80%

※Core2Quad9550+Mem4G+WindowsXP SP2Delphi for PHP IDE

21

•//Labelfunction Button1Click($sender, $params){$labelCount = 0;
foreach($this->controls->items as $key => $obj){if ($obj->ClassName() == 'Label'){$lastLabel = $obj;$labelCount++;}}$newLabel = new Label($this);$newLabel->Name = 'Label'.($labelCount+1);$newLabel->Top = $lastLabel->Top + 16;$newLabel->Left = $lastLabel->Left;$newLabel->Caption = 'Label'.($labelCount+1);$newLabel->Parent = $this;}$newLabel = new Label();$this->insertComponent($newLabel);controls

22Component

Go!

23

Component•

24•<?php
require_once("vcl/vcl.inc.php");//Includes<?phprequire_once("vcl/vcl.inc.php");
use_unit("designide.inc.php");//Class definition
class SampleCompo extends Component{
function __construct($aowner = null){parent::__construct($aowner);}

setPackageTitle("Put the title of your package
here");//Change this setting to the path where the icons
for the components reside
setIconPath("./icons");function dumpContents(){
parent::dumpContents();}}//Change yourunit.inc.php to the php file whichcontains the component code
registerComponents("Samples",array("SampleCompo"),"unit1.inc.php");?>
use_unit?>25• Delphi for PHP

Package
Component

Component

Component

26

Package

•bmp

<?php
require_once("vcl/vcl.inc.php");
use_unit("designide.inc.php");
setPackageTitle("Anaheim Technology Components");//Change this setting to the path where the icons for the components reside
setIconPath("./icons");//Change yourunit.inc.php to the php file which contains the component code
registerComponents("Anaheim-Tech",array("PHPExcelSimpleReport"),"phpexcel.inc.php");
registerPropertyValues("PHPExcelSimpleReport","Orientation",array('Default','Portrait','Landscape'));registerPropertyValues("PHPExcelSimpleReport","PaperSize",array('A4','A3'));
registerPropertyValues("PHPExcelSimpleReport","DataSet",array('DataSet'));registerPropertyEditor("PHPExcelSimpleReport","TitleRowColor","TSamplePropertyEditor","native");?>27

•Delphi• <>••TStringListPropertyEditor
TItemsPropertyEditor

SQL•••••••••

TGridColumnsPropertyEditor
DBGrid Columns
TFormValidatorRulesPropertyEditor FormValidator Rules
TImagePropertyEditor
ImageTImageListPropertyEditor
ImageList
THTMLPropertyEditor
Caption
HTMLTValueListPropertyEditor
TFilenamePropertyEditor
TAbsolutePathPropertyEditor
TSamplePropertyEditor

Items

28

•

Published

Set

Publishedprotected $_creator = "";//Creator
public function setCreator($pValue){$this->_creator = $pValue;}
public function getCreator(){
return $this->_creator;}
public function defaultCreator(){
return null;}

29

PHPExcel• PHPExcel Excel2007/Excel2000•• Excel 2007 (spreadsheetML)• BIFF8 (Excel 97 and higher)• PHPExcel Serialized Spreadsheet• CSV (Comma Separated Values)• HTML• PDF•• Excel 2007 (spreadsheetML)• BIFF5 (Excel 5.0 / Excel 95), BIFF8 (Excel 97 and higher)• PHPExcel Serialized Spreadsheet• Excel 2003 XML format• Symbolic Link (SYLK)• CSV (Comma Separated Values)

30

PHPExcel• PHPExcel

zip

PHP
Delphi for PHP IDE<Delphi for PHP2.0>¥apache2...
¥php¥phpExcel¥Classes¥Documentation¥Tests...
¥vcl

31

PHPExcel• PHPExcel••••••••••

Columns
CreatorDataSet
Filename
Orientation
PaperSize
Report_Title
SheetnameTitleRowColor
WriterType

A4 A3

Excel5 Excel200732

•• setComponent

fixupProperty//DataSet
protected $_dataset = null;public function setDataSet($pValue){$this->_dataset = $this->fixupProperty($pValue);}
public function getDataSet(){return $this->_dataset;}public function defaultDataSet(){return null;}

33

34

Firebird•

35

•
•
157-0072
1-22-26-S-208• TEL 03-5787-7791 FAX 03-5787-7792• http://www.anaheim-tech.com/• Delphi• Firebird/InterBase• Delphi for PHP36