protected function _compileJs($parent) { $definesCode = ''; $layoutCode = ''; $items = array(); $docked = array(); $menu = array(); /* * Compile Models and Stores primarily for root node */ if ($parent === 0) { $models = $this->_project->getModels(); if (!empty($models)) { foreach ($models as $id => $item) { $definesCode .= $this->getObjectDefineJs($id); } } $stores = $this->_project->getStores(); if (!empty($stores)) { foreach ($stores as $id => $item) { if ($item->isExtendedComponent()) { $definesCode .= $this->getObjectDefineJs($id); if ($item->getConfig()->defineOnly) { continue; } } $layoutCode .= $this->getObjectLayoutCode($id); $items[] = $this->_project->runnamespace . '.' . $item->getName(); } } } if ($this->_project->hasChilds($parent)) { $childs = $this->_project->getChilds($parent); foreach ($childs as $k => $item) { $itemObject = $item['data']; $oClass = $item['data']->getClass(); /* * Skip Stores amd Models */ if ($oClass === 'Store' || $oClass === 'Model' || $oClass === 'Data_Store' || $oClass === 'Data_Store_Tree') { continue; } if ($itemObject->isExtendedComponent() || in_array($oClass, Designer_Project::$defines, true) || Designer_Project::isWindowComponent($oClass)) { $result = $this->_compileExtendedItem($item['id'], $item['id']); $definesCode .= $result['defines']; continue; } switch ($oClass) { case 'Docked': if (!$this->_project->hasChilds($item['id'])) { continue; } $result = $this->_compileItem($item['id']); $layoutCode .= $result['layout']; /* * Only last Ext_Docked object will be processed */ $docked = $this->_project->runnamespace . '.' . $itemObject->getName(); break; case 'Menu': if (!$this->_project->hasChilds($item['id'])) { continue; } $menu = $this->_compileConfig($item['id']); break; default: $result = $this->_compileItem($item['id']); $layoutCode .= $result['layout']; $items[] = $this->_project->runnamespace . '.' . $itemObject->getName(); break; } } } if ($parent !== 0) { $parentObject = $this->_project->getItemData($parent); if (!empty($items) && $parentObject->isValidProperty('items')) { $parentObject->items = Utils_String::addIndent("[\n" . Utils_String::addIndent(implode(",\n", $items)) . "\n]\n"); } if (!empty($docked) && $parentObject->isValidProperty('dockedItems')) { $parentObject->dockedItems = $docked; } if (!empty($menu) && $parentObject->isValidProperty('menu')) { $parentObject->menu = $menu; } } return array('defines' => $definesCode, 'layout' => $layoutCode); }