예제 #1
0
 protected function alter_query(Query $query, array $conditions)
 {
     if (isset($conditions['nid'])) {
         $query->where('nid = ?', (int) $conditions['nid']);
     }
     $query->where('status != "spam" && status != "pending"');
     return $query->order('created');
 }
예제 #2
0
파일: Model.php 프로젝트: DavBfr/BlogMVC
 protected function scope_ordered(Query $query, $direction = -1)
 {
     return $query->order('created ' . ($direction < 0 ? 'DESC' : 1));
 }
예제 #3
0
 /**
  * Changes the order of the query with "weight, create".
  *
  * @param Query $query
  *
  * @return Query
  */
 protected function scope_ordered(Query $query, $direction = 1)
 {
     $direction = $direction < 0 ? 'DESC' : 'ASC';
     return $query->order("weight {$direction}, created_at {$direction}");
 }
예제 #4
0
 /**
  * Orders the records according to their popularity.
  */
 public function alter_query_with_order(Query $query, $order_direction)
 {
     return $query->order("(SELECT COUNT(vtid) FROM {self}__nodes WHERE vtid = term.vtid) " . ($order_direction < 0 ? 'DESC' : 'ASC'));
 }
예제 #5
0
 public function alter_query_with_order(Query $query, $order_direction)
 {
     return $query->order("(SELECT COUNT(uid) FROM {prefix}users_logins WHERE uid = user.uid) " . ($order_direction < 0 ? 'desc' : 'asc'));
 }
예제 #6
0
 /**
  * Orders the records according to the `author` column.
  */
 public function alter_query_with_order(Query $query, $order_direction)
 {
     return $query->order('`author` ' . ($order_direction < 0 ? 'DESC' : 'ASC'));
 }
예제 #7
0
 public function alter_query_with_order(Query $query, $order_direction)
 {
     $keys = array_keys($this->resolved_user_names);
     if ($order_direction < 0) {
         $keys = array_reverse($keys);
     }
     return $query->order($this->id, $keys);
 }
예제 #8
0
 /**
  * Alters the query with an order.
  *
  * The {@link $column_name} property is used.
  *
  * @param Query $query
  * @param int $order_direction "DESC" if inferior to 0, "ASC" otherwise.
  *
  * @return Query
  */
 public function alter_query_with_order(Query $query, $order_direction)
 {
     return $query->order("`{$this->column_name}` " . ($order_direction < 0 ? 'DESC' : 'ASC'));
 }