public function createTask()
 {
     $class = $this->request->getVal('task_class');
     $method = $this->request->getVal('task_method');
     $args = $this->request->getArray('args', []);
     try {
         list($taskId, $methodCall) = $this->model->createTask($class, $method, $args);
     } catch (Exception $e) {
         $this->response->setException($e);
         return;
     }
     $this->response->setFormat(WikiaResponse::FORMAT_JSON);
     $this->response->setBody(json_encode(['task_id' => $taskId, 'method_call' => $methodCall]));
 }
 /**
  *This method loads the projects home page 
  *@param null
  *@return void
  *@throws This method does not throw an error
  */
 public function getIndex()
 {
     //get all projects from the database
     $data['projects'] = ProjectsModel::all();
     //get all tasks
     $data['tasks'] = TasksModel::all();
     //load the view file with this information
     return View::make('home/index', $data);
 }
 /**
  * Set status for task
  * Send this task
  * @return boolean
  */
 public function actionChangeStatus()
 {
     $id = NULL;
     $status = 0;
     if (isset($_POST['id'])) {
         $id = intval($_POST['id']);
     }
     if (isset($_POST['status'])) {
         $status = intval($_POST['status']);
     }
     if ($id) {
         if (TasksModel::changeStatus($id, $status)) {
             $this->answer['ok'] = 1;
             $this->answer['data'] = TasksModel::getById($id);
             $this->answer['msg'][] = "status was changed";
         } else {
             $this->answer['msg'][] = "status wasn't changed";
         }
     }
     echo json_encode($this->answer);
     return TRUE;
 }