public function onBeforeMain($tpl = null) { // Prevent phpStorm's whining... if ($tpl) { } // Load the model /** @var Categories $model */ $model = $this->getModel('Categories'); // Assign data to the view, part 1 (we need this later on) $this->categories = $model->get(true)->filter(function ($item) { return Filter::filterItem($item, true); }); $this->vgroups = Filter::getCategoriesPerVisualGroup($this->categories); /** @var Releases $releasesModel */ $releasesModel = $this->getModel(); $releases = $releasesModel->get(true); $this->releases = []; if ($releases->count()) { /** @var Releases $release */ foreach ($releases as $release) { $this->releases[$release->category_id] = $release; } } // Add RSS links /** @var \JApplicationSite $app */ $app = \JFactory::getApplication(); // Pass page params $this->params = $app->getParams(); $this->cparams = \JComponentHelper::getParams('com_ars'); $this->Itemid = $this->input->getInt('Itemid', 0); $this->menu = $app->getMenu()->getActive(); return true; }
public function onBeforeBrowse($tpl = null) { // Prevent phpStorm's whining... if ($tpl) { } // Load the model /** @var Categories $model */ $model = $this->getModel(); // Assign data to the view, part 1 (we need this later on) $this->items = $model->get(true)->filter(function ($item) { return Filter::filterItem($item, true); }); $visualGroups = Filter::getCategoriesPerVisualGroup($this->items); // Add RSS links /** @var \JApplicationSite $app */ $app = \JFactory::getApplication(); /** @var \JRegistry $params */ $params = $app->getParams('com_ars'); // Get the ordering $this->order = $model->getState('filter_order', 'id', 'cmd'); $this->order_Dir = $model->getState('filter_order_Dir', 'DESC', 'cmd'); // Assign data to the view $this->pagination = new \JPagination($model->count(), $model->limitstart, $model->limit); $this->vgroups = $visualGroups; // Pass page params $this->params = $app->getParams(); $this->Itemid = $this->input->getInt('Itemid', 0); $this->menu = $app->getMenu()->getActive(); return true; }