/**
  * Displays the view
  *
  * @param   string  $tpl  The template to use
  *
  * @return  boolean|null False if we can't render anything
  */
 public function display($tpl = null)
 {
     // Get the task set in the model
     $model = $this->getModel();
     $task = $model->getState('task', 'browse');
     // Call the relevant method
     $method_name = 'on' . ucfirst($task);
     if (method_exists($this, $method_name)) {
         $result = $this->{$method_name}($tpl);
     } else {
         $result = $this->onDisplay();
     }
     if ($result === false) {
         return;
     }
     // Show the view
     if ($this->doPreRender) {
         $this->preRender();
     }
     parent::display($tpl);
     if ($this->doPostRender) {
         $this->postRender();
     }
 }
Esempio n. 2
0
 /**
  * Displays the view
  *
  * @param   string  $tpl  The template to use
  *
  * @return  boolean|null False if we can't render anything
  */
 public function display($tpl = null)
 {
     // Get the task set in the model
     $model = $this->getModel();
     $task = $model->getState('task', 'browse');
     // Call the relevant method
     $method_name = 'on' . ucfirst($task);
     if (method_exists($this, $method_name)) {
         $result = $this->{$method_name}($tpl);
     } else {
         $result = $this->onDisplay();
     }
     if ($result === false) {
         return;
     }
     list($isCli, $isAdmin) = FOFDispatcher::isCliAdmin();
     // Don't load the toolbar on CLI
     if (!$isCli) {
         $toolbar = FOFToolbar::getAnInstance($this->input->getCmd('option', 'com_foobar'), $this->config);
         $toolbar->perms = $this->perms;
         $toolbar->renderToolbar($this->input->getCmd('view', 'cpanel'), $task, $this->input);
     }
     // Show the view
     if ($this->doPreRender) {
         $this->preRender();
     }
     parent::display($tpl);
     if ($this->doPostRender) {
         $this->postRender();
     }
 }