private function _execute() { $instance = new ReflectionClass(self::$_className); $model = $instance->newInstance(); $response = $instance->getMethod($this->_method)->invokeArgs($model, $this->_arguments); return Model_Result::factory($response, $this->_returnType, self::$_className); }
public function actionGetIndexData() { $userId = $_SESSION['userInfo']['user_id']; $dataList = $this->_dataModel->getDataList($userId, array('data_id,data_name,user_id')); $resultModel = new Model_Result(); $resultList = $resultModel->getResultList($userId, array('data_id', 'type', 'ret_id')); $graphsModel = new Model_Graphs(); $graphsList = $graphsModel->getGraphsList($userId, array('data_id', 'type', 'g_id')); $return = array('files' => array(), 'results' => array(), 'graphs' => array()); $dataMap = array(); //处理filelist if ($dataList) { foreach ($dataList as $data) { $return['files'][] = array('dataId' => $data['data_id'], 'dataName' => $data['data_name']); $dataMap[$data['data_id']] = $data['data_name']; } } //处理result if ($resultList) { foreach ($resultList as $result) { $dataId = $result['data_id']; $dataName = $dataMap[$dataId]; $key = 'result_' . $dataId; if (!isset($return['results'][$key])) { $return['results'][$key]['dataId'] = $dataId; $return['results'][$key]['dataName'] = $dataName; } $return['results'][$key]['resultList'][] = array('resultId' => $result['ret_id'], 'resultName' => $dataName . $result['type'] . "的分析结果", 'resultType' => $result['type']); } } //处理graphs if ($graphsList) { foreach ($graphsList as $graphs) { $dataId = $graphs['data_id']; $dataName = $dataMap[$dataId]; $key = 'graphs_' . $dataId; if (!isset($return['graphs'][$key])) { $return['graphs'][$key]['dataId'] = $dataId; $return['graphs'][$key]['dataName'] = $dataName; } $return['graphs'][$key]['graphsList'][] = array('graphsId' => $graphs['g_id'], 'graphsName' => $dataName . $graphs['type'] . "的分析结果", 'graphsType' => $graphs['type']); } } echo json_encode(array('status' => 0, 'data' => $return)); }
public function sessionAction() { if ($this->getRequest()->isGet()) { $sessionid = $this->_getParam('id'); $session = Model_Session::findOneById($sessionid); $this->view->session = $session; $config = new Zend_Config_Ini(APPLICATION_PATH . '/forms/session.ini', 'result'); $this->view->form = new Zend_Form($config->session); $this->view->form->sessionid->setValue($sessionid); } else { if ($this->getRequest()->isPost()) { $sessionid = $this->_getParam('sessionid'); $result = new Model_Result(); $result->sessionid = $sessionid; $result->description = $this->_getParam('description'); $result->value = $this->_getParam('value'); $result->save(); $session = Model_Session::findOneById($sessionid); $this->view->session = $session; $config = new Zend_Config_Ini(APPLICATION_PATH . '/forms/session.ini', 'result'); $this->view->form = new Zend_Form($config->session); $this->view->form->sessionid->setValue($sessionid); } else { $this->_redirect('/admin/'); } } }