/**
  * Method to build the query ORDER BY segment
  *
  * @access protected
  * @subpackage Yireo
  * @param null
  * @return string
  */
 protected function buildQueryOrderBy()
 {
     if (YireoHelper::isJoomla15()) {
         $default_ordering = 'ordering';
     } else {
         $default_ordering = 'lft, rgt';
     }
     $orderby = $this->params->get('cat_orderby', $default_ordering);
     if ($orderby == 'alpha') {
         $this->addOrderBy('`category`.`title` ASC');
     } elseif ($orderby == 'ralpha') {
         $this->addOrderBy('`category`.`title` DESC');
     } else {
         if ($orderby == 'ordering') {
             $orderby = $default_ordering;
         }
         $this->addOrderBy('`category`.' . $orderby);
     }
     return parent::buildQueryOrderBy();
 }
Exemple #2
0
 /**
  * Method to build the query ORDER BY segment
  *
  * @access protected
  * @subpackage Yireo
  * @param null
  * @return string
  */
 protected function buildQueryOrderBy()
 {
     $ordering = $this->params->get('orderby');
     switch ($ordering) {
         case 'alpha':
             $orderby = 'item.title ASC';
             break;
         case 'ralpha':
             $orderby = 'item.title DESC';
             break;
         case 'date':
             $orderby = 'item.created DESC, item.modified DESC';
             break;
         case 'rdate':
             $orderby = 'item.created ASC, item.modified ASC';
             break;
         case 'random':
             $orderby = 'RAND()';
             break;
         case 'rorder':
             $orderby = 'item.ordering DESC';
             break;
         default:
             $orderby = 'item.ordering';
             break;
     }
     $this->addOrderby($orderby);
     return parent::buildQueryOrderBy();
 }