if ($this->sex != User::GENDER_MALE && $this->sex != User::GENDER_FEMALE) {
return self::COND_FALSE;
} else {
- return XDB::format('p.sex = {?}', $this->sex);
+ return XDB::format('p.sex = {?}', $this->sex == User::GENDER_FEMALE ? 'female' : 'male');
}
}
}
class UserFilter
{
private $root;
+ private $sort = array();
private $query = null;
+ private $orderby = null;
- public function __construct($cond = null)
+ public function __construct($cond = null, $sort = null)
{
if (!is_null($cond)) {
if ($cond instanceof UserFilterCondition) {
$this->setCondition($cond);
}
}
+ if (!is_null($sort)) {
+ if ($sort instanceof UserFilterOrder) {
+ $this->addSort($sort);
+ }
+ }
}
private function buildQuery()
' . $joins . '
WHERE (' . $where . ')';
}
+ if (is_null($this->sortby)) {
+ $this->sortby = '';
+ }
}
private function formatJoin(array $joins)
$this->query = null;
}
+ public function addSort(UserFilterOrder &$sort)
+ {
+ $this->sort[] =& $sort;
+ $this->sortby = null;
+ }
+
static public function getLegacy($promo_min, $promo_max)
{
if ($promo_min != 0) {