예제 #1
0
 /**
  * Get module contents
  *
  * @return  void
  */
 public function run()
 {
     require_once Component::path('com_poll') . DS . 'models' . DS . 'poll.php';
     $model = new Poll();
     // Load the latest poll
     $this->poll = $model->getLatest();
     require $this->getLayoutPath();
 }
예제 #2
0
 /**
  * Method to show the latest poll
  *
  * @return  void
  */
 public function latestTask()
 {
     $model = new Poll($this->database);
     $poll = $model->getLatest();
     // if id value is passed and poll not published then exit
     if ($poll->id > 0 && $poll->published != 1) {
         throw new Exception(Lang::txt('JGLOBAL_AUTH_ACCESS_DENIED'), 403);
     }
     $options = $model->getPollOptions($poll->id);
     // Adds parameter handling
     $params = \App::get('menu.params');
     //Set page title information
     $menus = \App::get('menu');
     $menu = $menus->getActive();
     // because the application sets a default page title, we need to get it
     // right from the menu item itself
     if (is_object($menu)) {
         $menu_params = new \Hubzero\Config\Registry($menu->params);
         if (!$menu_params->get('page_title')) {
             $params->set('page_title', $poll->title);
         }
     } else {
         $params->set('page_title', $poll->title);
     }
     Document::setTitle($params->get('page_title'));
     //Set pathway information
     Pathway::append($poll->title, '');
     $params->def('show_page_title', 1);
     $params->def('page_title', $poll->title);
     $this->view->set('options', $options)->set('params', $params)->set('poll', $poll)->display();
 }