/**
  * @return	JDatabaseQuery
  */
 function getListQuery()
 {
     // Set the blog ordering
     $params = $this->state->params;
     $articleOrderby = $params->get('orderby_sec', 'rdate');
     $articleOrderDate = $params->get('order_date');
     $categoryOrderby = $params->def('orderby_pri', '');
     $secondary = TZ_Portfolio_PlusHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', ';
     $primary = TZ_Portfolio_PlusHelperQuery::orderbyPrimary($categoryOrderby);
     $orderby = $primary . ' ' . $secondary . ' a.created DESC ';
     $this->setState('list.ordering', $orderby);
     $this->setState('list.direction', '');
     // Create a new query object.
     $query = parent::getListQuery();
     // Filter by frontpage.
     if ($this->getState('filter.frontpage')) {
         $query->join('INNER', '#__tz_portfolio_plus_content_featured_map AS fp ON fp.content_id = a.id');
     }
     // Filter by categories
     if (is_array($featuredCategories = $this->getState('filter.frontpage.categories'))) {
         $featuredCategories = array_filter($featuredCategories);
         $query->where(' a.catid IN (' . implode(',', $featuredCategories) . ')');
     }
     return $query;
 }
Beispiel #2
0
 protected function _buildContentOrderBy()
 {
     $app = JFactory::getApplication('site');
     $db = $this->getDbo();
     $params = $this->state->params;
     $itemid = $app->input->getInt('id', 0) . ':' . $app->input->getInt('Itemid', 0);
     $orderCol = $app->getUserStateFromRequest('com_tz_portfolio_plus.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string');
     $orderDirn = $app->getUserStateFromRequest('com_tz_portfolio_plus.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd');
     $orderby = ' ';
     if (!in_array($orderCol, $this->filter_fields)) {
         $orderCol = null;
     }
     if (!in_array(strtoupper($orderDirn), array('ASC', 'DESC', ''))) {
         $orderDirn = 'ASC';
     }
     if ($orderCol && $orderDirn) {
         $orderby .= $db->escape($orderCol) . ' ' . $db->escape($orderDirn) . ', ';
     }
     $articleOrderby = $params->get('orderby_sec', 'rdate');
     $articleOrderDate = $params->get('order_date');
     $categoryOrderby = $params->def('orderby_pri', '');
     $secondary = TZ_Portfolio_PlusHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', ';
     $primary = TZ_Portfolio_PlusHelperQuery::orderbyPrimary($categoryOrderby);
     $orderby .= $db->escape($primary) . ' ' . $db->escape($secondary) . ' a.created ';
     return $orderby;
 }