private $flags;
private $soundex;
private $exact;
+ private $general_type;
- public function __construct($tokens, $flags = array(), $soundex = false, $exact = false)
+ public function __construct($tokens, $flags = array(), $soundex = false, $exact = false, $general_type = '')
{
if (is_array($tokens)) {
$this->tokens = $tokens;
}
$this->soundex = $soundex;
$this->exact = $exact;
+ $this->general_type = $general_type;
}
public function buildCondition(PlFilter $uf)
if ($this->flags != null) {
$c .= XDB::format(' AND ' . $sub . '.flags IN {?}', $this->flags);
}
+ if ($this->general_type) {
+ $c .= XDB::format(' AND ' . $sub . '.general_type = {?}', $this->general_type);
+ }
$conds[] = $c;
}
}
}
// }}}
+// {{{ class UFC_GroupFormerMember
+/** Filters users based on group former membership
+ * @param $group Group whose former members we are selecting
+ */
+class UFC_GroupFormerMember extends UserFilterCondition
+{
+ private $group;
+
+ public function __construct($group)
+ {
+ $this->group = $group;
+ }
+
+ public function buildCondition(PlFilter $uf)
+ {
+ // Groups are only visible for users with perm 'groups'.
+ if (!S::user()->checkPerms(User::PERM_GROUPS)) {
+ return self::COND_FALSE;
+ }
+ $sub = $uf->addGroupFormerMemberFilter();
+ return XDB::format('gpfm' . $sub . '.asso_id = {?}', $this->group);
+ }
+}
+// }}}
// {{{ class UFC_Binet
/** Selects users based on their belonging to a given (list of) binet
* @param $binet either a binet_id or an array of binet_ids
if (count($foreign) > 0) {
$sub = $uf->addEmailRedirectFilter($foreign);
- $cond[] = XDB::format('ra' . $sub . '.redirect IS NOT NULL OR ra' . $sub . '.redirect IN {?}', $foreign);
+ $cond[] = XDB::format('ra' . $sub . '.redirect IS NOT NULL OR ra' . $sub . '.redirect IN {?} OR a.email IN {?}', $foreign, $foreign);
}
if (count($local) > 0) {
$sub = $uf->addAliasFilter($local);
const ORIGIN = 2;
private $corps;
+ private $id;
private $type;
- public function __construct($corps, $type = self::CURRENT)
+ public function __construct($corps, $id = null, $type = self::CURRENT)
{
$this->corps = $corps;
+ $this->id = $id;
$this->type = $type;
}
* pcec for profile_corps_enum - current
*/
$sub = $uf->addCorpsFilter($this->type);
- $cond = $sub . '.abbreviation = ' . $corps;
- $cond .= ' AND ' . $uf->getVisibilityCondition($sub . '.corps_pub');
+ if (is_null($this->id)) {
+ $cond = $sub . '.abbreviation = ' . $this->corps;
+ } else {
+ $cond = $sub . '.id = ' . $this->id;
+ }
+ // XXX(x2006barrois): find a way to get rid of that hardcoded
+ // reference to 'pc'.
+ $cond .= ' AND ' . $uf->getVisibilityCondition('pc.corps_pub');
return $cond;
}
}
class UFC_Corps_Rank extends UserFilterCondition
{
private $rank;
- public function __construct($rank)
+ private $id;
+
+ public function __construct($rank, $id = null)
{
$this->rank = $rank;
+ $this->id = $id;
}
public function buildCondition(PlFilter $uf)
* pcr for profile_corps_rank
*/
$sub = $uf->addCorpsRankFilter();
- $cond = $sub . '.abbreviation = ' . $rank;
+ if (is_null($this->id)) {
+ $cond = $sub . '.abbreviation = ' . $this->rank;
+ } else {
+ $cond = $sub . '.id = ' . $this->id;
+ }
// XXX(x2006barrois): find a way to get rid of that hardcoded
// reference to 'pc'.
$cond .= ' AND ' . $uf->getVisibilityCondition('pc.corps_pub');
{
$phone = new Phone(array('display' => $number));
$phone->format();
- $this->number = $phone->search();
+ $this->number = $phone->search;
$this->num_type = $num_type;
$this->phone_type = $phone_type;
}
}
}
// }}}
+// {{{ class UFC_DeltaTen
+class UFC_DeltaTen extends UserFilterCondition
+{
+ public function buildCondition(PlFilter $uf)
+ {
+ $sub = $uf->addDeltaTenFilter(UserFilter::DELTATEN);
+ return $sub . '.message IS NOT NULL';
+ }
+}
+// }}}
+// {{{ class UFC_DeltaTen_Message
+/** Filters users by deltaten message
+ * @param $message Message for the DeltaTen program
+ */
+class UFC_DeltaTen_Message extends UserFilterCondition
+{
+ private $message;
+
+ public function __construct($message)
+ {
+ $this->message = $message;
+ }
+
+ public function buildCondition(PlFilter $uf)
+ {
+ $sub = $uf->addDeltaTenFilter(UserFilter::DELTATEN_MESSAGE);
+ return $sub . '.message ' . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->message);
+ }
+}
+// }}}
// {{{ class UFC_Contact
/** Filters users who belong to selected user's contacts
*/