Add UFC_Hruids
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Thu, 4 Feb 2010 00:44:08 +0000 (01:44 +0100)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Sat, 13 Feb 2010 23:33:58 +0000 (00:33 +0100)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
classes/userfilter.php

index 999d650..c2442f0 100644 (file)
@@ -51,6 +51,31 @@ class UFC_Profile implements UserFilterCondition
 }
 // }}}
 
+// {{{ class UFC_Hruid
+/** Filters users based on their hruid
+ * @param $val Either an hruid, or a list of those
+ */
+class UFC_Hruid implements UserFilterCondition
+{
+    private $hruids;
+
+    public function __construct($val)
+    {
+        if (!is_array($val)) {
+            $val = array($val);
+        }
+        $this->hruids = $val;
+    }
+
+    public function buildCondition(PlFilter &$uf)
+    {
+        $ufc->requireAccounts();
+
+        return 'a.hruid IN ' . XDB::formatArray($this->hruids);
+    }
+}
+// }}}
+
 // {{{ class UFC_Comment
 class UFC_Comment implements UserFilterCondition
 {