->setHeight(600); $accordion = new PhpExt_Layout_AccordionLayout(); $accordion->setTitleCollapse(true) ->setActiveOnTop(true) ->setAnimate(true) ; $accordionPanel->setLayout($accordion); $p1 = new PhpExt_Panel(); $p1->setTitle("Navigation") ->setHtml("This <bt>is the navigation panel"); $p2 = new PhpExt_Panel(); $p2->setTitle("Settings") ->setHtml("This <br>is the settings panel"); $accordionPanel->addItem($p1); $accordionPanel->addItem($p2); $accordionPanel->setRenderTo(PhpExt_Javascript::inlineStm("Ext.get('centercolumn')")); */ $accordionPanel = new PhpExt_Panel(); $accordionPanel->setTitle("Accordion Sample")->setWidth(500)->setHeight(300); $accordion = new PhpExt_Layout_AccordionLayout(); $accordion->setTitleCollapse(true)->setAnimate(true); $accordionPanel->setLayout($accordion); $p1 = new PhpExt_Panel(); $p1->setTitle("Navigation")->setHtml("This <bt>is the navigation panel"); $p2 = new PhpExt_Panel(); $p2->setTitle("Settings")->setHtml("This <br>is the settings panel"); $accordionPanel->addItem($p1); $accordionPanel->addItem($p2); $accordionPanel->setRenderTo(PhpExt_Javascript::inlineStm("Ext.get('centercolumn')")); echo PhpExt_Ext::onReady($accordionPanel->getJavascript(false, "accordionPanel"));
$store->setReader($reader)->setData(PhpExt_Javascript::variable("data")); /* Data array could be used directly also as $store->setData($myData) */ $italicRenderer = PhpExt_Javascript::functionDef("italic", "return '<i>' + value + '</i>'", array("value")); $changeRenderer = PhpExt_Javascript::functionDef("change", "if(val > 0){\r\n return '<span style=\"color:green;\">' + val + '</span>';\r\n }else if(val < 0){\r\n return '<span style=\"color:red;\">' + val + '</span>';\r\n }\r\n return val;", array("val")); $pctChangeRenderer = PhpExt_Javascript::functionDef("pctChange", "if(val > 0){\r\n return '<span style=\"color:green;\">' + val + '%</span>';\r\n }else if(val < 0){\r\n return '<span style=\"color:red;\">' + val + '%</span>';\r\n }\r\n return val;", array("val")); // ColumnModel $colModel = new PhpExt_Grid_ColumnModel(); $colModel->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Company", "company", "company", 160, null, null, true, false))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Price", "price", null, 75, null, PhpExt_Javascript::variable("Ext.util.Format.usMoney"), null, true))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Change", "change", null, 75, null, PhpExt_Javascript::variable('change'), null, true))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("% Change", "pctChange", null, 75, null, PhpExt_Javascript::variable('pctChange'), null, true))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Last Updated", "lastChange", null, 75, null, PhpExt_Javascript::variable("Ext.util.Format.dateRenderer('m/d/Y')"), null, true)); // Form Panel $gridForm = new PhpExt_Form_FormPanel("company-form"); $gridForm->setFrame(true)->setLabelAlign(PhpExt_Form_FormPanel::LABEL_ALIGN_LEFT)->setTitle("Company Data")->setBodyStyle("padding: 5px;")->setWidth(750)->setLayout(new PhpExt_Layout_ColumnLayout()); // Setup Grid $leftPanel = new PhpExt_Panel(); $leftPanel->setLayout(new PhpExt_Layout_FitLayout()); $selModel = new PhpExt_Grid_RowSelectionModel(); $selModel->setSingleSelect(true)->attachListener("rowselect", new PhpExt_Listener(PhpExt_Javascript::functionDef(null, "Ext.getCmp(\"company-form\").getForm().loadRecord(rec);", array("sm", "row", "rec")))); $grid = new PhpExt_Grid_GridPanel(); $grid->setStore($store)->setColumnModel($colModel)->setSelectionModel($selModel)->setAutoExpandColumn("company")->setHeight(350)->setTitle("Company Data")->setBorder(true)->attachListener("render", new PhpExt_Listener(PhpExt_Javascript::functionDef(null, "g.getSelectionModel().selectRow(0);", array("g")), null, 10)); $leftPanel->addItem($grid); $gridForm->addItem($leftPanel, new PhpExt_Layout_ColumnLayoutData(0.6)); // Setup Fields $rightPanel = new PhpExt_Form_FieldSet(); $rightPanel->setLabelWidth(90)->setTitle("Company Details")->setDefaults(new PhpExt_Config_ConfigObject(array("width" => 140)))->setDefaultType("textfield")->setAutoHeight(true)->setBodyStyle(PhpExt_Javascript::inlineStm("Ext.isIE ? 'padding:0 0 5px 15px;' : 'padding:10px 15px;'"))->setBorder(false)->setCssStyle(new PhpExt_Config_ConfigObject(array("margin-left" => "10px", "margin-right" => PhpExt_Javascript::inlineStm('Ext.isIE6 ? (Ext.isStrict ? "-10px" : "-13px") : "0"')))); $rightPanel->addItem(PhpExt_Form_TextField::createTextField("company", "Name")); $rightPanel->addItem(PhpExt_Form_TextField::createTextField("price", "Price")); $rightPanel->addItem(PhpExt_Form_TextField::createTextField("pctChange", "% Change")); $rightPanel->addItem(PhpExt_Form_TextField::createTextField("lastChange", "Last Updated")); $gridForm->addItem($rightPanel, new PhpExt_Layout_ColumnLayoutData(0.4)); $gridForm->setRenderTo(PhpExt_Javascript::variable("Ext.get('centercolumn')"));
include_once 'PhpExt/Layout/FitLayout.php'; include_once 'PhpExt/Layout/AccordionLayout.php'; include_once 'PhpExt/Layout/TabLayout.php'; include_once 'PhpExt/Layout/BorderLayout.php'; include_once 'PhpExt/Layout/BorderLayoutData.php'; include_once 'PhpExt/Layout/TabLayoutData.php'; include_once 'PhpExt/Grid/PropertyGrid.php'; /* * The container component for the border layout can also be a PhpExt_Viewport which will * fill the space provided by the browser. In these example a Panel is used to keep the website layout. * See API Documentation for more info on Viewport. * */ $viewport = new PhpExt_Panel(); $viewport->setHeight(600); $viewport->setLayout(new PhpExt_Layout_BorderLayout()); // Norht Region $north = new PhpExt_BoxComponent(); $north->setEl("north"); $north->setHeight(32); $viewport->addItem($north, PhpExt_Layout_BorderLayoutData::createNorthRegion()); // South Region $south = new PhpExt_Panel(); $south->setContentElement("south")->setCollapsible(true)->setTitle("South")->setHeight(100); $viewport->addItem($south, PhpExt_Layout_BorderLayoutData::createSouthRegion()->setSplit(true)->setMinSize(100)->setMaxSize(200)->setMargins("0 0 0 0")); // East Region $east = new PhpExt_Panel(); $east->setTitle("East Size")->setCollapsible(true)->setWidth(225)->setLayout(new PhpExt_Layout_FitLayout()); $eastTabs = new PhpExt_TabPanel(); $eastTabs->setActiveTab(1)->setTabPosition(PhpExt_TabPanel::TAB_POSITON_BOTTOM)->setBorder(false); // Tab 1
$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"));
/** * The Ext.Container.layout to use inside the fieldset (defaults to {@link PhpExt_Layout_FormLayout}). * @param PhpExt_Layout_ContainerLayout $value * @return PhpExt_Form_FieldSet */ public function setLayout(PhpExt_Layout_ContainerLayout $value) { return parent::setLayout($value); }