public function __toString() { $this->_config->setXType(''); $this->_config->setFType('filters'); $this->_config->filters = "[\n\t" . Utils_String::addIndent(implode(",\n", array_values($this->_filters)), 2) . "\n]"; return parent::__toString(); }
public function __toString() { $this->_convertFields(); $this->_convertListeners(); $fields = array(); if (!empty($this->_fields)) { $this->fields = "[\n" . Utils_String::addIndent(implode(',', array_values($this->_fields))) . "\n]"; } if ($this->_config->isValidProperty('model') && strlen($this->_config->model)) { $model = Ext_Code::appendNamespace($this->_config->model); $this->_config->model = $model; } return $this->_config->__toString(); }
protected function _localEventsString() { $code = ''; if (isset($this->_localEvents) && !empty($this->_localEvents)) { $items = array(); foreach ($this->_localEvents as $name => $description) { $items[] = $description['jsDoc'] . "\n" . '"' . $name . '"'; } $code = "\n" . Utils_String::addIndent('this.addEvents(' . "\n" . Utils_String::addIndent(implode(",\n", $items)) . "\n);", 2) . "\n"; } return $code; }
/** * (non-PHPdoc) * @see Ext_Object::__toString() */ public function __toString() { $this->_convertListeners(); $lang = Lang::lang(); $plugins = array(); $features = array(); if (isset($this->_advancedPropertyValues['checkboxSelection']) && $this->_advancedPropertyValues['checkboxSelection']) { $this->_config->selModel = 'Ext.create("Ext.selection.CheckboxModel")'; } if (isset($this->_advancedPropertyValues['rowexpander']) && $this->_advancedPropertyValues['rowexpander']) { if (!empty($this->_advancedPropertyValues['expander_rowbodytpl'])) { $tpl = 'rowBodyTpl:' . $this->_advancedPropertyValues['expander_rowbodytpl']; } else { $tpl = ''; } $plugins[] = '{' . "\n" . "\t" . 'ptype: "rowexpander",' . "\n" . "\t" . 'pluginId:"rowexpander",' . "\n" . "\t" . $tpl . "\n" . '}'; } if (isset($this->_advancedPropertyValues['editable']) && $this->_advancedPropertyValues['editable']) { $plugins[] = 'Ext.create("Ext.grid.plugin.CellEditing", {' . "\n" . "\t" . 'clicksToEdit: ' . $this->_advancedPropertyValues['clicksToEdit'] . ',' . "\n" . "\t" . 'pluginId:"cellediting"' . "\n" . '})'; } if (isset($this->_advancedPropertyValues['grouping']) && $this->_advancedPropertyValues['grouping']) { if (isset($this->_advancedPropertyValues['groupsummary']) && $this->_advancedPropertyValues['groupsummary']) { $remoteRoot = ''; if (isset($this->_advancedPropertyValues['remoteRoot']) && $this->_advancedPropertyValues['remoteRoot']) { } $remoteRoot = 'remoteRoot: "' . $this->_advancedPropertyValues['remoteRoot'] . '"'; $features[] = "{" . "\t" . "id: '" . $this->getName() . "_groupingsummary'," . "\n" . "\t" . "ftype: 'groupingsummary'," . "\n" . "\t" . "groupHeaderTpl: '" . $this->_advancedPropertyValues['groupHeaderTpl'] . "'," . "\n" . "\t" . "hideGroupedHeader:" . intval($this->_advancedPropertyValues['hideGroupedHeader']) . "," . "\n" . "\t" . "startCollapsed: " . intval($this->_advancedPropertyValues['startCollapsed']) . "," . "\n" . "\t" . "enableGroupingMenu: " . intval($this->_advancedPropertyValues['enableGroupingMenu']) . "," . "\n" . "\t" . $remoteRoot . "\n" . "}"; } else { $features[] = "Ext.create('Ext.grid.feature.Grouping',{" . "\n" . "\t" . "groupHeaderTpl: '" . $this->_advancedPropertyValues['groupHeaderTpl'] . "'," . "\n" . "\t" . "startCollapsed: " . intval($this->_advancedPropertyValues['startCollapsed']) . "," . "\n" . "\t" . "enableGroupingMenu: " . intval($this->_advancedPropertyValues['enableGroupingMenu']) . "," . "\n" . "\t" . "hideGroupedHeader:" . intval($this->_advancedPropertyValues['hideGroupedHeader']) . "\n" . "})"; } } $filtersFeature = $this->getFiltersFeature(); $filters = $filtersFeature->getFilters(); if (!empty($filters)) { $features[] = $filtersFeature->__toString(); } if (isset($this->_advancedPropertyValues['summary']) && $this->_advancedPropertyValues['summary']) { $features[] = '{id:"summary" , ftype: "summary"}'; } $columns = '[]'; $columnsList = $this->getColumnsConfig(); if (!empty($columnsList)) { if (isset($this->_advancedPropertyValues['numberedRows']) && $this->_advancedPropertyValues['numberedRows']) { $columns = "[\n\tExt.create('Ext.grid.RowNumberer'),\n" . implode(",\n\t", $columnsList) . "\n]"; } else { $columns = "[\n" . implode(",\n\t", $columnsList) . "\n]"; } } unset($columnsList); if ($this->_config->isValidProperty('store') && strlen($this->_config->store)) { if (isset($this->_advancedPropertyValues['paging']) && $this->_advancedPropertyValues['paging']) { $this->_config->bbar = 'Ext.create("Ext.PagingToolbar", {' . "\n" . "\t" . 'displayInfo: true,' . "\n" . "\t" . 'displayMsg: "' . $lang->DISPLAYING_RECORDS . ' {0} - {1} ' . $lang->OF . ' {2}",' . "\n" . "\t" . 'emptyMsg:appLang.NO_RECORDS_TO_DISPLAY,' . "\n" . "\t" . "listeners:{ \n" . "\t\t" . "beforerender:{\n" . "\t\t\t" . "fn:function(cmp){\n" . "\t\t\t\t" . "cmp.bindStore(cmp.up('grid').getStore());\n" . "\t\t\t" . "}\n" . "\t\t" . "}\n" . "\t" . "}\n" . "})"; } } $this->_config->items = null; $this->_config->columns = $columns; if (!empty($plugins)) { $this->_config->plugins = '[' . "\n" . Utils_String::addIndent(implode(",\n", $plugins)) . "\n]"; } if (!empty($features)) { $this->_config->features = '[' . "\n" . Utils_String::addIndent(implode(",\n", $features)) . "\n]"; } return $this->_config->__toString(); }
public function __toString() { return "{\n" . Utils_String::addIndent(implode(",\n", $this->asStringList())) . "\n}"; }
function objectLocalMethods(array $methods, $id) { $s = '<div id="' . $id . '" style=="width:100%" class="collapsed">'; if (!empty($methods)) { foreach ($methods as $item) { $s .= '<div><pre>' . $item->getJsDoc() . '<br>' . $item->getName() . ':function(' . $item->getParamsLine() . '){' . "\n" . Utils_String::addIndent($item->getCode()) . "\n" . '}</pre></div>'; } } $s .= '</div>'; return $s; }
protected function _compileExtendedSubItems($parent, $mainContainer) { if (!$this->_project->hasChilds($parent)) { return array(); } $mainContainerObject = $this->_project->getItemData($mainContainer); $eventManager = $this->_project->getEventManager(); $childs = $this->_project->getChilds($parent); $items = array(); $docked = array(); $menu = array(); foreach ($childs as $k => $item) { if ($this->_project->hasChilds($item['id'])) { $this->_compileExtendedSubItems($item['id'], $mainContainer); } $itemName = 'me.childObjects.' . $item['id']; switch ($item['data']->getClass()) { case 'Docked': if (!$this->_project->hasChilds($item['id'])) { continue; } $docked[] = $item['data']; break; case 'Menu': if (!$this->_project->hasChilds($item['id'])) { continue; } $menu[] = $item['data']; break; default: $items[] = $itemName; break; } $objectEvents = $eventManager->getObjectEvents($item['id']); if (!empty($objectEvents)) { $eventsConfig = $item['data']->getConfig()->getEvents()->__toArray(); foreach ($objectEvents as $event => $config) { if (empty($config['code'])) { continue; } $params = ''; if (isset($eventsConfig[$event])) { $params = implode(',', array_keys($eventsConfig[$event])); } if ($event === 'handler') { $item['data']->addListener($event, "function(" . $params . "){\n" . Utils_String::addIndent($config['code'], 2) . "\n}"); $item['data']->scope = 'this'; } else { $item['data']->addListener($event, "{\n" . Utils_String::addIndent("fn:function(" . $params . "){\n" . Utils_String::addIndent($config['code'], 2) . "\n},\n" . Utils_String::addIndent("scope:this") . "\n}", 2) . "\n"); } } } $mainContainerObject->addElement($itemName, $item['data']); /** * Convert ActionColumn listeners */ if ($item['data']->getClass() === 'Grid') { $this->_applycolumnEvents($item['data']); $this->_applyFiltersEvents($item['data']->getFiltersFeature()); } } if ($parent !== '0') { $container = $this->_project->getItemData($parent); if (!empty($items)) { $container->items = "[\n" . Utils_String::addIndent(implode(",\n", $items), 1) . "\n]\n"; } if (!empty($docked)) { $container->dockedItems = implode(',', $docked); } if (!empty($menu)) { $container->menu = implode(',', $menu); } } }