コード例 #1
0
 /**
  * Construct the ORDER BY clause.
  *
  * We override this to ensure that XP set to null appears at the bottom, not the top.
  *
  * @param array $cols The columns.
  * @param array $textsortcols The text columns.
  * @return string
  */
 public static function construct_order_by($cols, $textsortcols = array())
 {
     $newcols = array();
     // We use a foreach to maintain the order in which the fields were defined.
     foreach ($cols as $field => $sortorder) {
         if ($field == 'xp') {
             $field = 'COALESCE(xp, 0)';
         }
         $newcols[$field] = $sortorder;
     }
     return parent::construct_order_by($newcols, $textsortcols);
 }