Exemplo n.º 1
0
 /**
  * Builds LEFT JOINS clauses for the query.
  *
  * @param   Library\DatabaseQuerySelect  A query object.
  * @return  void
  */
 protected function _buildQueryJoins(Library\DatabaseQuerySelect $query)
 {
     $state = $this->getState();
     $query->join(array('session' => 'users_sessions'), 'tbl.email = session.email', $state->loggedin ? 'RIGHT' : 'LEFT');
     $query->join(array('role' => 'users_roles'), 'role.users_role_id = tbl.users_role_id');
     $query->join(array('group' => 'users_groups_users'), 'group.users_user_id = tbl.users_user_id');
 }
Exemplo n.º 2
0
 protected function _buildQueryGroup(Library\DatabaseQuerySelect $query)
 {
     $state = $this->getState();
     if ($state->distinct) {
         $query->group('tbl.email');
     }
 }
Exemplo n.º 3
0
 protected function _buildQueryOrder(Library\DatabaseQuerySelect $query)
 {
     if ($this->getState()->distinct && !empty($this->getState()->column)) {
         $query->order('package', 'asc');
     } else {
         parent::_buildQueryOrder($query);
     }
 }
Exemplo n.º 4
0
 protected function _buildQueryJoins(Library\DatabaseQuerySelect $query)
 {
     $state = $this->getState();
     // Only include joins when we want to list the categories that are attached to a product
     if ($state->active) {
         $subquery = $this->getObject('lib:database.query.select')->columns(array('products_brand_id', 'products_count' => 'COUNT(DISTINCT products_product_id)'))->table('products_products')->where('published = :published')->bind(array('published' => '1'))->group('products_brand_id');
         $query->join(array('content' => $subquery), 'content.products_brand_id = tbl.products_brand_id');
     }
 }
Exemplo n.º 5
0
 protected function _buildQueryOrder(Library\DatabaseQuerySelect $query)
 {
     if ($this->sort == 'table') {
         $direction = strtoupper($this->direction);
         $query->order('tbl.table', $direction);
         $query->order('tbl.row', $direction);
         $query->order('tbl.original', 'DESC');
     }
 }
Exemplo n.º 6
0
 protected function _buildQueryOrder(Library\DatabaseQuerySelect $query)
 {
     $state = $this->getState();
     $direction = strtoupper($state->direction);
     if ($state->sort == 'ordering') {
         $query->order('category_title', 'ASC')->order('ordering', $direction);
     } else {
         $query->order($state->sort, $direction)->order('category_title', 'ASC')->order('ordering', 'ASC');
     }
 }
Exemplo n.º 7
0
 protected function _buildQueryGroup(Library\DatabaseQuerySelect $query)
 {
     $state = $this->getState();
     if ($state->distinct) {
         $query->distinct();
         $query->group($state->distinct);
     } else {
         $query->group('tbl.categories_category_id');
     }
 }
Exemplo n.º 8
0
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     $state = $this->getState();
     if ($state->search) {
         $query->where('tbl.title LIKE :search')->bind(array('search' => '%' . $state->search . '%'));
     }
     if ($this->getState()->table) {
         $query->where('tbl.table = :table')->bind(array('table' => $this->getState()->table));
     }
     parent::_buildQueryWhere($query);
 }
Exemplo n.º 9
0
 protected function _buildQueryOrder(Library\DatabaseQuerySelect $query)
 {
     $sort = $this->getState()->sort;
     $direction = strtoupper($this->getState()->direction);
     if ($sort) {
         $column = $this->getTable()->mapColumns($sort);
         if (array_key_exists($column, $this->getTable()->getColumns())) {
             $query->order($column, $direction);
         }
     }
 }
Exemplo n.º 10
0
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     if (!$this->getState()->isUnique()) {
         if ($this->getState()->table) {
             $query->where('relations.table = :table')->bind(array('table' => $this->getState()->table));
         }
         if ($this->getState()->row) {
             $query->where('relations.row IN :row')->bind(array('row' => (array) $this->getState()->row));
         }
     }
     parent::_buildQueryWhere($query);
 }
Exemplo n.º 11
0
 protected function _buildQueryJoins(Library\DatabaseQuerySelect $query)
 {
     $query->join(array('group' => 'users_groups'), 'group.users_group_id = tbl.users_group_id');
 }
Exemplo n.º 12
0
 protected function _buildQueryOrder(Library\DatabaseQuerySelect $query)
 {
     $state = $this->getState();
     $direction = strtoupper($state->direction);
     $query->order('section.title', $direction)->order('tbl.title', $direction);
 }
Exemplo n.º 13
0
 /**
  * Builds LEFT JOINS clauses for the query.
  *
  * @param   Library\DatabaseQuerySelect  A query object.
  * @return  void
  */
 protected function _buildQueryJoins(Library\DatabaseQuerySelect $query)
 {
     $state = $this->getState();
     $query->join(array('users' => 'users'), 'tbl.email = users.email');
 }
Exemplo n.º 14
0
 protected function _buildQueryOrder(Library\DatabaseQuerySelect $query)
 {
     $query->order('tbl.revision', 'desc');
 }
Exemplo n.º 15
0
 protected function _buildQueryGroup(Library\DatabaseQuerySelect $query)
 {
     $query->group('tbl.email');
 }