public function display($tpl = null) { $app = JFactory::getApplication(); $jinput = $app->input; $option = $jinput->getCmd('option'); $uri = JFactory::getURI(); $lists = array(); $filter_order = $app->getUserStateFromRequest($this->get('context') . '.filter_order', 'filter_order', 's.ordering', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($this->get('context') . '.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_state = $app->getUserStateFromRequest($this->get('context') . '.filter_state', 'filter_state', 'P', 'word'); $search = $app->getUserStateFromRequest($this->get('context') . '.search', 'search', '', 'string'); $search = JString::strtolower($search); $items = $this->get('Data'); $total = $this->get('Total'); $pagination = $this->get('Pagination'); // state filter $lists['state'] = JoomleagueHelper::stateOptions($filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; $this->user = JFactory::getUser(); $this->lists = $lists; $this->items = $items; $this->pagination = $pagination; $this->request_url = $uri->toString(); $this->addToolbar(); parent::display($tpl); }
public function display($tpl = null) { $option = JRequest::getCmd('option'); $app = JFactory::getApplication(); $uri = JFactory::getURI(); $lists = array(); $filter_league = $app->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_league', 'filter_league', '', 'int'); $filter_sports_type = $app->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_sports_type', 'filter_sports_type', '', 'int'); $filter_season = $app->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_season', 'filter_season', '', 'int'); $filter_state = $app->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_state', 'filter_state', 'P', 'word'); $filter_order = $app->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_order', 'filter_order', 'p.ordering', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $app->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.search', 'search', '', 'string'); $search = JString::strtolower($search); // Get data from the model $items = $this->get('Data'); $total = $this->get('Total'); $pagination = $this->get('Pagination'); $javascript = "onchange=\"\$('adminForm').submit();\""; // state filter // @todo check // 24-07-2015 // Replaced grid.state by the code below so it's possible to add a class to it. $lists['state'] = JoomleagueHelper::stateOptions($filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; //build the html select list for leagues $leagues[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_ADMIN_PROJECTS_LEAGUES_FILTER'), 'id', 'name'); $mdlLeagues = JModelLegacy::getInstance('Leagues', 'JoomleagueModel'); $allLeagues = $mdlLeagues->getLeagues(); $leagues = array_merge($leagues, $allLeagues); $lists['leagues'] = JHtml::_('select.genericList', $leagues, 'filter_league', 'class="input-medium" onChange="this.form.submit();"', 'id', 'name', $filter_league); unset($leagues); //build the html select list for sportstypes $sportstypes[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_ADMIN_PROJECTS_SPORTSTYPE_FILTER'), 'id', 'name'); $mdlSportsTypes = JModelLegacy::getInstance('SportsTypes', 'JoomleagueModel'); $allSportstypes = $mdlSportsTypes->getSportsTypes(); $sportstypes = array_merge($sportstypes, $allSportstypes); $lists['sportstypes'] = JHtml::_('select.genericList', $sportstypes, 'filter_sports_type', 'class="input-medium" onChange="this.form.submit();"', 'id', 'name', $filter_sports_type); unset($sportstypes); //build the html select list for seasons $seasons[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_ADMIN_PROJECTS_SEASON_FILTER'), 'id', 'name'); if ($res = $this->get('Seasons')) { $seasons = array_merge($seasons, $res); } $lists['seasons'] = JHtml::_('select.genericList', $seasons, 'filter_season', 'class="input-medium" onChange="this.form.submit();"', 'id', 'name', $filter_season); unset($seasons); $user = JFactory::getUser(); $this->user = $user; $this->lists = $lists; $this->items = $items; $this->pagination = $pagination; $url = $uri->toString(); $this->request_url = $url; $this->addToolbar(); parent::display($tpl); }
public function display($tpl = null) { $app = JFactory::getApplication(); $jinput = $app->input; $option = $jinput->getCmd('option'); $uri = JFactory::getURI(); $model = $this->getModel(); $filter_sports_type = $app->getUserStateFromRequest($this->get('context') . '.filter_sports_type', 'filter_sports_type', '', 'int'); $filter_state = $app->getUserStateFromRequest($this->get('context') . '.filter_state', 'filter_state', '', 'word'); $filter_order = $app->getUserStateFromRequest($this->get('context') . '.filter_order', 'filter_order', 'po.ordering', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($this->get('context') . '.filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $app->getUserStateFromRequest($this->get('context') . '.search', 'search', '', 'string'); $search = JString::strtolower($search); $items = $this->get('Data'); $total = $this->get('Total'); $pagination = $this->get('Pagination'); // state filter $lists['state'] = JoomleagueHelper::stateOptions($filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; // build the html options for parent position $parent_id[] = JHtml::_('select.option', '', JText::_('COM_JOOMLEAGUE_ADMIN_POSITIONS_IS_P_POSITION')); if ($res = $model->getParentsPositions()) { foreach ($res as $re) { $re->text = JText::_($re->text); } $parent_id = array_merge($parent_id, $res); } $lists['parent_id'] = $parent_id; unset($parent_id); // build the html select list for sportstypes $sportstypes[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_ADMIN_POSITIONS_SPORTSTYPE_FILTER'), 'id', 'name'); $allSportstypes = JoomleagueModelSportsTypes::getSportsTypes(); $sportstypes = array_merge($sportstypes, $allSportstypes); $lists['sportstypes'] = JHtml::_('select.genericList', $sportstypes, 'filter_sports_type', 'class="input-medium" onChange="this.form.submit();"', 'id', 'name', $filter_sports_type); unset($sportstypes); $this->user = JFactory::getUser(); $this->config = JFactory::getConfig(); $this->lists = $lists; $this->items = $items; $this->pagination = $pagination; $this->request_url = $uri->toString(); $this->addToolbar(); parent::display($tpl); }