Esempio n. 1
0
 /**
  * List resource roles
  *
  * @return  void
  */
 public function displayTask()
 {
     // Incoming
     $filters = array('search' => Request::getState($this->_option . '.' . $this->_controller . '.search', 'search', ''), 'sort' => Request::getState($this->_option . '.' . $this->_controller . '.sort', 'filter_order', 'title'), 'sort_Dir' => Request::getState($this->_option . '.' . $this->_controller . '.sortdir', 'filter_order_Dir', 'ASC'));
     // Instantiate an object
     $model = Role::all();
     if ($filters['search']) {
         $model->whereLike('title', strtolower($filters['search']));
     }
     // Get records
     $rows = $model->ordered('filter_order', 'filter_order_Dir')->paginated('limitstart', 'limit')->rows();
     // Output the HTML
     $this->view->set('rows', $rows)->set('filters', $filters)->display();
 }
Esempio n. 2
0
 /**
  * Edit an entry
  *
  * @param   array  $rows
  * @return  void
  */
 public function editTask($rows = null)
 {
     Request::setVar('hidemainmenu', 1);
     $authorid = 0;
     if (!is_array($rows)) {
         // Incoming
         $authorid = Request::getVar('id', array(0));
         if (is_array($authorid)) {
             $authorid = !empty($authorid) ? $authorid[0] : 0;
         }
         $rows = Author::all()->whereEquals('authorid', $authorid)->rows();
     }
     $roles = Role::all()->ordered()->rows();
     // Set any errors
     foreach ($this->getErrors() as $error) {
         Notify::error($error);
     }
     // Output the HTML
     $this->view->set('rows', $rows)->set('authorid', $authorid)->set('roles', $roles)->setLayout('edit')->display();
 }