protected function _populateHandlers() { $this->_handlers = array(); try { $cacheCodeObjects = Zend_Registry::get('cacheCodeObjects'); } catch (Exception $e) { $cacheCodeObjects = array(); } $handler = new GeneralAlertHandler(); $handlerIterator = $handler->getIterator(); foreach ($handlerIterator as $item) { $this->_evaluateCodes($item); $this->_handlers[] = $item; } Zend_Registry::set('cacheCodeObjects', $cacheCodeObjects); }
protected function _populateHandlers() { $this->_handlers = array(); try { $cacheCodeObjects = Zend_Registry::get('cacheCodeObjects'); } catch (Exception $e) { $cacheCodeObjects = array(); } $handler = new GeneralAlertHandler(); $db = Zend_Registry::get('dbAdapter'); $sqlSelect = $db->select()->from($handler->_table)->where('active = 1'); $handlerIterator = $handler->getIterator($sqlSelect); foreach ($handlerIterator as $item) { $this->_evaluateCodes($item); $this->_handlers[] = $item; } Zend_Registry::set('cacheCodeObjects', $cacheCodeObjects); }
public function listHandlersAction() { $handler = new GeneralAlertHandler(); $handlerIterator = $handler->getIterator(); $listConditions = Handler::listConditions(); $rows = array(); foreach ($handlerIterator as $item) { $condition = 'Custom'; if (isset($listConditions[$item->condition]) && !strlen($item->handlerObject) > 0) { $condition = $listConditions[$item->condition]; } $tmp = array(); $tmp['id'] = $item->generalAlertHandlerId; $tmp['data'][] = $item->name; $tmp['data'][] = $condition; $tmp['data'][] = $item->active ? __('Yes') : __('No'); $rows[] = $tmp; } $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct(array('rows' => $rows)); }