Example #1
0
 function setActions($value)
 {
     $name = $this->getReference();
     $Block = Twm::getLayout()->getBlock($name);
     foreach ($value as $method => $params) {
         $Block->{$method}($params);
     }
 }
Example #2
0
 /**
  *
  * @return Twm_Core_Design_Layout
  */
 function getLayout()
 {
     if (null === $this->_layout) {
         $layout = Twm::getLayout();
         $this->_layout = $layout;
     }
     return $this->_layout;
 }
Example #3
0
 protected function getSkinUrl($prependBaseUrl)
 {
     $package = Twm::getDesign()->getPackage();
     if ($prependBaseUrl) {
         return $this->view->baseUrl($package->getSkinUrl());
     }
     return $package->getSkinUrl();
 }
Example #4
0
 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();
 }
Example #5
0
 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));
     }
 }
Example #6
0
 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;
     }
 }
Example #7
0
 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];
 }
Example #8
0
 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;
 }
Example #9
0
 function init()
 {
     $Layout = Twm::getLayout();
     $Layout->setAdapter($this->getLayoutAdapter());
 }
Example #10
0
 public function get()
 {
     $this->prepare();
     $data = $this->_adapter->get($this->getQuery());
     return Twm::getModel($this->_modelClass, $data);
 }
Example #11
0
 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;
 }
Example #12
0
 protected function getBlock($name)
 {
     $Layout = Twm::getDesign()->getLayout();
     return $Layout->getBlock($name);
 }