/** * Load group for GM based on each module.ini configuration. * An example is: * * project.gm.group = project * project.gm.label = 'Projects' * project.module.enabled = on */ public function loadGroup($groupName) { $this->setName($groupName); $modules = Agana_Util_Bootstrap::getModulesNames(); $front = Zend_Controller_Front::getInstance(); foreach ($modules as $module) { $boot = Agana_Util_Bootstrap::getBootstrap($module); if (isset($boot)) { if (count($boot->getOptions())) { $options = $boot->getOptions(); if (isset($options['gm']['group'])) { if (strtolower($options['gm']['group']) == strtolower($this->getName())) { if (isset($options['gm']['label'])) { $this->setLabel($options['gm']['label']); } $class = ucfirst($module) . '_Module_Gm'; //if (Zend_Loader_Autoloader::autoload($class)) { $path = $front->getModuleDirectory($module) . DIRECTORY_SEPARATOR . 'module'; //if (Zend_Loader_Autoloader::autoload($class)) { /** * @var Agana_Module_Menu_Interface */ $moduleGm = new $class(); $this->_modules[$moduleGm->getName()] = $moduleGm; } } } } } }
public static function getAppDeployDate() { $d = "unknown"; $boot = Agana_Util_Bootstrap::getBootstrap(); $opt = $boot->getOption('agana'); if (isset($opt['app']['deploydate'])) { $d = $opt['app']['deploydate']; } return $d; }
protected function getBootstrapOptions() { $boot = Agana_Util_Bootstrap::getBootstrap('media'); if (isset($boot)) { if (count($boot->getOptions())) { return $boot->getOptions(); } } return null; }
public function loadModulesWidgets() { $modules = Agana_Util_Bootstrap::getModulesNames(); foreach ($modules as $mod) { $mod = ucfirst($mod); $class = $mod . '_Module_Dashboard'; if (class_exists($class)) { $moduleDash = new $class(); $this->widgets = array_merge($this->widgets, $moduleDash->getWidgets()); } } }
public static function isControllerEnabled($options = null) { if ($options === null) { $boot = Agana_Util_Bootstrap::getBootstrap('staff'); $boot = $boot->getOptions(); } else { $boot = $options; } if (isset($boot['module']['controller']['volunteer']['enabled'])) { return $boot['module']['controller']['volunteer']['enabled']; } else { return true; } }
public function __construct() { $boot = Agana_Util_Bootstrap::getBootstrap('staff'); $boot = $boot->getOptions(); $this->_name = 'Staff'; $this->_navigation[] = array('icon' => 'icon-group', 'label' => 'Employees', 'module' => 'staff', 'controller' => 'employee', 'action' => 'list', 'route' => 'default', 'uri' => '', 'title' => ''); if (Staff_Domain_Volunteer::isControllerEnabled()) { $this->_navigation[] = array('icon' => 'icon-group', 'label' => 'Volunteers', 'module' => 'staff', 'controller' => 'volunteer', 'action' => 'list', 'route' => 'default', 'uri' => '', 'title' => ''); } $this->_navigation[] = array('icon' => 'icon-wrench', 'label' => 'Job function', 'module' => 'staff', 'controller' => 'jobfunction', 'action' => 'list', 'route' => 'default', 'uri' => '', 'title' => ''); if (Staff_Domain_Expertisearea::isControllerEnabled()) { $this->_navigation[] = array('icon' => 'icon-certificate', 'label' => 'Expertise area', 'module' => 'staff', 'controller' => 'expertisearea', 'action' => 'list', 'route' => 'default', 'uri' => '', 'title' => ''); } }
/** * Returns the path to system file configurated to log errors. If no paramter * is passed, tries to load bootstrap from Agana_Util_Bootstrap, else, loads * from parameter variable. * * @param Bootstrap $bootsrap * @return string System error file path */ public static function getSystemLogPath($bootsrap = null) { if ($bootsrap) { $options = $bootsrap->getOption('agana'); } else { $options = Agana_Util_Bootstrap::getOption('agana'); } if (isset($options['app']['syserrorfile'])) { $sysLogFile = $options['app']['syserrorfile']; } else { $sysLogFile = APPLICATION_DATA_PATH . '/app.error.log.xml'; } return $sysLogFile; }
/** * The constructor instantiate connections params from agana.ini config application */ private function __construct() { $c = Agana_Util_Bootstrap::getOption('agana'); if (isset($c['pdo']['params'])) { $p = $c['pdo']['params']; $this->_driver = $p['driver']; $this->_user = $p['user']; $this->_pwd = $p['password']; $this->_host = $p['host']; $this->_dbName = $p['dbname']; } else { throw new Agana_Exception("No AGANA.PDO configuration founded !"); } }
protected function _getBootstrapOptions() { // get bootstrap options if ($this->_bootOptions === null) { $return = array(); $boot = Agana_Util_Bootstrap::getBootstrap('persons'); if (isset($boot)) { if (count($boot->getOptions())) { $options = $boot->getOptions(); $return['allowedExtensions'] = explode(',', $options['upload']['image']['extensions']); $return['maxSize'] = $options['upload']['image']['maxsize']; $return['path'] = $options['upload']['image']['path']; $return['dimensions'] = array(); if (isset($options['upload']['image']['origin']['width'])) { $return['dimensions']['origin']['width'] = $options['upload']['image']['origin']['width']; } if (isset($options['upload']['image']['origin']['height'])) { $return['dimensions']['origin']['height'] = $options['upload']['image']['origin']['height']; } if (isset($options['upload']['image']['large']['width'])) { $return['dimensions']['large']['width'] = $options['upload']['image']['large']['width']; } if (isset($options['upload']['image']['large']['height'])) { $return['dimensions']['large']['height'] = $options['upload']['image']['large']['height']; } if (isset($options['upload']['image']['medium']['width'])) { $return['dimensions']['medium']['width'] = $options['upload']['image']['medium']['width']; } if (isset($options['upload']['image']['medium']['height'])) { $return['dimensions']['medium']['height'] = $options['upload']['image']['medium']['height']; } if (isset($options['upload']['image']['small']['width'])) { $return['dimensions']['small']['width'] = $options['upload']['image']['small']['width']; } if (isset($options['upload']['image']['small']['height'])) { $return['dimensions']['small']['height'] = $options['upload']['image']['small']['height']; } if (isset($options['upload']['image']['tiny']['width'])) { $return['dimensions']['tiny']['width'] = $options['upload']['image']['tiny']['width']; } if (isset($options['upload']['image']['tiny']['height'])) { $return['dimensions']['tiny']['height'] = $options['upload']['image']['tiny']['height']; } } } $this->_bootOptions = $return; } return $this->_bootOptions; }
/** * Appends Debug output html and scripts to the original page * * @param string $html * @return void */ protected function _displayAganaDebug($html) { // $front = Agana_Util_Bootstrap::getResource('FrontController'); // $router = $front->getRouter(); // Zend_Registry::get('Agana_Debug')->add($router, 'ROUTER'); // Zend_Debug::dump($router->getRoute('default')); // Zend_Debug::dump($router); $html = "<div id='Agana_Debug'>"; $html .= Zend_Registry::get('Agana_Debug')->getAll(); $html .= "</div>\n</body>"; $response = $this->getResponse(); $response->setBody(str_ireplace('</body>', $html, $response->getBody())); $libPath = Agana_Util_Bootstrap::getOption('includePaths'); $libPath = $libPath['library']; $js = file_get_contents($libPath . '/Agana/Api/Debug/js/debug.js'); $js = '<script>' . $js . '</script>'; $response->appendBody($js); }
public function loadMenu() { $modules = Agana_Util_Bootstrap::getModulesNames(); $front = Zend_Controller_Front::getInstance(); foreach ($modules as $module) { $boot = Agana_Util_Bootstrap::getBootstrap($module); if (isset($boot)) { if (count($boot->getOptions())) { $menuOpt = $boot->getOptions(); if ($menuOpt['menu']['load']) { if ($menuOpt['menu']['container'] == 'class') { $class = ucfirst($module) . '_Module_Menu'; //if (Zend_Loader_Autoloader::autoload($class)) { $path = $front->getModuleDirectory($module) . DIRECTORY_SEPARATOR . 'module'; //if (Zend_Loader_Autoloader::autoload($class)) { /** * @var Agana_Module_Menu_Interface */ $moduleMenu = new $class(); $menuArray = $moduleMenu->getMenu(); foreach ($menuArray as $key => $m) { if (is_numeric($key)) { $m = $menuArray[$key]; if (isset($m['parent']) && trim($m['parent']) != '') { $parent = $this->findBy('id', $m['parent']); // if did not find a parent then create it unset($m['parent']); $parent->addPage($m); } else { $page = $this->findBy('id', $m['id']); if (!$page) { $this->addPage($m); } } } } //} } } } } } }
/** * executes the defult url if it is configured at agana.ini file * with agana.defaulturl parameter */ public function indexAction() { $options = Agana_Util_Bootstrap::getOption('agana'); //Zend_Debug::dump(Agana_Api_Util_Bootstrap::getBootstrap()->getOptions()); if (isset($options['defaultdispatch'])) { if (strtolower(trim($options['defaultdispatch'])) == 'redirect') { if (trim($options['defaulturl']) != '') { $this->_redirect($options['defaulturl']); } else { $redirect = new Zend_Controller_Action_Helper_Redirector(); $redirect->gotoSimpleAndExit($options['defaultaction'], $options['defaultcontroller'], $options['defaultmodule']); } } else { if (strtolower(trim($options['defaultdispatch'])) == 'forward') { $this->_forward($options['defaultaction'], $options['defaultcontroller'], $options['defaultmodule']); } } } }
/** * Init config settings and resoure for this module * */ protected function _initModuleConfig() { // load ini file Agana_Util_Bootstrap::loadModuleIni(dirname(__FILE__) . '/configs/module.ini', 'calendar', $this); }
public function sendResetPasswordEmail(User_Model_User $user) { if ($user) { $translate = Zend_Registry::get('Zend_Translate'); $boot = Agana_Util_Bootstrap::getBootstrap(); $aganaOptions = $boot->getOption('agana'); $adminEmail = $aganaOptions['app']['admin']['email']; $appName = $aganaOptions['app']['name']; $mail = new Zend_Mail('UTF-8'); $mail->setFrom($adminEmail, $appName); $mail->setSubject('[' . $appName . '] ' . $translate->_('Url requested to reset password')); $mail->addTo($user->email); $requestUrl = $_SERVER['HTTP_HOST'] . Zend_Controller_Front::getInstance()->getBaseUrl() . '/user/reset-password/create-new/id/' . $user->id . '/key/' . $this->getResetPasswordKey($user); $body = '<html>'; $body .= '<body>'; $body .= '<p>'; $body .= 'Esta mensagem foi enviada pela aplicação <em>' . $appName . '</em>'; $body .= '</p>'; $body .= '<p><strong>' . $user->name . '</strong>, </p>'; $body .= '<p>'; $body .= 'fez uma solicitação para recriar a sua senha.'; $body .= '</p>'; $body .= '<p>'; $body .= 'Clique no link a seguir para confirmar esta solicitação e '; $body .= 'criar uma nova senha:'; $body .= '</p>'; $body .= '<a href="' . $requestUrl . '">'; $body .= $requestUrl; $body .= '</a>'; $body .= '<p>'; $body .= 'Por favor, note que este link irá expirar em 24 horas.'; $body .= 'Se você não solicitou '; $body .= 'esta ação, por favor ignore esta mensagem.'; $body .= '</p>'; $body .= '</body>'; $body .= '</html>'; $mail->setBodyHtml($body); $mail->send(); } else { throw new Exception('Wrong user parameter !'); } }
public function isEditAllowed() { $boot = Agana_Util_Bootstrap::getBootstrap(); $opt = $boot->getOption('agana'); return strtolower($opt['userguide']['edit']) == 'on'; }
/** * Sets module name to be accessed * * @param String $name */ public static function setModule($name) { self::$_module = $name; }
protected function _initTranslate() { $this->_translate = Agana_Util_Bootstrap::iniNewTranslate(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'locales'); return $this->_translate; }
public static function getPrivileges() { // Resources $modules = Agana_Util_Bootstrap::getModulesNames(); $privileges = array(); foreach ($modules as $mod) { $mod = ucfirst($mod); $class = $mod . '_Module_Acl'; if (class_exists($class)) { $moduleAcl = new $class(); $privileges[$mod] = $moduleAcl->getPrivileges(); } } return $privileges; }