Example #1
0
 /**
  * Set the access level of an article
  *
  * @param      integer $access Access level to set
  * @return     void
  */
 public function accessTask($access = 0)
 {
     // Incoming
     $id = Request::getInt('id', 0);
     // Make sure we have an ID to work with
     if (!$id) {
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller), Lang::txt('COM_STOREFRONT_NO_ID'), 'error');
         return;
     }
     // Load the article
     $row = new Category($id);
     $row->set('access', $access);
     // Check and store the changes
     if (!$row->store(true)) {
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller), $row->getError(), 'error');
         return;
     }
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller));
 }