Exemplo n.º 1
0
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     $state = $this->_state;
     $direction = strtoupper($this->_state->direction);
     $element = $this->getService('com://admin/cck.model.elements')->slug(str_replace('_', '-', $state->sort))->getItem();
     if ($state->sort) {
         $query->order('cck.cck_element_id = ' . $element->id, null);
         $query->order('cck.value', $direction);
     }
 }
Exemplo n.º 2
0
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     $sort = $this->_state->sort;
     $direction = strtoupper($this->_state->direction);
     if ($sort) {
         $query->order($this->getTable()->mapColumns($sort), $direction);
     }
     if (array_key_exists('ordering', $this->getTable()->getColumns())) {
         $query->order('category.title, tbl.ordering', 'ASC');
     }
 }
Exemplo n.º 3
0
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     //We need to write a proper sort function first.
     //$query->order('tbl.lft', 'ASC');
     $query->order('path_ordering', 'ASC');
     $order = $this->_state->order;
     $direction = strtoupper($this->_state->direction);
     if ($order) {
         $query->order($order, $direction);
     }
 }
Exemplo n.º 4
0
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     if ($this->_state->distinct && !empty($this->_state->column)) {
         $query->order('package', 'asc');
     } else {
         parent::_buildQueryOrder($query);
     }
 }
Exemplo n.º 5
0
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     $state = $this->_state;
     $direction = strtoupper($state->direction);
     if (is_bool($state->featured) && $state->featured == true) {
         if ($this->_state->sort == 'ordering') {
             $query->order('featured_ordering', $direction);
         } else {
             $query->order($this->_state->sort, $direction)->order('featured_ordering', 'ASC');
         }
     } else {
         if ($this->_state->sort == 'ordering') {
             $query->order('section_title', 'ASC')->order('category_title', 'ASC')->order('ordering', $direction);
         } else {
             $query->order($this->_state->sort, $direction)->order('section_title', 'ASC')->order('category_title', 'ASC')->order('ordering', 'ASC');
         }
     }
 }
Exemplo n.º 6
0
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     // Assemble the clause pieces
     $order = $this->getState('order', 'tbl.table_name');
     $direction = strtoupper($this->getState('direction', 'ASC'));
     // Assemble the clause
     switch ($order) {
         case 'table_name':
             $query->order('tbl.table_name', $direction);
             $query->order('tbl.row_id', $direction);
             $query->order('tbl.original', 'DESC');
             break;
         default:
             if ($order) {
                 $query->order($order, $direction);
             }
             break;
     }
 }
Exemplo n.º 7
0
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     $sort = $this->_state->sort ? $this->_state->sort : 'category';
     $direction = strtoupper($this->_state->direction);
     switch ($sort) {
         case 'random':
             $query->order('RAND()', 'ASC');
             break;
         case '0':
             $query->order('tbl.sticky', 'DESC');
             $query->order('tbl.ordering', 'ASC');
             break;
         case 'category':
             $query->order('category', $direction);
             $query->order('tbl.ordering', 'ASC');
             break;
         default:
             $query->order($this->getTable()->mapColumns($sort), $direction);
     }
 }
Exemplo n.º 8
0
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     $query->order('reference', 'ASC');
 }
Exemplo n.º 9
0
 /**
  * Builds a generic ORDER BY clasue based on the model's state
  */
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     $order = $this->getState('order');
     $direction = strtoupper($this->getState('direction'));
     if ($order) {
         $query->order($order, $direction);
     }
     if (in_array('ordering', $this->getTable()->getColumns())) {
         $query->order('ordering', 'ASC');
     }
 }
Exemplo n.º 10
0
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     $query->order('tbl.name', 'ASC');
 }
Exemplo n.º 11
0
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     $query->order('tbl.revision', 'desc');
 }
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     $sort = $this->_state->sort;
     $direction = strtoupper($this->_state->direction);
     if ($sort) {
         $column = $this->getTable()->mapColumns($sort);
         if (array_key_exists($column, $this->getTable()->getColumns())) {
             $query->order($column, $direction);
         }
     }
 }
Exemplo n.º 13
0
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     $query->order('tbl.created', 'DESC');
 }
Exemplo n.º 14
0
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
 	if(!$this->_state->isUnique()) {
         $query->order('tbl.lft', 'ASC');
 	}
 }
Exemplo n.º 15
0
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     $sort = $this->_state->sort;
     $direction = strtoupper($this->_state->direction);
     if (!$sort) {
         //@TODO we no longer need this CONCAT part
         //$query->select("CONCAT(tbl.path, tbl.ninjaboard_forum_id, '/') AS path_ordering");
         $query->order('path_sort', 'asc');
     } elseif ($sort) {
         //Our model don't support DESC yet
         //$query->order($sort, $direction);
         $query->order($sort, 'asc');
     }
 }
Exemplo n.º 16
0
    protected function _buildQueryOrder(KDatabaseQuery $query)
    {
        $sort = $this->_state->sort;
        $direction  = strtoupper($this->_state->direction);

	    if ( $sort) {
            $query->order($this->getTable()->mapColumns($sort), $direction);
        }

        if (empty($sort))
        {
            if ($this->_state->section == 'com_content'){
                $query->order('sections.ordering','ASC');
            }
        }

	    $query->order('ordering', 'ASC');
    }
Exemplo n.º 17
0
 /**
  * @param KDatabaseQuery $query
  */
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     $sort = 'path';
     $direction = 'ASC';
     // If we are fetching the immediate children of a category we can sort however we want
     if ($this->_state->level == 1 && !is_null($this->_state->parent_id) && $this->_state->sort !== 'custom') {
         $sort = $this->_state->sort;
         $direction = $this->_state->direction;
     } elseif ($this->getTable()->hasBehavior('orderable') && in_array($this->_state->sort, array('title', 'created_on', 'custom'))) {
         $sort = 'order_path';
     }
     $query->order($sort, $direction);
 }
Exemplo n.º 18
0
 /**
  * Builds a generic ORDER BY clasue based on the model's state
  */
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     $query->order('tbl.ordering', 'ASC')->order('title', 'ASC');
 }