kolbek | Bonjour,
J'ai récemment découvert la librairie php-ext :
http://php-ext.quimera-solutions.c [...] rm/dynamic
J'essaye donc un des exemples (celui du lien ci dessus).
Mon fichier php est dans un dossier src, j'ai donc modifié la première ligne de l'exemple (disponible dans le lien en haut a droite "view source" ).
Voici mon fichier php :
Code :
- <?php
- set_include_path(get_include_path().PATH_SEPARATOR.realpath('../php-ext/library'));
- include_once 'PhpExt/Javascript.php';
- PhpExt_Javascript::sendContentType();
- include_once 'PhpExt/Ext.php';
- include_once 'PhpExt/Form/FormPanel.php';
- include_once 'PhpExt/Config/ConfigObject.php';
- include_once 'PhpExt/Form/TextField.php';
- include_once 'PhpExt/Form/TimeField.php';
- include_once 'PhpExt/Form/FieldSet.php';
- include_once 'PhpExt/Form/HtmlEditor.php';
- include_once 'PhpExt/Button.php';
- include_once 'PhpExt/Panel.php';
- include_once 'PhpExt/TabPanel.php';
- include_once 'PhpExt/QuickTips.php';
- include_once 'PhpExt/Layout/ColumnLayout.php';
- include_once 'PhpExt/Layout/FormLayout.php';
- include_once 'PhpExt/Layout/FitLayout.php';
- include_once 'PhpExt/Layout/AnchorLayoutData.php';
- include_once 'PhpExt/Layout/ColumnLayoutData.php';
- //****************************** Simple Form
- $simple = new PhpExt_Form_FormPanel();
- $simple->setLabelWidth(75)
- ->setUrl("save-form.php" )
- ->setFrame(true)
- ->setTitle("Simple Form" )
- ->setBodyStyle("padding:5px 5px 0" )
- ->setWidth(350)
- ->setDefaults(new PhpExt_Config_ConfigObject(array("width"=>230)))
- ->setDefaultType("textfield" );
-
- $firstName = PhpExt_Form_TextField::createTextField("first","First Name" )
- ->setAllowBlank(false);
- $lastName = PhpExt_Form_TextField::createTextField("last","Last Name" );
- $company = PhpExt_Form_TextField::createTextField("company","Company" );
- $email = PhpExt_Form_TextField::createTextField("email","Email", null, PhpExt_Form_FormPanel::VTYPE_EMAIL);
- $time = PhpExt_Form_TimeField::createTimeField("time", "Time" )
- ->setMinValue("8:00am" )
- ->setMaxValue("6:00pm" );
-
- $simple->addItem($firstName)
- ->addItem($lastName)
- ->addItem($company)
- ->addItem($email)
- ->addItem($time);
-
- $simple->addButton(PhpExt_Button::createTextButton("Save" ));
- $simple->addButton(PhpExt_Button::createTextButton("Cancel" ));
-
-
-
-
-
-
- //****************************** Adding Fieldset
- $fsf = new PhpExt_Form_FormPanel();
- $fsf->setLabelWidth(75)
- ->setUrl("save-form.php" )
- ->setFrame(true)
- ->setTitle("Simple Form with FieldSets" )
- ->setBodyStyle("padding:5px 5px 0" )
- ->setWidth(350);
-
- //- Fielset 1
- $fieldset1 = new PhpExt_Form_FieldSet();
- $fieldset1->setCheckboxToggle(true)
- ->setTitle("User Information" )
- ->setAutoHeight(true)
- ->setDefaults(new PhpExt_Config_ConfigObject(array("width"=>210)))
- ->setCollapsed(true);
- // Use the helper function to easily create fields to add them inline
- $fieldset1->addItem(PhpExt_Form_TextField::createTextField("first","First Name" )
- ->setAllowBlank(false))
- ->addItem(PhpExt_Form_TextField::createTextField("last","Last Name" ))
- ->addItem(PhpExt_Form_TextField::createTextField("company","Company" ))
- ->addItem(PhpExt_Form_TextField::createTextField("email","Email" )
- ->setVType(PhpExt_Form_FormPanel::VTYPE_EMAIL));
- $fsf->addItem($fieldset1);
-
- //- Fieldset 2
- $fieldset2 = new PhpExt_Form_FieldSet();
- $fieldset2->setTitle("Phone Number" )
- ->setCollapsible(true)
- ->setAutoHeight(true)
- ->setDefaults(new PhpExt_Config_ConfigObject(array("width"=>210)))
- ->addItem(PhpExt_Form_TextField::createTextField("home","Home" )
- ->setValue("(888) 555-1212" ))
- ->addItem(PhpExt_Form_TextField::createTextField("business","Business" ))
- ->addItem(PhpExt_Form_TextField::createTextField("mobile","Mobile" ))
- ->addItem(PhpExt_Form_TextField::createTextField("fax","Fax" ));
- $fsf->addItem($fieldset2);
-
- //- Buttons
- $fsf->addButton(PhpExt_Button::createTextButton("Save" ));
- $fsf->addButton(PhpExt_Button::createTextButton("Cancel" ));
-
-
-
-
-
- //****************************** A little more complex
- $top = new PhpExt_Form_FormPanel();
- $top->setLabelAlign(PhpExt_Form_FormPanel::LABEL_ALIGN_TOP)
- ->setFrame(true)
- ->setTitle("Multi Column, Nested Layouts and Anchoring" )
- ->setBodyStyle("padding:5px 5px 0" )
- ->setWidth(600);
-
-
- $columnPanel = new PhpExt_Panel();
- // using ColumnLayout
- $columnPanel->setLayout(new PhpExt_Layout_ColumnLayout());
- $top->addItem($columnPanel);
-
- //- First column
- $firstColumn = new PhpExt_Panel();
- // Use FormLayout to enable field labels and autoarrange fields on the panel
- $firstColumn->setLayout(new PhpExt_Layout_FormLayout());
- // Anchor the field to 95% of the panel by setting AnchorLayoutData (FormLayout extends AnchorLayout)
- $firstColumn->addItem(
- PhpExt_Form_TextField::createTextField("first","First Name" )
- ->setTabIndex(1),
- new PhpExt_Layout_AnchorLayoutData("95%" )
- )
- ->addItem(
- PhpExt_Form_TextField::createTextField("company","Company" )
- ->setTabIndex(3),
- new PhpExt_Layout_AnchorLayoutData("95%" )
- );
- // adds the panel as a 50% column using ColumnLayoutData
- $columnPanel->addItem($firstColumn, new PhpExt_Layout_ColumnLayoutData(0.5));
-
- //- Second column
- $secondColumn = new PhpExt_Panel();
- $secondColumn->setLayout(new PhpExt_Layout_FormLayout())
- ->addItem(
- PhpExt_Form_TextField::createTextField("last","Last Name" )
- ->setTabIndex(2),
- new PhpExt_Layout_AnchorLayoutData("95%" ))
- ->addItem(
- PhpExt_Form_TextField::createTextField("email","Email" )
- ->setVType(PhpExt_Form_FormPanel::VTYPE_EMAIL)
- ->setTabIndex(4),
- new PhpExt_Layout_AnchorLayoutData("95%" ));
- $columnPanel->addItem($secondColumn, new PhpExt_Layout_ColumnLayoutData(0.5));
-
- // Add an HtmlEditor directly to the form, underneath the two columns
- $top->addItem(PhpExt_Form_HtmlEditor::createHtmlEditor("bio","Biography","bio" )
- ->setTabIndex(5)
- ->setHeight(200),
- new PhpExt_Layout_AnchorLayoutData("98%" ));
-
- //- Buttons
- $top->addButton(PhpExt_Button::createTextButton("Save" ));
- $top->addButton(PhpExt_Button::createTextButton("Cancel" ));
-
-
-
-
-
-
- //****************************** Form as Tabs
- $tabs = new PhpExt_Form_FormPanel();
- $tabs->setBorder(false)
- ->setLabelWidth(75)
- ->setWidth(350);
-
- $tabPanel = new PhpExt_TabPanel();
- $tabPanel->setActiveTab(0)
- ->setDefaults(new PhpExt_Config_ConfigObject(array("autoHeight"=>true,"bodyStyle"=>"padding:10px" )));
-
- $detailsTab = new PhpExt_Panel();
- $detailsTab->setTitle("Personal Details" )
- ->setLayout(new PhpExt_Layout_FormLayout())
- ->setDefaults(new PhpExt_Config_ConfigObject(array("width"=>230)))
- ->setDefaultType("textfield" )
- ->addItem(PhpExt_Form_TextField::createTextField("first","First Name" )
- ->setAllowBlank(false)
- ->setValue("Jack" ))
- ->addItem(PhpExt_Form_TextField::createTextField("company","Company" )
- ->setValue("Slocum" ))
- ->addItem(PhpExt_Form_TextField::createTextField("last","Last Name" )
- ->setValue("Ext JS" ))
- ->addItem(PhpExt_Form_TextField::createTextField("email","Email" )
- ->setVType(PhpExt_Form_FormPanel::VTYPE_EMAIL));
-
- $phonesTab = new PhpExt_Panel();
- $phonesTab->setTitle("Phone Numbers" )
- ->setLayout(new PhpExt_Layout_FormLayout())
- ->setDefaults(new PhpExt_Config_ConfigObject(array("width"=>230)))
- ->setDefaultType("textfield" )
- ->addItem(PhpExt_Form_TextField::createTextField("home","Home" )
- ->setValue("(888) 555-1212" ))
- ->addItem(PhpExt_Form_TextField::createTextField("business","Business" ))
- ->addItem(PhpExt_Form_TextField::createTextField("mobile","Mobile" ))
- ->addItem(PhpExt_Form_TextField::createTextField("fax","Fax" ));
-
- $tabPanel->addItem($detailsTab);
- $tabPanel->addItem($phonesTab);
- $tabs->addItem($tabPanel);
-
- $tabs->addButton(PhpExt_Button::createTextButton("Save" ));
- $tabs->addButton(PhpExt_Button::createTextButton("Cancel" ));
-
-
-
-
-
- //******************************* Form Tabs 2
-
- $tabs2 = new PhpExt_Form_FormPanel();
- $tabs2->setLabelAlign(PhpExt_Form_FormPanel::LABEL_ALIGN_TOP)
- ->setTitle("Inner Tabs" )
- ->setBodyStyle("padding:5px" )
- ->setWidth(600);
-
- $columnPanel2 = new PhpExt_Panel();
- // using ColumnLayout
- $columnPanel2->setBorder(false)
- ->setLayout(new PhpExt_Layout_ColumnLayout());
- $tabs2->addItem($columnPanel2);
-
- //- First column
- $firstColumn2 = new PhpExt_Panel();
- // Use FormLayout to enable field labels and autoarrange fields on the panel
- $firstColumn2->setBorder(false)
- ->setLayout(new PhpExt_Layout_FormLayout());
-
- // Anchor the field to 95% of the panel by setting AnchorLayoutData (FormLayout extends AnchorLayout)
- $firstColumn2->addItem(
- PhpExt_Form_TextField::createTextField("first","First Name" ),
- new PhpExt_Layout_AnchorLayoutData("95%" )
- )
- ->addItem(
- PhpExt_Form_TextField::createTextField("company","Company" ),
- new PhpExt_Layout_AnchorLayoutData("95%" )
- );
- // adds the panel as a 50% column using ColumnLayoutData
- $columnPanel2->addItem($firstColumn2, new PhpExt_Layout_ColumnLayoutData(0.5));
-
- //- Second column
- $secondColumn2 = new PhpExt_Panel();
- $secondColumn2->setBorder(false)
- ->setLayout(new PhpExt_Layout_FormLayout())
- ->addItem(
- PhpExt_Form_TextField::createTextField("last","Last Name" ),
- new PhpExt_Layout_AnchorLayoutData("95%" ))
- ->addItem(
- PhpExt_Form_TextField::createTextField("email","Email" )
- ->setVType(PhpExt_Form_FormPanel::VTYPE_EMAIL),
- new PhpExt_Layout_AnchorLayoutData("95%" ));
- $columnPanel2->addItem($secondColumn2, new PhpExt_Layout_ColumnLayoutData(0.5));
-
- //- Tab Panel
- $tabPanel2 = new PhpExt_TabPanel();
- $tabPanel2->setPlain(true)
- ->setActiveTab(0)
- ->setHeight(235)
- ->setDefaults(new PhpExt_Config_ConfigObject(array("bodyStyle"=>"padding:10px" )));
-
- $detailsTab2 = new PhpExt_Panel();
- $detailsTab2->setTitle("Personal Details" )
- ->setLayout(new PhpExt_Layout_FormLayout())
- ->setDefaults(new PhpExt_Config_ConfigObject(array("width"=>230)))
- ->setDefaultType("textfield" )
- ->addItem(PhpExt_Form_TextField::createTextField("first","First Name" )
- ->setAllowBlank(false)
- ->setValue("Jack" ))
- ->addItem(PhpExt_Form_TextField::createTextField("company","Company" )
- ->setValue("Slocum" ))
- ->addItem(PhpExt_Form_TextField::createTextField("last","Last Name" )
- ->setValue("Ext JS" ))
- ->addItem(PhpExt_Form_TextField::createTextField("email","Email" )
- ->setVType(PhpExt_Form_FormPanel::VTYPE_EMAIL));
-
- $phonesTab2 = new PhpExt_Panel();
- $phonesTab2->setTitle("Phone Numbers" )
- ->setLayout(new PhpExt_Layout_FormLayout())
- ->setDefaults(new PhpExt_Config_ConfigObject(array("width"=>230)))
- ->setDefaultType("textfield" )
- ->addItem(PhpExt_Form_TextField::createTextField("home","Home" )
- ->setValue("(888) 555-1212" ))
- ->addItem(PhpExt_Form_TextField::createTextField("business","Business" ))
- ->addItem(PhpExt_Form_TextField::createTextField("mobile","Mobile" ))
- ->addItem(PhpExt_Form_TextField::createTextField("fax","Fax" ));
-
- $bioTab = new PhpExt_Panel();
- $bioTab->setCssClass("x-plain" )
- ->setTitle("Biography" )
- ->setLayout(new PhpExt_Layout_FitLayout())
- ->addItem(PhpExt_Form_HtmlEditor::createHtmlEditor("bio2","Biography","bio2" ));
-
- $tabPanel2->addItem($detailsTab2);
- $tabPanel2->addItem($phonesTab2);
- $tabPanel2->addItem($bioTab);
- $tabs2->addItem($tabPanel2);
-
- $tabs2->addButton(PhpExt_Button::createTextButton("Save" ));
- $tabs2->addButton(PhpExt_Button::createTextButton("Cancel" ));
-
- //****************************** onReady
-
- echo PhpExt_Ext::onReady(
- PhpExt_QuickTips::init(),
- PhpExt_Javascript::assign("bd","Ext.get('centercolumn')" ),
-
- PhpExt_Javascript::stm("bd.createChild({tag: 'h2', html: 'Form 1 - Very Simple'})" ),
- $simple->getJavascript(false, "simple" ),
- $simple->render(PhpExt_Javascript::variable("Ext.get('centercolumn')" )),
- PhpExt_Javascript::stm("bd.createChild({tag: 'h2', html: 'Form 2 - Adding fieldsets'})" ),
- $fsf->getJavascript(false, "fsf" ),
- $fsf->render(PhpExt_Javascript::variable("Ext.get('centercolumn')" )),
- PhpExt_Javascript::stm("bd.createChild({tag: 'h2', html: 'Form 3 - A little more complex'})" ),
- $top->getJavascript(false, "top" ),
- $top->render(PhpExt_Javascript::variable("Ext.get('centercolumn')" )),
- PhpExt_Javascript::stm("bd.createChild({tag: 'h2', html: 'Form 4 - Forms can be a TabPanel...'})" ),
- $tabs->getJavascript(false, "tabs" ),
- $tabs->render(PhpExt_Javascript::variable("Ext.get('centercolumn')" )),
- PhpExt_Javascript::stm("bd.createChild({tag: 'h2', html: 'Form 5 - ... and forms can contain TabPanel(s)'})" ),
- $tabs2->getJavascript(false, "tabs2" ),
- $tabs2->render(PhpExt_Javascript::variable("Ext.get('centercolumn')" ))
- );
-
- ?>
|
Et dans ma page quand je l'affiche dans le navigateur, j'ai ceci :
Code :
- Ext.onReady(function(){
- Ext.QuickTips.init()
- bd=Ext.get('centercolumn');
- bd.createChild({tag: 'h2', html: 'Form 1 - Very Simple'});
- var simple = new Ext.form.FormPanel({items: [{name: 'first',fieldLabel: 'First Name',allowBlank: false,xtype: 'textfield'},{name: 'last',fieldLabel: 'Last Name',xtype: 'textfield'},{name: 'company',fieldLabel: 'Company',xtype: 'textfield'},{name: 'email',fieldLabel: 'Email',vtype: 'email',xtype: 'textfield'},{name: 'time',fieldLabel: 'Time',minValue: '8:00am',maxValue: '6:00pm',xtype: 'timefield'}],buttons: [{text: 'Save',xtype: 'button'},{text: 'Cancel',xtype: 'button'}],labelWidth: 75,url: 'save-form.php',frame: true,title: 'Simple Form',bodyStyle: 'padding:5px 5px 0',width: 350,defaults: {width: 230},defaultType: 'textfield'});
- simple.render(Ext.get('centercolumn'));
- bd.createChild({tag: 'h2', html: 'Form 2 - Adding fieldsets'});
- var fsf = new Ext.form.FormPanel({items: [{items: [{name: 'first',fieldLabel: 'First Name',allowBlank: false,xtype: 'textfield'},{name: 'last',fieldLabel: 'Last Name',xtype: 'textfield'},{name: 'company',fieldLabel: 'Company',xtype: 'textfield'},{name: 'email',fieldLabel: 'Email',vtype: 'email',xtype: 'textfield'}],checkboxToggle: true,title: 'User Information',autoHeight: true,defaults: {width: 210},collapsed: true,xtype: 'fieldset'},{items: [{name: 'home',fieldLabel: 'Home',value: '(888) 555-1212',xtype: 'textfield'},{name: 'business',fieldLabel: 'Business',xtype: 'textfield'},{name: 'mobile',fieldLabel: 'Mobile',xtype: 'textfield'},{name: 'fax',fieldLabel: 'Fax',xtype: 'textfield'}],title: 'Phone Number',collapsible: true,autoHeight: true,defaults: {width: 210},xtype: 'fieldset'}],buttons: [{text: 'Save',xtype: 'button'},{text: 'Cancel',xtype: 'button'}],labelWidth: 75,url: 'save-form.php',frame: true,title: 'Simple Form with FieldSets',bodyStyle: 'padding:5px 5px 0',width: 350});
- fsf.render(Ext.get('centercolumn'));
- bd.createChild({tag: 'h2', html: 'Form 3 - A little more complex'});
- var top = new Ext.form.FormPanel({items: [{items: [{items: [{name: 'first',fieldLabel: 'First Name',tabIndex: 1,xtype: 'textfield',anchor: '95%'},{name: 'company',fieldLabel: 'Company',tabIndex: 3,xtype: 'textfield',anchor: '95%'}],xtype: 'panel',columnWidth: 0.5,layout: 'form'},{items: [{name: 'last',fieldLabel: 'Last Name',tabIndex: 2,xtype: 'textfield',anchor: '95%'},{name: 'email',fieldLabel: 'Email',vtype: 'email',tabIndex: 4,xtype: 'textfield',anchor: '95%'}],xtype: 'panel',columnWidth: 0.5,layout: 'form'}],xtype: 'panel',layout: 'column'},{name: 'bio',fieldLabel: 'Biography',id: 'bio',tabIndex: 5,height: 200,xtype: 'htmleditor',anchor: '98%'}],buttons: [{text: 'Save',xtype: 'button'},{text: 'Cancel',xtype: 'button'}],labelAlign: 'top',frame: true,title: 'Multi Column, Nested Layouts and Anchoring',bodyStyle: 'padding:5px 5px 0',width: 600});
- top.render(Ext.get('centercolumn'));
- bd.createChild({tag: 'h2', html: 'Form 4 - Forms can be a TabPanel...'});
- var tabs = new Ext.form.FormPanel({items: {items: [{items: [{name: 'first',fieldLabel: 'First Name',allowBlank: false,value: 'Jack',xtype: 'textfield'},{name: 'company',fieldLabel: 'Company',value: 'Slocum',xtype: 'textfield'},{name: 'last',fieldLabel: 'Last Name',value: 'Ext JS',xtype: 'textfield'},{name: 'email',fieldLabel: 'Email',vtype: 'email',xtype: 'textfield'}],title: 'Personal Details',defaults: {width: 230},defaultType: 'textfield',xtype: 'panel',layout: 'form'},{items: [{name: 'home',fieldLabel: 'Home',value: '(888) 555-1212',xtype: 'textfield'},{name: 'business',fieldLabel: 'Business',xtype: 'textfield'},{name: 'mobile',fieldLabel: 'Mobile',xtype: 'textfield'},{name: 'fax',fieldLabel: 'Fax',xtype: 'textfield'}],title: 'Phone Numbers',defaults: {width: 230},defaultType: 'textfield',xtype: 'panel',layout: 'form'}],activeTab: 0,defaults: {autoHeight: true,bodyStyle: 'padding:10px'},xtype: 'tabpanel'},buttons: [{text: 'Save',xtype: 'button'},{text: 'Cancel',xtype: 'button'}],border: false,labelWidth: 75,width: 350});
- tabs.render(Ext.get('centercolumn'));
- bd.createChild({tag: 'h2', html: 'Form 5 - ... and forms can contain TabPanel(s)'});
- var tabs2 = new Ext.form.FormPanel({items: [{items: [{items: [{name: 'first',fieldLabel: 'First Name',xtype: 'textfield',anchor: '95%'},{name: 'company',fieldLabel: 'Company',xtype: 'textfield',anchor: '95%'}],border: false,xtype: 'panel',columnWidth: 0.5,layout: 'form'},{items: [{name: 'last',fieldLabel: 'Last Name',xtype: 'textfield',anchor: '95%'},{name: 'email',fieldLabel: 'Email',vtype: 'email',xtype: 'textfield',anchor: '95%'}],border: false,xtype: 'panel',columnWidth: 0.5,layout: 'form'}],border: false,xtype: 'panel',layout: 'column'},{items: [{items: [{name: 'first',fieldLabel: 'First Name',allowBlank: false,value: 'Jack',xtype: 'textfield'},{name: 'company',fieldLabel: 'Company',value: 'Slocum',xtype: 'textfield'},{name: 'last',fieldLabel: 'Last Name',value: 'Ext JS',xtype: 'textfield'},{name: 'email',fieldLabel: 'Email',vtype: 'email',xtype: 'textfield'}],title: 'Personal Details',defaults: {width: 230},defaultType: 'textfield',xtype: 'panel',layout: 'form'},{items: [{name: 'home',fieldLabel: 'Home',value: '(888) 555-1212',xtype: 'textfield'},{name: 'business',fieldLabel: 'Business',xtype: 'textfield'},{name: 'mobile',fieldLabel: 'Mobile',xtype: 'textfield'},{name: 'fax',fieldLabel: 'Fax',xtype: 'textfield'}],title: 'Phone Numbers',defaults: {width: 230},defaultType: 'textfield',xtype: 'panel',layout: 'form'},{items: {name: 'bio2',fieldLabel: 'Biography',id: 'bio2',xtype: 'htmleditor'},cls: 'x-plain',title: 'Biography',xtype: 'panel',layout: 'fit'}],plain: true,activeTab: 0,height: 235,defaults: {bodyStyle: 'padding:10px'},xtype: 'tabpanel'}],buttons: [{text: 'Save',xtype: 'button'},{text: 'Cancel',xtype: 'button'}],labelAlign: 'top',title: 'Inner Tabs',bodyStyle: 'padding:5px',width: 600});
- tabs2.render(Ext.get('centercolumn'));
- });
|
Donc quelque chose de très ressemblant a la fin de ce qu'il y a dans le php... Par contre je ne comprends pas pourquoi j'ai cela à la place du rendu voulu.
Pourrez vous m'aider ?
Merci d'avance. ---------------
Mon topic de vente http://forum.hardware.fr/hfr/Achat [...] 9217_1.htm -- Mon Feed-Back : http://forum.hardware.fr/hfr/Achat [...] 0553_1.htm
|