public function __construct($attributes = array()) { $this->afExtjs = afExtjs::getInstance(); /** * deferredRender & layoutOnTabChange, for creating the layout of each tab after the tab is clicked */ $this->attributes['deferredRender'] = false; //$this->attributes['forceLayout'] = true; $ah = array('autoHeight' => isset($attributes['tabHeight']) && $attributes['tabHeight'] ? false : true); $this->attributes['defaults'] = $this->afExtjs->asAnonymousClass(array_merge(array('iconCls' => '', 'icon' => '', 'bodyStyle' => 'padding:10px;', 'hideMode' => 'offsets', 'autoWidth' => true), $ah)); $this->attributes['listeners']['tabchange'] = $this->afExtjs->asMethod(array('parameters' => 'tabPanel,tab', 'source' => "tabPanel.doLayout();")); /** * Tabs cheats for Ext 3 */ if (afExtjsLayout::getInstance()->getExtjsVersion() == 3) { $this->attributes['deferredRender']['onTabChange'] = true; $this->attributes['listeners']['render'] = $this->afExtjs->asMethod(array('parameters' => 'tabPanel', 'source' => ' tabPanel.getEl().mask("Rendering UI").setStyle({backgroundColor:"#dfe8f6"}).setOpacity(1); tabPanel.setActiveTab(0); while(true){ var tp = tabPanel.getActiveTab().nextSibling(); if(!tp) break; tabPanel.activate(tp); } tabPanel.setActiveTab(0); tabPanel.getEl().unmask(); ')); } if (count($attributes) > 0) { $this->attributes = array_merge($this->attributes, $attributes); } $this->checkIfSetting($this->attributes); }
public function __construct($containerObject, $attributes = array()) { $this->afExtjs = afExtjs::getInstance(); $this->containerObject = $containerObject; if (count($this->attributes) > 0) { $attributes = array_merge($this->attributes, $attributes); } if (isset($attributes['icon'])) { $this->attributes['cls'] = 'x-btn-text-icon'; } //print_r($attributes); if (isset($attributes['icon']) && isset($attributes['iconPosition'])) { if ($attributes['iconPosition'] == 'right') { $this->attributes['cls'] = 'x-btn-text-icon-right'; } elseif ($attributes['iconPosition'] == 'left') { $this->attributes['cls'] = 'x-btn-text-icon'; } } if (isset($attributes['state'])) { switch ($attributes['state']) { case "disabled": $this->attributes['disabled'] = true; break; } unset($attributes['state']); } if (isset($attributes['label'])) { $this->attributes['text'] = $attributes['label']; unset($attributes['label']); } if (isset($attributes['handlers']) && $attributes['handlers'] != '') { if (isset($this->attributes['listeners'])) { foreach ($this->attributes['listeners'] as $type => $type_params) { /** * if listener function source is not an array then the string is used directly */ if (isset($type_params['parameters']) && $type_params['parameters'] != '' && isset($type_params['source']) && !is_array($type_params['source'])) { $this->attributes['listeners'][$type] = array('parameters' => $type_params['parameters'], 'source' => $type_params['source'] . $attributes['handlers'][$type]['source']); } } } else { $this->attributes['listeners'] = $attributes['handlers']; } unset($attributes['handlers']); } if (count($attributes) > 0) { $this->attributes = array_merge($this->attributes, $attributes); } //add the button to the container //to a object container if (is_object($containerObject)) { if (method_exists($this->containerObject, 'addButton')) { $this->containerObject->addButton($this); } } else { afExtjsLayout::getInstance()->attributes['viewport'][$containerObject . '_panel']['tbar'][] = $this->afExtjs->asVar($this->end()); } }
public function end() { $this->addInitMethodSource("\r\n\t\tsetTimeout(function(){\t\t\t\r\n\t\t\tExt.get('loading').remove();\r\n\t Ext.get('loading-mask').fadeOut({remove:true});\r\n\t \r\n\t afApp.loadFirst(true);\r\n\t }, 250);\r\n\t\t"); parent::end(); }
public static function setInstance($object) { self::$instance = $object; }
public function end() { /** * default west panel items */ if ($this->attributes['viewport']['west_panel'] != false && !isset($this->attributes['viewport']['west_panel']['items'])) { $this->addItem('west', array('title' => 'Navigation', 'autoScroll' => 'true', 'border' => 'false', 'iconCls' => 'nav', 'html' => 'test')); $this->addItem('west', array('title' => 'Settings', 'autoScroll' => 'true', 'border' => 'false', 'iconCls' => 'settings', 'html' => 'test2')); } if (isset($this->attributes['viewport']['north_panel']) && !isset($this->afExtjs->private['north_panel'])) { $this->addPanel('north', $this->attributes['viewport']['north_panel']); } if (isset($this->attributes['viewport']['west_panel']) && $this->attributes['viewport']['west_panel'] != false && !isset($this->afExtjs->private['west_panel'])) { $this->addPanel('west', $this->attributes['viewport']['west_panel']); } if (isset($this->attributes['viewport']['south_panel']) && !isset($this->afExtjs->private['south_panel'])) { $this->addPanel('south', $this->attributes['viewport']['south_panel']); } if (isset($this->attributes['viewport']['east_panel']) && !isset($this->afExtjs->private['east_panel'])) { $this->addPanel('east', $this->attributes['viewport']['east_panel']); } $viewportItems = array(); if (isset($this->afExtjs->private['north_panel'])) { $viewportItems[] = $this->afExtjs->asVar('north_panel'); $this->afExtjs->public['getNorth'] = "return north_panel;"; } else { $this->afExtjs->public['getNorth'] = "return false;"; } $this->afExtjs->public['getNorth'] = $this->afExtjs->asMethod($this->afExtjs->public['getNorth']); if (isset($this->afExtjs->private['west_panel'])) { $viewportItems[] = $this->afExtjs->asVar('west_panel'); } /** * if users sends a url directly in browser, then the request is not ajax, so create an empty center_panel in which to load the contents of the given url */ if (!$this->showFullCenter()) { $attributesPanelContainer['style'] = 'padding-right:5px;'; $attributesPanelContainer['border'] = false; $attributesPanelContainer['bodyBorder'] = false; $attributesPanelContainer['layout'] = 'fit'; $attributesPanelContainer['id'] = 'center_panel'; $this->addPanel('center', $attributesPanelContainer); } if (isset($this->afExtjs->private['center_panel'])) { $viewportItems[] = $this->afExtjs->asVar('center_panel'); } if (isset($this->afExtjs->private['south_panel'])) { $viewportItems[] = $this->afExtjs->asVar('south_panel'); } if (isset($this->afExtjs->private['east_panel'])) { $viewportItems[] = $this->afExtjs->asVar('east_panel'); } $this->afExtjs->private['viewport'] = $this->afExtjs->Viewport(array('id' => 'viewport', 'layout' => $this->layout, 'items' => $viewportItems)); @($this->afExtjs->public['init'] .= "\r\n\t\tviewport.doLayout();"); @($this->afExtjs->public['init'] .= "\r\n\t\tsetTimeout(function(){\t\t\t\r\n\t\t\tExt.get('loading').remove();\r\n\t Ext.get('loading-mask').fadeOut({remove:true});\r\n\t \t \r\n\t " . (!$this->showFullCenter() ? "afApp.loadFirst();" : "") . " \r\n\t }, 250);\r\n\t "); $this->afExtjs->public['getViewport'] = "return viewport;"; $this->afExtjs->public['getViewport'] = $this->afExtjs->asMethod($this->afExtjs->public['getViewport']); $this->afExtjs->public['getToolbar'] = "return toolbar;"; $this->afExtjs->public['getToolbar'] = $this->afExtjs->asMethod($this->afExtjs->public['getToolbar']); parent::end(); }