+// {{{ class UFC_SchoolId
+/** Filters users based on their shoold identifier
+ * @param type Parameter type (Xorg, AX, School)
+ * @param value School id value
+ */
+class UFC_SchoolId implements UserFilterCondition
+{
+ const AX = 'ax';
+ const Xorg = 'xorg';
+ const School = 'school';
+
+ private $type;
+ private $id;
+
+ static public function assertType($type)
+ {
+ if ($type != self::AX && $type != self::Xorg && $type != self::School) {
+ Platal::page()->killError("Type de matricule invalide: $type");
+ }
+ }
+
+ public function __construct($type, $id)
+ {
+ $this->type = $type;
+ $this->id = $id;
+ self::assertType($type);
+ }
+
+ public function buildCondition(PlFilter &$uf)
+ {
+ $uf->requireProfiles();
+ $id = $this->id;
+ $type = $this->type;
+ if ($type == self::School) {
+ $type = self::Xorg;
+ $id = Profile::getXorgId($id);
+ }
+ return XDB::format('p.' . $type . '_id = {?}', $id);
+ }
+}
+// }}}
+
+// {{{ class UFC_EducationSchool
+/** Filters users by formation
+ * @param $val The formation to search (either ID or array of IDs)
+ */
+class UFC_EducationSchool implements UserFilterCondition
+{
+ private $val;
+
+ public function __construct()
+ {
+ $this->val = pl_flatten(func_get_args());
+ }
+
+ public function buildCondition(PlFilter &$uf)
+ {
+ $sub = $uf->addEducationFilter();
+ return XDB::format('pe' . $sub . '.eduid IN {?}', $this->val);
+ }
+}
+// }}}
+
+// {{{ class UFC_EducationDegree
+class UFC_EducationDegree implements UserFilterCondition
+{
+ private $diploma;
+
+ public function __construct()
+ {
+ $this->diploma = pl_flatten(func_get_args());
+ }
+
+ public function buildCondition(PlFilter &$uf)
+ {
+ $sub = $uf->addEducationFilter();
+ return XDB::format('pe' . $sub . '.degreeid IN {?}', $this->diploma);
+ }
+}
+// }}}
+
+// {{{ class UFC_EducationField
+class UFC_EducationField implements UserFilterCondition
+{
+ private $val;
+
+ public function __construct()
+ {
+ $this->val = pl_flatten(func_get_args());
+ }
+
+ public function buildCondition(PlFilter &$uf)
+ {
+ $sub = $uf->addEducationFilter();
+ return XDB::format('pe' . $sub . '.fieldid IN {?}', $this->val);
+ }
+}
+// }}}
+