Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $criteria = new CDbCriteria();
- $criteria->addNotInCondition('name', BasicFunctions::getPremiumPlayerInZone($user->zone));
- $criteria->order = BasicFunctions::sortPlayers('premium');
- $premiumPlayers = StartPremiumPlayers::model()->findAll($criteria);
- ...
- public static function sortPlayers($type = Players::SORT_BY_POSITION, $premium = null)
- {
- switch ($type) {
- case Players::SORT_BY_NUMBER:
- $sort = 't.nomer ASC';
- break;
- default:
- $pos = array(1, 2, 13, 5, 6, 7, 8, 18, 22, 20, 25, 12, 23, 26);
- $pos = implode(', ', $pos);
- $sort = "FIELD(t.pos, {$pos}) ASC, t.name ASC";
- if ($premium) {
- $sort = "FIELD(t.position, {$pos}), name ASC";
- }
- }
- return $sort;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement