public function run() { $alarmConfig = new Model_Alarm_Log(); $id = $this->getRequest()->getQuery('id'); if ($id) { $configData = $alarmConfig->selectdata($id); $configData['0']['selectedWorkerAction'] = $alarmConfig->selectedWorkerAction($id); } $configData[0]['worker'] = $alarmConfig->getWorkers(); $configData[0]['actions'] = $alarmConfig->getActions(); $this->getView()->assign('L', isset($configData[0]) ? $configData[0] : array()); }
public function run() { $this->triggerTable = Sys_Database::getTable('trigger'); $this->alarmModel = $this->loadModel(); if ($this->getRequest()->getPost('o') == 'delete') { $gid = $this->getRequest()->getPost('gid'); $rlaid = $this->getRequest()->getPost('rlaid'); $this->delete($gid, $rlaid); } if ($this->getRequest()->getQuery('o') == 'edit') { Yaf_Dispatcher::getInstance()->disableView(); $this->initView(); $configData = array(); $id = $this->getRequest()->getQuery('id'); $alarmConfig = new Model_Alarm_Log(); if ($id) { $configDataTmp = $this->alarmModel->selectData($id, 1, 1, $this->triggerTable); $configData = $configDataTmp[0]; $configData['selected'] = $this->alarmModel->getNames($configData['rlaid']); } $configData['logs'] = $alarmConfig->getLogs(); $configData['worker'] = $alarmConfig->getWorkers(); $configData['actions'] = $alarmConfig->getActions(); $this->display('addtrigger', array('D' => $configData)); } if ($this->getRequest()->getQuery('o') == 'add') { $this->add(); } $page = $this->getRequest()->getQuery('p'); $alarmList['page'] = $page ? $page : 1; $id = $this->getRequest()->getQuery('pluginid'); $pid = $id ? $id : NULL; $limit = 20; $alarmList['list'] = $this->alarmModel->selectData($pid, ($alarmList['page'] - 1) * $limit, $limit, $this->triggerTable); if ($alarmList['list']) { foreach ($alarmList['list'] as $k => $v) { $r = $this->alarmModel->getNames($v['rlaid']); $alarmList['list'][$k]['log'] = isset($r['logid']) ? $r['logid'] . "-" . $r['service'] : ''; $alarmList['list'][$k]['worker'] = isset($r['workerid']) ? $r['workerid'] . "-" . $r['workername'] : ''; $alarmList['list'][$k]['action'] = isset($r['actionid']) ? $r['actionid'] . "-" . $r['actionname'] : ''; } } $alarmNum = $this->alarmModel->selectData($pid, -1, -1, $this->triggerTable); $alarmList['num'] = $alarmNum['num']; $alarmList['pageCount'] = (int) ($alarmList['num'] / $limit) + 1; $alarmList['pageView'] = $this->page($alarmList['page'], $alarmList['pageCount']); $this->getView()->assign('alarmList', $alarmList); }