Example #1
0
 /**
  * Display a list of sections and their categories
  *
  * @return  void
  */
 public function displayTask()
 {
     // Get authorization
     $this->_authorize('section');
     $this->_authorize('category');
     $forum = new Manager('site', 0);
     // Filters
     $filters = array('scope' => $forum->get('scope'), 'scope_id' => $forum->get('scope_id'), 'state' => Section::STATE_PUBLISHED, 'search' => '', 'access' => User::getAuthorisedViewLevels());
     // Flag to indicate if a section is being put into edit mode
     $edit = null;
     if ($this->getTask() == 'edit' && $this->config->get('access-edit-section')) {
         $edit = Request::getVar('section', '');
     }
     $sections = $forum->sections($filters);
     if (!$sections->count() && $this->config->get('access-create-section') && Request::getWord('action') == 'populate') {
         if (!$forum->setup()) {
             $this->setError($forum->getError());
         }
         $sections = $forum->sections($filters);
     }
     // Set the page title
     App::get('document')->setTitle(Lang::txt(strtoupper($this->_option)));
     // Set the pathway
     Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option);
     $this->view->set('filters', $filters)->set('config', $this->config)->set('forum', $forum)->set('sections', $sections)->set('edit', $edit)->display();
 }