/** * (non-PHPdoc) * @see Tudu_Model_ResourceManager_Abstract::getResource() */ public function getResource($name) { try { $res = $this->_bootstrap->getResource($name); } catch (Zend_Application_Bootstrap_Exception $e) { require 'Tudu/Model/ResourceManager/Exception.php'; throw new Tudu_Model_ResourceManager_Exception('Undefined resource named: ' . $name); } return $res; }
/** * Load the configuration file that define the configurations of the module * and return the content into an array. * INI is the expected file format. * * @param string $relativePath Relative path from module root to the directory * where the configuraton file is locatedfrom module * root directory * @param string $fileName The filename of the configuration file * @param string $section The section of the file to load * @return null|array */ protected function _loadModuleConfigurationsFile($relativePath, $fileName, $section) { $moduleDir = $this->getFrontController()->getModuleDirectory($this->getRequest()->getModuleName()); try { $configFile = new \Zend_Config_Ini($moduleDir . DIRECTORY_SEPARATOR . $relativePath . DIRECTORY_SEPARATOR . $fileName, $section); } catch (\Zend_Config_Exception $e) { if ($this->_bootstrap->hasResource('log')) { $logger = $this->_bootstrap->getResource('log'); $logger->notice('Imposible to load module configuration file ; exception message: ' . $e->getMessage()); } return null; } return count($configFile) == 0 ? null : $configFile->toArray(); }
/** * (non-PHPdoc) * @see Zend_Controller_Action::init() */ public function init() { $this->_bootstrap = $this->getInvokeArg('bootstrap'); $this->_multidb = $this->_bootstrap->getResource('multidb'); $this->_options = $this->_bootstrap->getOptions(); $this->_session = $this->_bootstrap->getResource('session'); $this->_user = Tudu_User::getInstance(); $this->_timestamp = time(); if (Zend_Session::sessionExists() || $this->_sessionId) { if (null !== $this->_sessionId) { Zend_Session::setId($this->_sessionId); } $this->initUser(); } }