/** * Strategy pattern: Initialize the configuration. * * Create the new Zend_Form objects from the specified configuration files * for adding to this object and put this object into the Zend_Registry * * See {@link \Zend_Form} * See {@link \Zend_Registry} * * @param \Zend_Controller_Request_Abstract $request */ public function init(\Zend_Controller_Request_Abstract $request) { foreach ($this->_options as $id => $params) { if (is_array($params)) { // Check if the path parameter has been defined if (!isset($params['path'])) { throw new Exception('The \'path\' parameter is required with the path to form configuration file'); } // Check if the class parameter has been defined if (isset($params['class'])) { $formClass = $params['class']; } else { //Use the defautl class (base class) $formClass = '\\Zend_Form'; } if (!isset($params['section'])) { $params['section'] = null; } //Get full path to configuration file $basePath = !isset($params['inModule']) || $params['inModule'] == true ? \Zend_Controller_Front::getInstance()->getModuleDirectory() : APPLICATION_PATH; $params['path'] = \ifc\util\zend\Config::prepareAbsolutePath($basePath, $params['path']); //Create form from configuration file $this->_forms[$id] = new $formClass(\ifc\util\zend\Config::loadConfigFile($params['path'], $params['section'])); } else { throw new Exception('The form configuration file specification has to be an array'); } } //Save it for later retrieval \Zend_Registry::set($this->_regKey, $this); }
/** * Strategy pattern: Initialize the configuration. * * Change the head link elements of the web page according the configuration * pararmeters * * * @param \Zend_Controller_Request_Abstract $request */ public function init(\Zend_Controller_Request_Abstract $request) { if (!isset($this->_options['path'])) { throw new Exception('The \'path\' parameter is required with the path to Doctrine ORM configuration file'); } $fconfigSection = !isset($this->_options['section']) ? null : $this->_options['section']; //Get full path to configuration file $basePath = !isset($params['inModule']) || $params['inModule'] == true ? \Zend_Controller_Front::getInstance()->getModuleDirectory() : APPLICATION_PATH; $this->_options['path'] = \ifc\util\zend\Config::prepareAbsolutePath($basePath, $this->_options['path']); //Create and configure Doctrine ORM $this->configure(\ifc\util\zend\Config::loadConfigFile($this->_options['path'], $this->_options['section'])->toArray()); //Save it for later retrieval \Zend_Registry::set($this->_regKey, $this); }
/** * Strategy pattern: Initialize the configuration. * * It adds pages from the configuration file to registered navigation container, * otherwise register a new one and it adds the pages to this. * * See {@link \Zend_Navigation_Container} * See {@link \Zend_Application_Bootstrap_BootstrapAbstract} * See {@link \Zend_Application_Resource_Navigation} * See getContainer() from {@link \Zend_View_Helper_Navigation_HelperAbstract} * * @param Zend_Controller_Request_Abstract $request Request to process (in this * configuration is not used) */ public function init(\Zend_Controller_Request_Abstract $request) { if ($this->_getBootstrap()->hasResource('navigation')) { $navigation = $this->_getBootstrap()->getResource('navigation'); } else { if (\Zend_Registry::isRegistered('Zend_Navigation') && \Zend_Registry::get('Zend_Navigation') instanceof \Zend_Navigation_Container) { // This is the default container used by view if it didn't has a defined container $navigation = \Zend_Registry::get('Zend_Navigation'); } else { // There is not registered \Zend_Navigation_Containter; we are going // to register one through the bootstrap $navigation = new \Zend_Navigation_Container(); $this->_getBootstrap()->getContainer()->{'navigation'} = $navigation; } } // If the configuraiton file defines a new navigation structure, then // replaces old structure if (!$this->_complementaryPages) { $navigation->removePages(); } if (isset($this->_file)) { $navigation->addPages(\ifc\util\zend\Config::loadConfigFile($this->_file['path'], $this->_file['section'])); } }