コード例 #1
0
ファイル: provider.php プロジェクト: icybee/module-comments
 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
ファイル: page.model.php プロジェクト: icybee/module-pages
 /**
  * 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
ファイル: manage.php プロジェクト: icybee/module-users-logins
 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
ファイル: manage.php プロジェクト: icybee/module-comments
 /**
  * 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
ファイル: manage.php プロジェクト: icybee/module-users
 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
ファイル: CriterionTrait.php プロジェクト: icanboogie/facets
 /**
  * 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'));
 }