Example #1
0
 public function tasksListAction()
 {
     $status = null;
     $offset = 0;
     if (array_key_exists('offset', $_GET) && (int) $_GET['offset'] > 0) {
         $offset = (int) $_GET['offset'];
     }
     if (array_key_exists(TaskConst::STATUS, $_GET) && (int) $_GET[TaskConst::STATUS] > 0) {
         $status = (int) $_GET[TaskConst::STATUS];
     }
     $this->no_layout(true);
     $tasks = $this->_driver->get_tasks(TASKS_LIST_LIMIT, $offset, $status);
     $templates = array();
     $tasks_count = $this->_driver->get_tasks_count_by_status($status);
     foreach ($tasks as $task) {
         $task_name = $task['task_name'];
         if (array_key_exists($task_name, $templates)) {
             continue;
         }
         $templates[$task_name] = Template::list_partial_template_exist($task_name) ? $task_name : PARTIAL_DEFAULT_TEMPLATE_NAME;
     }
     $this->assign('tasks', $tasks);
     $this->assign('templates', $templates);
     $this->assign('tasks_offset', $offset);
     $this->assign('tasks_count', $tasks_count);
 }