* CONDITIONS
******************/
+// {{{ interface UserFilterCondition
interface UserFilterCondition
{
const COND_TRUE = 'TRUE';
*/
public function buildCondition(UserFilter &$uf);
}
+// }}}
+// {{{ class UFC_OneChild
abstract class UFC_OneChild implements UserFilterCondition
{
protected $child;
$this->child =& $cond;
}
}
+// }}}
+// {{{ class UFC_NChildren
abstract class UFC_NChildren implements UserFilterCondition
{
protected $children = array();
}
}
}
+// }}}
+// {{{ class UFC_True
class UFC_True implements UserFilterCondition
{
public function buildCondition(UserFilter &$uf)
return self::COND_TRUE;
}
}
+// }}}
+// {{{ class UFC_False
class UFC_False implements UserFilterCondition
{
public function buildCondition(UserFilter &$uf)
return self::COND_FALSE;
}
}
+// }}}
+// {{{ class UFC_Not
class UFC_Not extends UFC_OneChild
{
public function buildCondition(UserFilter &$uf)
}
}
}
+// }}}
+// {{{ class UFC_And
class UFC_And extends UFC_NChildren
{
public function buildCondition(UserFilter &$uf)
}
}
}
+// }}}
+// {{{ class UFC_Or
class UFC_Or extends UFC_NChildren
{
public function buildCondition(UserFilter &$uf)
}
}
}
+// }}}
+// {{{ class UFC_Profile
/** Filters users who have a profile
*/
class UFC_Profile implements UserFilterCondition
return '$PID IS NOT NULL';
}
}
+// }}}
+// {{{ class UFC_Promo
/** Filters users based on promo
* @param $comparison Comparison operator (>, =, ...)
* @param $grade Formation on which to restrict, UserFilter::DISPLAY for "any formation"
}
}
}
+// }}}
+// {{{ class UFC_Name
/** Filters users based on name
* @param $type Type of name field on which filtering is done (firstname, lastname, ...)
* @param $text Text on which to filter
return implode(' OR ', $conds);
}
}
+// }}}
+// {{{ class UFC_Dead
/** Filters users based on death date
* @param $comparison Comparison operator
* @param $date Date to which death date should be compared
return $str;
}
}
+// }}}
+// {{{ class UFC_Registered
/** Filters users based on registration state
* @param $active Whether we want to use only "active" users (i.e with a valid redirection)
* @param $comparison Comparison operator
return $date;
}
}
+// }}}
+// {{{ class UFC_ProfileUpdated
/** Filters users based on profile update date
* @param $comparison Comparison operator
* @param $date Date to which profile update date must be compared
return 'p.last_change ' . $this->comparison . XDB::format(' {?}', date('Y-m-d H:i:s', $this->date));
}
}
+// }}}
+// {{{ class UFC_Birthday
/** Filters users based on next birthday date
* @param $comparison Comparison operator
* @param $date Date to which users next birthday date should be compared
return 'p.next_birthday ' . $this->comparison . XDB::format(' {?}', date('Y-m-d', $this->date));
}
}
+// }}}
+// {{{ class UFC_Sex
/** Filters users based on sex
* @parm $sex One of User::GENDER_MALE or User::GENDER_FEMALE, for selecting users
*/
}
}
}
+// }}}
+// {{{ class UFC_Group
/** Filters users based on group membership
* @param $group Group whose member we are selecting
* @param $admin Whether to restrict selection to admins of that group
return $where;
}
}
+// }}}
+// {{{ class UFC_Email
/** Filters users based on email address
* @param $email Email whose owner we are looking for
*/
}
}
}
+// }}}
+// {{{ class UFC_EmailList
/** Filters users base on an email list
* @param $emails List of emails whose owner must be selected
*/
return '(' . implode(') OR (', $cond) . ')';
}
}
+// }}}
+// {{{ class UFC_Address
/** Filters users based on their address
* @param $field Field of the address used for filtering (city, street, ...)
* @param $text Text for filter
return $cond;
}
}
+// }}}
+// {{{ class UFC_Corps
/** Filters users based on the corps they belong to
* @param $corps Corps we are looking for (abbreviation)
* @param $type Whether we search for original or current corps
return $cond;
}
}
+// }}}
+// {{{ class UFC_Corps_Rank
/** Filters users based on their rank in the corps
* @param $rank Rank we are looking for (abbreviation)
*/
return $cond;
}
}
+// }}}
+// {{{ class UFC_UserRelated
/** Filters users based on a relation toward on user
* @param $user User to which searched users are related
*/
$this->user =& $user;
}
}
+// }}}
+// {{{ class UFC_Contact
/** Filters users who belongs to selected user's contacts
*/
class UFC_Contact extends UFC_UserRelated
return 'c' . $sub . '.contact IS NOT NULL';
}
}
+// }}}
+// {{{ class UFC_WatchRegistration
/** Filters users being watched by selected user
*/
class UFC_WatchRegistration extends UFC_UserRelated
}
}
}
+// }}}
+// {{{ class UFC_WatchPromo
/** Filters users belonging to a promo watched by selected user
* @param $user Selected user (the one watching promo)
* @param $grade Formation the user is watching
}
}
}
+// }}}
+// {{{ class UFC_WatchContact
/** Filters users watched by selected user
*/
class UFC_WatchContact extends UFC_Contact
return parent::buildCondition($uf);
}
}
+// }}}
/******************
* ORDERS
******************/
+// {{{ class UserFilterOrder
abstract class UserFilterOrder
{
protected $desc = false;
abstract protected function getSortTokens(UserFilter &$uf);
}
+// }}}
+// {{{ class UFO_Promo
/** Orders users by promo
* @param $grade Formation whose promo users should be sorted by (restricts results to users of that formation)
* @param $desc Whether sort is descending
}
}
}
+// }}}
+// {{{ class UFO_Name
/** Sorts users by name
* @param $type Type of name on which to sort (firstname, ...)
* @param $variant Variant of that name to user (marital, ordinary, ...)
}
}
}
+// }}}
+// {{{ class UFO_Registration
/** Sorts users based on registration date
*/
class UFO_Registration extends UserFilterOrder
return 'a.registration_date';
}
}
+// }}}
+// {{{ class UFO_Birthday
/** Sorts users based on next birthday date
*/
class UFO_Birthday extends UserFilterOrder
return 'p.next_birthday';
}
}
+// }}}
+// {{{ class UFO_ProfileUpdate
/** Sorts users based on last profile update
*/
class UFO_ProfileUpdate extends UserFilterOrder
return 'p.last_change';
}
}
+// }}}
+// {{{ class UFO_Death
/** Sorts users based on death date
*/
class UFO_Death extends UserFilterOrder
return 'p.deathdate';
}
}
+// }}}
/***********************************
*********************************
***********************************/
+// {{{ class UserFilter
class UserFilter
{
static private $joinMethods = array();
return $joins;
}
}
-
+// }}}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>