コード例 #1
0
 public function getTask()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     if (!has_value($this->request->get['task_name'])) {
         $this->data['output'] = array('error' => true, 'error_text' => 'Error: Do not know what to run.');
     } else {
         $task_obj = new ATaskManager();
         $this->data['output'] = $task_obj->getTaskByName($this->request->get['task_name']);
     }
     //init controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->load->library('json');
     if ($this->data['output']) {
         $output = AJson::encode($this->data['output']);
     } else {
         $output = array('error' => true, 'error_text' => 'Error: Cannot find task "' . $this->request->get['task_name'] . '".');
     }
     $this->response->setOutput($output);
 }