Ejemplo n.º 1
0
 /**
  * Index action - display all tasks
  *
  * @package     las
  * @version     1.0
  */
 public function indexAction()
 {
     $this->tag->setTitle(__('Tasks'));
     // Available sort to choose
     $this->filter->add('in_array', function ($value) {
         return in_array($value, ['name', 'name DESC', 'status', 'status DESC', 'type', 'type DESC', 'when', 'when DESC']) ? $value : null;
     });
     // Get tasks and prepare pagination
     $paginator = new Paginator(["data" => Tasks::find(['order' => $this->request->getQuery('order', 'in_array', 'id', true)]), "limit" => $this->request->getQuery('limit', 'int', 20, true), "page" => $this->request->getQuery('page', 'int', 1, true)]);
     $this->view->setVars(['pagination' => $paginator->getPaginate()]);
 }