2 /***************************************************************************
3 * Copyright (C) 2003-2010 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
22 require_once 'directory.enums.inc.php';
24 // {{{ class UserFilterBuilder
25 class UserFilterBuilder
29 private $valid = true
;
31 private $orders = array();
34 * @param $fields An array of UFB_Field objects
35 * @param $envprefix Prefix to use for parts of the query
37 public function __construct($fields, $envprefix = '')
39 $this->fields
= $fields;
40 $this->envprefix
= $envprefix;
43 /** Builds the UFC; returns as soon as a field says it is invalid
45 private function buildUFC()
47 if ($this->ufc
!= null
) {
50 $this->ufc
= new PFC_And();
52 foreach ($this->fields
as $field) {
53 $this->valid
= $field->apply(&$this);
60 public function addCond(PlFilterCondition
&$cond)
62 $this->ufc
->addChild($cond);
65 public function addOrder(PlFilterOrder
&$order)
67 $this->order
[] = $order;
70 public function isValid()
76 public function isEmpty()
79 foreach ($this->fields
as $field) {
80 if (! $field->isEmpty()) {
87 /** Returns the built UFC
88 * @return The UFC, or PFC_False() if an error happened
90 public function getUFC()
96 return new PFC_False();
100 /** Returns adequate orders
102 public function getOrders()
105 return $this->orders
;
108 /** Wrappers around Env::i/s/..., to add envprefix
110 public function s($key, $def = '') {
111 return trim(Env
::s($this->envprefix
. $key, $def));
114 public function i($key, $def = 0) {
115 return intval(trim(Env
::i($this->envprefix
. $key, $def)));
118 public function v($key, $def = null
) {
119 return Env
::v($this->envprefix
. $key, $def);
122 public function has($key) {
123 return (Env
::has($this->envprefix
. $key) && strlen($this->s($key, '')) > 0);
126 public function isOn($key) {
127 return (Env
::has($this->envprefix
. $key) && $this->s($key) == 'on');
132 // {{{ class UFB_QuickSearch
133 class UFB_QuickSearch
extends UserFilterBuilder
135 public function __construct($envprefix = '')
138 new UFBF_Quick('quick', 'Recherche rapide'),
140 parent
::__construct($fields, $envprefix);
145 // {{{ class UFB_AdvancedSearch
146 class UFB_AdvancedSearch
extends UserFilterBuilder
148 public function __construct($envprefix = '')
151 new UFBF_Name('name', 'Nom'),
152 new UFBF_Promo('promo1', 'Promotion', 'egal1'),
153 new UFBF_Promo('promo2', 'Promotion', 'egal2'),
154 new UFBF_Sex('woman', 'Sexe'),
155 new UFBF_Registered('subscriber', 'Inscrit'),
156 new UFBF_Dead('alive', 'En vie'),
158 new UFBF_Town('city', 'Ville / Code Postal'),
159 new UFBF_Country('countryTxt', 'country', 'Pays'),
160 new UFBF_AdminArea('region', 'Région'),
162 new UFBF_JobCompany('entreprise', 'Entreprise'),
163 new UFBF_JobSector('sector', 'Poste'),
164 new UFBF_JobDescription('jobdescription', 'Fonction'),
165 new UFBF_JobCv('cv', 'CV'),
167 new UFBF_Nationality('nationaliteTxt', 'nationalite', 'Nationalité'),
168 new UFBF_Binet('binetTxt', 'binet', 'Binet'),
169 new UFBF_Group('groupexTxt', 'groupex', 'Groupe X'),
170 new UFBF_Section('sectionTxt', 'section', 'Section'),
172 new UFBF_EducationSchool('schoolTxt', 'school', "École d'application"),
173 new UFBF_EducationDegree('diplomaTxt', 'diploma', 'Diplôme'),
174 new UFBF_EducationField('fieldTxt', 'field', "Domaine d'études"),
176 new UFBF_Comment('free', 'Commentaire'),
177 new UFBF_Phone('phone_number', 'Téléphone'),
178 new UFBF_Networking('networking_address', 'networking_type', 'Networking et sites webs'),
180 parent
::__construct($fields, $envprefix);
185 // {{{ class UFB_MentorSearch
186 class UFB_MentorSearch
extends UserFilterBuilder
188 public function __construct($envprefix = '')
191 new UFBF_MentorCountry('pays_sel'),
192 new UFBF_MentorSectorization('sector', '', UFC_Mentor_Sectorization
::SECTOR
),
193 new UFBF_MentorSectorization('subSector', '', UFC_Mentor_Sectorization
::SUBSECTOR
),
194 new UFBF_MentorExpertise('expertise'),
196 parent
::__construct($fields, $envprefix);
201 // {{{ class UFB_Field
202 abstract class UFB_Field
207 protected $empty = false
;
208 protected $val = null
;
211 * @param $envfield Name of the field in the environment
212 * @param $formtext User-friendly name of that field
214 public function __construct($envfield, $formtext = '')
216 $this->envfield
= $envfield;
217 if ($formtext != '') {
218 $this->formtext
= $formtext;
220 $formtext = ucfirst($envfield);
224 /** Prints the given error message to the user, and returns false
225 * in order to be used as return $this->raise('ERROR');
227 * All %s in the $msg will be replaced with the formtext.
229 protected function raise($msg)
231 Platal
::page()->trigError(str_replace('%s', $this->formtext
, $msg));
235 public function apply(UserFilterBuilder
&$ufb) {
236 if (!$this->check($ufb)) {
241 $ufc = $this->buildUFC($ufb);
249 public function isEmpty()
254 /** Create the UFC associated to the field; won't be called
255 * if the field is "empty"
256 * @param &$ufb UFB to which fields must be added
259 abstract protected function buildUFC(UserFilterBuilder
&$ufb);
261 /** This function is intended to run consistency checks on the value
262 * @return boolean Whether the input is valid
264 abstract protected function check(UserFilterBuilder
&$ufb);
268 // {{{ class UFBF_Text
269 abstract class UFBF_Text
extends UFB_Field
274 public function __construct($envfield, $formtext = '', $minlength = 2, $maxlength = 255)
276 parent
::__construct($envfield, $formtext);
277 $this->minlength
= $minlength;
278 $this->maxlength
= $maxlength;
281 protected function check(UserFilterBuilder
&$ufb)
283 if (!$ufb->has($this->envfield
)) {
288 $this->val
= $ufb->s($this->envfield
);
289 if (strlen($this->val
) < $this->minlength
) {
290 return $this->raise("Le champ %s est trop court (minimum {$this->minlength}).");
291 } else if (strlen($this->val
) > $this->maxlength
) {
292 return $this->raise("Le champ %s est trop long (maximum {$this->maxlength}).");
293 } else if (preg_match(":[\]\[<>{}~/§_`|%$^=+]|\*\*:u", $this->val
)) {
294 return $this->raise('Le champ %s contient un caractère interdit rendant la recherche impossible.');
302 // {{{ class UFBF_Range
303 /** Subclass to use for fields which only allow integers within a range
305 abstract class UFBF_Range
extends UFB_Field
311 public function __construct($envfield, $formtext = '', $min = 0, $max = 65535)
313 parent
::__construct($envfield, $formtext);
318 protected function check(UserFilterBuilder
&$ufb)
320 if (!$ufb->has($this->envfield
)) {
325 $this->val
= $ufb->i($this->envfield
);
326 if ($this->val
< $this->min
) {
327 return $this->raise("Le champs %s est inférieur au minimum ({$this->min}).");
328 } else if ($this->val
> $this->max
) {
329 return $this->raise("Le champ %s est supérieur au maximum ({$this->max}).");
336 // {{{ class UFBF_Index
337 /** Subclass to use for indexed fields
339 abstract class UFBF_Index
extends UFB_Field
341 protected function check(UserFilterBuilder
&$ufb)
343 if (!$ufb->has($this->envfield
)) {
346 $this->val
= $ufb->i($this->envfield
);
352 // {{{ class UFBF_Enum
353 /** Subclass to use for fields whose value must belong to a specific set of values
355 abstract class UFBF_Enum
extends UFB_Field
357 protected $allowedvalues;
359 public function __construct($envfield, $formtext = '', $allowedvalues = array(), $strict = false
)
361 parent
::__construct($envfield, $formtext);
362 $this->allowedvalues
= $allowedvalues;
363 $this->strict
= $strict;
366 protected function check(UserFilterBuilder
&$ufb)
368 if (!$ufb->has($this->envfield
)) {
373 $this->val
= $ufb->v($this->envfield
);
374 if (! in_array($this->val
, $this->allowedvalues
)) {
376 return $this->raise("La valeur {$this->val} n'est pas valide pour le champ %s.");
386 // {{{ class UFBF_Bool
387 abstract class UFBF_Bool
extends UFB_Field
389 protected function check(UserFilterBuilder
&$ufb)
391 if (!$ufb->has($this->envfield
)) {
396 $this->val
= ($ufb->i($this->envfield
) != 0);
402 // {{{ class UFBF_Mixed
403 /** A class for building UFBFs when the user can input either a text or an ID
405 abstract class UFBF_Mixed
extends UFB_Field
407 /** Name of the DirEnum on which class is based
411 protected $envfieldindex;
413 public function __construct($envfieldtext, $envfieldindex, $formtext = '')
415 parent
::__construct($envfieldtext, $formtext);
416 $this->envfieldindex
= $envfieldindex;
419 protected function check(UserFilterBuilder
&$ufb)
421 if (!$ufb->has($this->envfieldindex
) && !$ufb->has($this->envfield
)) {
426 if ($ufb->has($this->envfieldindex
)) {
427 $index = $ufb->v($this->envfieldindex
);
428 if (is_int($index)) {
429 $index = intval($index);
431 $index = strtoupper($index);
433 $this->val
= array($index);
435 $indexes = DirEnum
::getIDs($this->direnum
, $ufb->s($this->envfield
),
436 $ufb->i('exact') ? XDB
::WILDCARD_EXACT
: XDB
::WILDCARD_CONTAINS
);
437 if (count($indexes) == 0) {
440 $this->val
= $indexes;
447 // {{{ class UFBF_Quick
448 class UFBF_Quick
extends UFB_Field
450 protected function check(UserFilterBuilder
&$ufb)
452 if (!$ufb->has($this->envfield
)) {
457 $this->val
= str_replace('*', '%', replace_accent($ufb->s($this->envfield
)));
462 protected function buildUFC(UserFilterBuilder
&$ufb)
465 $r = $s = $this->val
;
469 if (S
::admin() && strpos($s, '@') !== false
) {
470 return new UFC_Email($s);
471 } else if (S
::admin() && preg_match('/[0-9]+\.([0-9]+|%)\.([0-9]+|%)\.([0-9]+|%)/', $s)) {
472 $this->conds
->addChild(new UFC_Ip($s));
476 $conds = new PFC_And();
480 $s = preg_replace('!\d+!', ' ', $s);
481 $strings = preg_split("![^a-zA-Z%]+!",$s, -1, PREG_SPLIT_NO_EMPTY
);
482 if (count($strings) > 5) {
483 Platal
::page()->trigWarning("Tu as indiqué trop d'éléments dans ta recherche, seuls les 5 premiers seront pris en compte");
484 $strings = array_slice($strings, 0, 5);
487 if (count($strings)) {
491 $flags = array('public');
493 if ($ufb->i('soundex')) {
496 foreach ($strings as $string) {
497 $st[] = soundex_fr($string);
503 if ($ufb->i('exact')) {
508 $conds->addChild(new UFC_NameTokens($st, $flags, $soundex, $exact));
510 $ufb->addOrder(new UFO_Score());
515 $s = preg_replace('! *- *!', '-', $r);
516 $s = preg_replace('!([<>]) *!', ' \1', $s);
517 $s = preg_replace('![^0-9\-><]!', ' ', $s);
518 $s = preg_replace('![<>\-] !', '', $s);
519 $ranges = preg_split('! +!', $s, -1, PREG_SPLIT_NO_EMPTY
);
520 foreach ($ranges as $r) {
521 if (preg_match('!^\d{4}$!', $r)) {
522 $conds->addChild(new UFC_Promo('=', UserFilter
::DISPLAY
, 'X' . $r));
523 } elseif (preg_match('!^(\d{4})-(\d{4})$!', $r, $matches)) {
524 $p1=min(intval($matches[1]), intval($matches[2]));
525 $p2=max(intval($matches[1]), intval($matches[2]));
526 $conds->addChild(new PFC_And(
527 new UFC_Promo('>=', UserFilter
::DISPLAY
, 'X' . $p1),
528 new UFC_Promo('<=', UserFilter
::DISPLAY
, 'X' . $p2)
530 } elseif (preg_match('!^<(\d{4})!', $r, $matches)) {
531 $conds->addChild(new UFC_Promo('<=', UserFilter
::DISPLAY
, 'X' . $matches[1]));
532 } elseif (preg_match('!^>(\d{4})!', $r, $matches)) {
533 $conds->addChild(new UFC_Promo('>=', UserFilter
::DISPLAY
, 'X' . $matches[1]));
539 $t = preg_replace('!(\d{4}-\d{4}|>\d{4}|<\d{4})!', '', $s);
540 $t = preg_replace('![<>\- ]!', '', $t);
541 if (strlen($t) > 4) {
542 $conds->addChild(new UFC_Phone($t));
550 // {{{ class UFBF_Name
551 class UFBF_Name
extends UFBF_Text
553 protected function check(UserFilterBuilder
&$ufb)
555 if (!parent
::check($ufb)) {
559 $this->val
= preg_split('/[[:space:]]/', $this->val
);
560 if (count($this->val
) == 0) {
566 protected function buildUFC(UserFilterBuilder
&$ufb)
568 return new UFC_NameTokens($this->val
, array(), $ufb->i('with_soundex'), $ufb->i('exact'));
573 // {{{ class UFBF_Promo
574 class UFBF_Promo
extends UFB_Field
576 private static $validcomps = array('<', '<=', '=', '>=', '>');
578 private $envfieldcomp;
580 public function __construct($envfield, $fromtext = '', $envfieldcomp)
582 parent
::__construct($envfield, $fromtext);
583 $this->envfieldcomp
= $envfieldcomp;
586 protected function check(UserFilterBuilder
&$ufb)
588 if (!$ufb->has($this->envfield
) ||
!$ufb->has($this->envfieldcomp
)) {
593 $this->val
= $ubf->i($this->envfield
);
594 $this->comp
= $ubf->v($this->envfieldcomp
);
596 if (!in_array($this->comp
, self
::$validcomps)) {
597 return $this->raise("Le critère {$this->comp} n'est pas valide pour le champ %s");
600 if (preg_match('/^[0-9]{2}$/', $this->val
)) {
603 if ($this->val
< 1900 ||
$this->val
> 9999) {
604 return $this->raise("Le champ %s doit être une année à 4 chiffres.");
609 protected function buildUFC(UserFilterBuilder
&$ufb) {
610 return new UFC_Promo($this->comp
, UserFilter
::DISPLAY
, 'X' . $this->val
);
615 // {{{ class UFBF_Sex
616 class UFBF_Sex
extends UFBF_Enum
618 public function __construct($envfield, $formtext = '')
620 parent
::__construct($envfield, $formtext, array(1, 2));
623 private static function getVal($id)
627 return User
::GENDER_MALE
;
630 return User
::GENDER_FEMALE
;
635 protected function buildUFC(UserFilterBuilder
&$ufb)
637 return new UFC_Sex(self
::getVal($this->val
));
642 // {{{ class UFBF_Registered
643 class UFBF_Registered
extends UFBF_Enum
645 public function __construct($envfield, $formtext = '')
647 parent
::__construct($envfield, $formtext, array(1, 2));
650 protected function buildUFC(UserFilterBuilder
&$ufb)
652 if ($this->val
== 1) {
653 return new UFC_Registered();
654 } else if ($this->val
== 2) {
655 return new PFC_Not(UFC_Registered());
661 // {{{ class UFBF_Dead
662 class UFBF_Dead
extends UFBF_Enum
664 public function __construct($envfield, $formtext = '')
666 parent
::__construct($envfield, $formtext, array(1, 2));
669 protected function buildUFC(UserFilterBuilder
&$ufb)
671 if ($this->val
== 1) {
672 return new PFC_Not(UFC_Dead());
673 } else if ($this->val
== 2) {
674 return new UFC_Dead();
680 // {{{ class UFBF_Town
681 /** Retrieves a town, either from a postal code or a town name
683 class UFBF_Town
extends UFBF_Text
690 private $onlycurrentfield;
692 public function __construct($envfield, $formtext = '', $type = self
::TYPE_ANY
, $onlycurrentfield = 'only_current')
695 $this->onlycurrentfield
= $onlycurrentfield;
696 parent
::__construct($envfield, $formtext, 2, 30);
699 protected function buildUFC(UserFilterBuilder
&$ufb)
701 if ($ufb->isOn($this->onlycurrentfield
)) {
702 $flags = UFC_Address
::FLAG_CURRENT
;
704 $flags = UFC_Address
::FLAG_ANY
;
707 if (preg_match('/[0-9]/', $this->val
)) {
708 if ($this->type
& self
::TYPE_ZIP
) {
709 return new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_ZIPCODE
, UFC_Address
::TYPE_ANY
, $flags);
711 return new PFC_False();
714 $byname = new UFC_AddressText(null
, UFC_Address
::CONTAINS
, UFC_Address
::TYPE_ANY
, $flags, null
, $this->val
);
715 $byzip = new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_ZIPCODE
, UFC_Address
::TYPE_ANY
, $flags);
716 if ($this->type
& self
::TYPE_ANY
) {
717 return new PFC_Or($byname, $byzip);
718 } else if ($this->type
& self
::TYPE_TEXT
) {
728 // {{{ class UFBF_Country
729 class UFBF_Country
extends UFBF_Mixed
731 protected $direnum = DirEnum
::COUNTRIES
;
732 protected $onlycurrentfield;
734 public function __construct($envfieldtext, $envfieldindex, $formtext = '', $onlycurrentfield = 'only_current')
736 parent
::__construct($envfieldtext, $envfieldindex, $formtext);
737 $this->onlycurrentfield
= $onlycurrentfield;
740 protected function buildUFC(UserFilterBuilder
&$ufb)
742 if ($ufb->isOn($this->onlycurrentfield
)) {
743 $flags = UFC_Address
::FLAG_CURRENT
;
745 $flags = UFC_Address
::FLAG_ANY
;
748 return new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_COUNTRY
, UFC_Address
::TYPE_ANY
, $flags);
753 // {{{ class UFBF_AdminArea
754 class UFBF_AdminArea
extends UFBF_Mixed
756 protected $direnum = DirEnum
::ADMINAREAS
;
757 protected $onlycurrentfield;
759 public function __construct($envfieldtext, $envfieldindex, $formtext = '', $onlycurrentfield = 'only_current')
761 parent
::__construct($envfieldtext, $envfieldindex, $formtext);
762 $this->onlycurrentfield
= $onlycurrentfield;
766 protected function buildUFC(UserFilterBuilder
&$ufb)
768 if ($ufb->isOn($this->onlycurrentfield
)) {
769 $flags = UFC_Address
::FLAG_CURRENT
;
771 $flags = UFC_Address
::FLAG_ANY
;
774 return new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_ADMAREA
, UFC_Address
::TYPE_ANY
, $flags);
779 // {{{ class UFBF_JobCompany
780 class UFBF_JobCompany
extends UFBF_Text
782 private $onlymentorfield;
784 public function __construct($envfield, $formtext = '', $onlymentorfield = 'only_referent')
786 parent
::__construct($envfield, $formtext);
787 $this->onlymentorfield
= $onlymentorfield;
790 public function check(UserFilterBuilder
&$ufb) {
791 if (parent
::check($ufb)) {
792 # No company check for mentors
793 if ($ufb->isOn($this->onlymentorfield
)) {
802 protected function buildUFC(UserFilterBuilder
&$ufb)
804 return new UFC_Job_Company(UFC_Job_Company
::JOBNAME
, $this->val
);
809 // {{{ class UFBF_JobSector
810 class UFBF_JobSector
extends UFBF_Mixed
812 protected $direnum = DirEnum
::SECTORS
;
813 private $onlymentorfield;
815 public function __construct($envfieldtext, $envfieldindex, $formtext = '', $onlymentorfield = 'only_referent')
817 parent
::__construct($envfieldtext, $envfieldindex, $formtext);
818 $this->onlymentorfield
= $onlymentorfield;
821 protected function buildUFC(UserFilterBuilder
&$ufb)
823 if ($ufb->isOn($this->onlymentorfield
)) {
824 return new UFC_Mentor_Sectorization($this->val
, UserFilter
::JOB_SUBSECTOR
);
826 return new UFC_Job_Sectorization($this->val
, UserFilter
::JOB_SUBSUBSECTOR
);
832 // {{{ class UFBF_JobDescription
833 class UFBF_JobDescription
extends UFBF_Text
835 private $onlymentorfield;
837 public function __construct($envfield, $formtext = '', $onlymentorfield = 'only_referent')
839 parent
::__construct($envfield, $formtext);
840 $this->onlymentorfield
= $onlymentorfield;
843 protected function buildUFC(UserFilterBuilder
&$ufb)
845 if ($ufb->isOn($this->onlymentorfield
)) {
846 return new UFC_Mentor_Expertise($this->val
);
848 return new UFC_Job_Description($this->val
, UserFilter
::JOB_USERDEFINED
);
854 // {{{ class UFBF_JobCv
855 class UFBF_JobCv
extends UFBF_Text
857 private $onlymentorfield;
859 public function __construct($envfield, $formtext = '', $onlymentorfield = 'only_referent')
861 parent
::__construct($envfield, $formtext);
862 $this->onlymentorfield
= $onlymentorfield;
865 protected function buildUFC(UserFilterBuilder
&$ufb)
867 if ($ufb->isOn($this->onlymentorfield
)) {
868 return new UFC_Mentor_Expertise($this->val
);
870 return new UFC_Job_Description($this->val
, UserFilter
::JOB_CV
);
876 // {{{ class UFBF_Nationality
877 class UFBF_Nationality
extends UFBF_Mixed
879 protected $direnum = DirEnum
::NATIONALITIES
;
881 protected function buildUFC(UserFilterBuilder
&$ufb)
883 return new UFC_Nationality($this->val
);
888 // {{{ class UFBF_Binet
889 class UFBF_Binet
extends UFBF_Mixed
891 protected $direnum = DirEnum
::BINETS
;
893 protected function buildUFC(UserFilterBuilder
&$ufb)
895 return new UFC_Binet($this->val
);
900 // {{{ class UFBF_Group
901 class UFBF_Group
extends UFBF_Mixed
903 protected $direnum = DirEnum
::GROUPESX
;
905 protected function buildUFC(UserFilterBuilder
&$ufb)
907 if (count($this->val
) == 1) {
908 return new UFC_Group($this->val
[0]);
912 foreach ($this->val
as $grp) {
913 $or->addChild(new UFC_Group($grp));
920 // {{{ class UFBF_Section
921 class UFBF_Section
extends UFBF_Index
923 protected $direnum = DirEnum
::SECTIONS
;
925 protected function buildUFC(UserFilterBuilder
&$ufb)
927 return new UFC_Section($this->val
);
932 // {{{ class UFBF_EducationSchool
933 class UFBF_EducationSchool
extends UFBF_Mixed
935 protected $direnum = DirEnum
::EDUSCHOOLS
;
937 protected function buildUFC(UserFilterBuilder
&$ufb)
939 return new UFC_EducationSchool($this->val
);
944 // {{{ class UFBF_EducationDegree
945 class UFBF_EducationDegree
extends UFBF_Mixed
947 protected $direnum = DirEnum
::EDUDEGREES
;
949 protected function buildUFC(UserFilterBuilder
&$ufb)
951 return new UFC_EducationDegree($this->val
);
956 // {{{ class UFBF_EducationField
957 class UFBF_EducationField
extends UFBF_Mixed
959 protected $direnum = DirEnum
::EDUFIELDS
;
961 protected function buildUFC(UserFilterBuilder
&$ufb)
963 return new UFC_EducationField($this->val
);
968 // {{{ class UFBF_Comment
969 class UFBF_Comment
extends UFBF_Text
971 protected function buildUFC(UserFilterBuilder
&$ufb)
973 return new UFC_Comment($this->val
);
978 // {{{ class UFBF_Phone
979 class UFBF_Phone
extends UFBF_Text
981 protected function buildUFC(UserFilterBuilder
&$ufb)
983 return new UFC_Phone($this->val
);
988 // {{{ class UFBF_Networking
989 class UFBF_Networking
extends UFBF_Text
991 private $networktypefield;
994 public function __construct($envfield, $networktypefield, $formtext = '')
996 parent
::__construct($envfield, $formtext);
997 $this->networktypefield
= $networktypefield;
1000 public function check(UserFilterBuilder
&$ufb)
1002 if (parent
::check($ufb)) {
1003 $this->nwtype
= $ufb->i($this->networktypefield
);
1010 public function buildUFC(UserFilterBuilder
&$ufb)
1012 return new UFC_Networking($this->nwtype
, $this->val
);
1017 // {{{ class UFBF_MentorCountry
1018 class UFBF_MentorCountry
extends UFBF_Index
1020 protected function buildUFC(UserFilterBuilder
&$ufb)
1022 return new UFC_Mentor_Country($this->val
);
1027 // {{{ class UFBF_MentorSectorization
1028 class UFBF_MentorSectorization
extends UFBF_Index
1032 public function __construct($envfield, $formtext = '', $type = UFC_Mentor_Sectorization
::SECTOR
)
1034 parent
::__construct($envfield, $formtext);
1035 $this->type
= $type;
1038 protected function buildUFC(UserFilterBuilder
&$ufb)
1040 return new UFC_Mentor_Sectorization($this->val
, $this->type
);
1045 // {{{ class UFBF_MentorExpertise
1046 class UFBF_MentorExpertise
extends UFBF_Text
1048 protected function buildUFC(UserFilterBuilder
&$ufb)
1050 return new UFC_Mentor_Expertise($this->val
);