function display($cachable = false, $urlparams = array()) { $mainframe = JFactory::getApplication(); $option = JRequest::getCmd('option'); $db = JFactory::getDBO(); $filter_order = $mainframe->getUserStateFromRequest("{$option}.filter_order", 'filter_order', 'a.id', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest("{$option}.filter_order_Dir", 'filter_order_Dir', '', 'word'); $filter_state = $mainframe->getUserStateFromRequest("{$option}.filter_state", 'filter_state', '', 'word'); $search = $mainframe->getUserStateFromRequest("{$option}.search", 'search', '', 'string'); $search = JString::strtolower($search); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int'); $where = array(); $orderby = ""; if ($search) { $where[] = 'LOWER(a.name) LIKE "' . $db->escape('%' . $search . '%') . '"'; } if ($filter_state) { if ($filter_state == 'P') { $where[] = 'a.published = 1'; } else { if ($filter_state == 'U') { $where[] = 'a.published = 0'; } } } $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : ''; if ($filter_order == 'a.id') { $orderby = ' ORDER BY id'; } else { if ($filter_order == 'a.name' or $filter_order == 'a.published' or $filter_order == 'a.ordering' or $filter_order == 'a.archiv') { $orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir . ', a.id'; } else { $filter_order = 'a.id'; } } // get the total number of records $query = 'SELECT COUNT(*) ' . ' FROM #__clm_saison AS a' . $where; $db->setQuery($query); $total = $db->loadResult(); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); // get the subset (based on limits) of required records $query = 'SELECT a.*,u.name AS editor ' . ' FROM #__clm_saison AS a' . ' LEFT JOIN #__users AS u ON u.id = a.checked_out' . $where . $orderby; $db->setQuery($query, $pageNav->limitstart, $pageNav->limit); $rows = $db->loadObjectList(); if ($db->getErrorNum()) { echo $db->stderr(); return false; } // aktive Saisons zählen $query = ' SELECT COUNT(id) as id FROM #__clm_saison ' . ' WHERE archiv = 0 AND published = 1'; $db->setQuery($query); $counter = $db->loadResult(); if ($counter > 1) { if ($counter > 2) { $s = "s"; } else { $s = ""; } JError::raiseNotice(6000, JText::_('SAISON_GIBT') . ' ' . $counter . ' ' . JText::_('SAISON_AKTIVE') . ' ' . ($counter - 1) . ' ' . JText::_('SAISON') . ' ' . $s . ' ' . JText::_('SAISON_ZURUECK')); } // state filter $lists['state'] = JHtml::_('grid.state', $filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; require_once JPATH_COMPONENT . DS . 'views' . DS . 'saisons.php'; CLMViewSaisons::saisons($rows, $lists, $pageNav, $option); }