protected function getSkinUrl($prependBaseUrl) { $package = Twm::getDesign()->getPackage(); if ($prependBaseUrl) { return $this->view->baseUrl($package->getSkinUrl()); } return $package->getSkinUrl(); }
protected function _initPackages($options) { $Design = Twm::getDesign(); foreach ($options as $key => $packageOptions) { $Package = new Twm_Core_Design_Package($key, $packageOptions); $Design->addPackage($Package); } $Design->rebuild(); }
protected function _initView(Zend_Controller_Request_Abstract $request) { $Package = Twm::getDesign()->getPackage(); $paths = $Package->getBasePaths(); $moduleName = $request->getModuleName(); $ds = DIRECTORY_SEPARATOR; $this->view->setScriptPath(null); foreach ($paths as $designPath) { $this->view->addScriptPath(strtolower($designPath . $ds . 'modules' . $ds . $moduleName . $ds)); } }
function preDispatch() { $r = $this->getRequest(); $pageKey = array($r->getModuleName(), $r->getControllerName(), $r->getActionName()); $pageKey = implode('_', $pageKey); $layout = Twm::getDesign()->getLayout(); if (true === $layout->hasPage($pageKey)) { $block = $layout->getRootBlock($pageKey); $this->_actionController->block = $block; $this->_actionController->view->block = $block; } }
public function getContainer() { $area = Twm::getDesign()->getArea(); if (null === $this->_container) { // try to fetch from registry first require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered('Zend_Navigation')) { $nav = Zend_Registry::get('Zend_Navigation'); if ($nav instanceof Zend_Navigation_Container) { return $this->_container = $nav; } } // nothing found in registry, create new container require_once 'Zend/Navigation.php'; return $this->_container = new Zend_Navigation(); } return $this->_container[$area]; }
public function getLayoutConfig($section = "") { $Package = Twm::getDesign()->getPackage(); $paths = $Package->getBasePaths(); $config = array(); $loaded = array(); $ds = DIRECTORY_SEPARATOR; /* * read all layout xml files to arrays */ foreach ($paths as $path) { $path = $path . $ds . $this->_layoutdirectory . $ds; $Dir = new DirectoryIterator($path); foreach ($Dir as $fileInfo) { if ($fileInfo->isFile()) { $filename = $fileInfo->getFilename(); $module = explode('.', $filename); array_pop($module); $module = implode('.', $module); if (!isset($loaded[$module])) { $config[$module] = $this->_loadLayoutConfig($path . $ds . $filename); } } } } /* * merge all arrays to one array */ $mergedConfig = array(); foreach ($config as $module => $config) { $mergedConfig = array_merge_recursive($mergedConfig, $config); } /* * merge default section with the requested section */ $sectionConfig = null; if (isset($mergedConfig[$section])) { if (empty($mergedConfig[$section])) { $mergedConfig[$section] = array(); } $mergedConfig = array_merge_recursive($mergedConfig['default'], $mergedConfig[$section]); } return $mergedConfig; }
function getView() { if (null === $this->_view) { $Package = Twm::getDesign()->getPackage(); $paths = $Package->getBasePaths(); $ds = DIRECTORY_SEPARATOR; $view = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view; $view->setScriptPath(null); foreach ($paths as $designPath) { $view->addScriptPath(strtolower($designPath . $ds . 'modules' . $ds)); } $this->_view = $view; } return $this->_view; }
protected function getBlock($name) { $Layout = Twm::getDesign()->getLayout(); return $Layout->getBlock($name); }