/** * Executes a given controller task. The onBefore<task> and onAfter<task> methods are called automatically if they * exist. * * If $task == 'default' we will determine the CRUD task to use based on the view name and HTTP verb in the request, * overriding the routing. * * @param string $task The task to execute, e.g. "browse" * * @return null|bool False on execution failure * * @throws TaskNotFound When the task is not found */ public function execute($task) { if ($task == 'default') { $task = $this->getCrudTask(); } return parent::execute($task); }
public function execute($task) { $task = 'main'; $this->layout = 'latest'; return parent::execute($task); }
/** * Determines the task from the layout and view format * * @param string $task The task to execute * * @return void */ public function execute($task) { $document = JFactory::getDocument(); $viewType = $document->getType(); $task = $this->input->getCmd('task', ''); $layout = $this->input->getCmd('layout', ''); $id = $this->input->getInt('id', null); // Check for menu items bearing layout instead of task if (empty($task) || $task == 'main' && !empty($layout)) { $task = $layout; } // Check for default task if (empty($task) || $task == 'read' || $task == 'add') { if ($viewType == 'xml') { $task = 'all'; } elseif ($viewType == 'ini' && empty($id)) { throw new \RuntimeException(\JText::_('ARS_ERR_NOUPDATESOURCE'), 500); } elseif ($viewType == 'ini') { $task = 'ini'; } elseif ($viewType == 'raw' && empty($id)) { throw new \RuntimeException(\JText::_('ARS_ERR_NOUPDATESOURCE'), 500); } elseif ($viewType == 'raw') { $task = 'download'; } else { $task = 'ini'; } } switch ($task) { case 'ini': $viewType = 'ini'; break; case 'download': $viewType = 'raw'; break; default: $viewType = 'xml'; break; } switch ($viewType) { default: case 'xml': switch ($task) { default: case 'all': $task = 'all'; break; case 'category': $task = 'category'; break; case 'stream': $task = 'stream'; break; } break; case 'ini': $task = 'ini'; break; case 'raw': $task = 'download'; break; } parent::execute($task); }