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') ? DirEnumeration
::MODE_EXACT
: DirEnumeration
::MODE_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 // TODO: create UFC_Ip
473 // $this->conds->addChild(new UFC_Ip($s));
477 $conds = new PFC_And();
481 $s = preg_replace('!\d+!', ' ', $s);
482 $strings = preg_split("![^a-zA-Z%]+!",$s, -1, PREG_SPLIT_NO_EMPTY
);
483 if (count($strings) > 5) {
484 Platal
::page()->trigWarning("Tu as indiqué trop d'éléments dans ta recherche, seuls les 5 premiers seront pris en compte");
485 $strings = array_slice($strings, 0, 5);
488 if (count($strings)) {
492 $flags = array('public');
494 if ($ufb->i('soundex')) {
497 foreach ($strings as $string) {
498 $st[] = soundex_fr($string);
504 if ($ufb->i('exact')) {
509 $conds->addChild(new UFC_NameTokens($st, $flags, $soundex, $exact));
511 $ufb->addOrder(new UFO_Score());
516 $s = preg_replace('! *- *!', '-', $r);
517 $s = preg_replace('!([<>]) *!', ' \1', $s);
518 $s = preg_replace('![^0-9\-><]!', ' ', $s);
519 $s = preg_replace('![<>\-] !', '', $s);
520 $ranges = preg_split('! +!', $s, -1, PREG_SPLIT_NO_EMPTY
);
521 foreach ($ranges as $r) {
522 if (preg_match('!^\d{4}$!', $r)) {
523 $conds->addChild(new UFC_Promo('=', UserFilter
::DISPLAY
, 'X' . $r));
524 } elseif (preg_match('!^(\d{4})-(\d{4})$!', $r, $matches)) {
525 $p1=min(intval($matches[1]), intval($matches[2]));
526 $p2=max(intval($matches[1]), intval($matches[2]));
527 $conds->addChild(new PFC_And(
528 new UFC_Promo('>=', UserFilter
::DISPLAY
, 'X' . $p1),
529 new UFC_Promo('<=', UserFilter
::DISPLAY
, 'X' . $p2)
531 } elseif (preg_match('!^<(\d{4})!', $r, $matches)) {
532 $conds->addChild(new UFC_Promo('<=', UserFilter
::DISPLAY
, 'X' . $matches[1]));
533 } elseif (preg_match('!^>(\d{4})!', $r, $matches)) {
534 $conds->addChild(new UFC_Promo('>=', UserFilter
::DISPLAY
, 'X' . $matches[1]));
540 $t = preg_replace('!(\d{4}-\d{4}|>\d{4}|<\d{4})!', '', $s);
541 $t = preg_replace('![<>\- ]!', '', $t);
542 if (strlen($t) > 4) {
543 $conds->addChild(new UFC_Phone($t));
551 // {{{ class UFBF_Name
552 class UFBF_Name
extends UFBF_Text
554 protected function check(UserFilterBuilder
&$ufb)
556 if (!parent
::check($ufb)) {
560 $this->val
= preg_split('/[[:space:]]/', $this->val
);
561 if (count($this->val
) == 0) {
567 protected function buildUFC(UserFilterBuilder
&$ufb)
569 return new UFC_NameTokens($this->val
, array(), $ufb->i('with_soundex'), $ufb->i('exact'));
574 // {{{ class UFBF_Promo
575 class UFBF_Promo
extends UFB_Field
577 private static $validcomps = array('<', '<=', '=', '>=', '>');
579 private $envfieldcomp;
581 public function __construct($envfield, $fromtext = '', $envfieldcomp)
583 parent
::__construct($envfield, $fromtext);
584 $this->envfieldcomp
= $envfieldcomp;
587 protected function check(UserFilterBuilder
&$ufb)
589 if (!$ufb->has($this->envfield
) ||
!$ufb->has($this->envfieldcomp
)) {
594 $this->val
= $ubf->i($this->envfield
);
595 $this->comp
= $ubf->v($this->envfieldcomp
);
597 if (!in_array($this->comp
, self
::$validcomps)) {
598 return $this->raise("Le critère {$this->comp} n'est pas valide pour le champ %s");
601 if (preg_match('/^[0-9]{2}$/', $this->val
)) {
604 if ($this->val
< 1900 ||
$this->val
> 9999) {
605 return $this->raise("Le champ %s doit être une année à 4 chiffres.");
610 protected function buildUFC(UserFilterBuilder
&$ufb) {
611 return new UFC_Promo($this->comp
, UserFilter
::DISPLAY
, 'X' . $this->val
);
616 // {{{ class UFBF_Sex
617 class UFBF_Sex
extends UFBF_Enum
619 public function __construct($envfield, $formtext = '')
621 parent
::__construct($envfield, $formtext, array(1, 2));
624 private static function getVal($id)
628 return User
::GENDER_MALE
;
631 return User
::GENDER_FEMALE
;
636 protected function buildUFC(UserFilterBuilder
&$ufb)
638 return new UFC_Sex(self
::getVal($this->val
));
643 // {{{ class UFBF_Registered
644 class UFBF_Registered
extends UFBF_Enum
646 public function __construct($envfield, $formtext = '')
648 parent
::__construct($envfield, $formtext, array(1, 2));
651 protected function buildUFC(UserFilterBuilder
&$ufb)
653 if ($this->val
== 1) {
654 return new UFC_Registered();
655 } else if ($this->val
== 2) {
656 return new PFC_Not(UFC_Registered());
662 // {{{ class UFBF_Dead
663 class UFBF_Dead
extends UFBF_Enum
665 public function __construct($envfield, $formtext = '')
667 parent
::__construct($envfield, $formtext, array(1, 2));
670 protected function buildUFC(UserFilterBuilder
&$ufb)
672 if ($this->val
== 1) {
673 return new PFC_Not(UFC_Dead());
674 } else if ($this->val
== 2) {
675 return new UFC_Dead();
681 // {{{ class UFBF_Town
682 /** Retrieves a town, either from a postal code or a town name
684 class UFBF_Town
extends UFBF_Text
691 private $onlycurrentfield;
693 public function __construct($envfield, $formtext = '', $type = self
::TYPE_ANY
, $onlycurrentfield = 'only_current')
696 $this->onlycurrentfield
= $onlycurrentfield;
697 parent
::__construct($envfield, $formtext, 2, 30);
700 protected function buildUFC(UserFilterBuilder
&$ufb)
702 if ($ufb->isOn($this->onlycurrentfield
)) {
703 $flags = UFC_Address
::FLAG_CURRENT
;
705 $flags = UFC_Address
::FLAG_ANY
;
708 if (preg_match('/[0-9]/', $this->val
)) {
709 if ($this->type
& self
::TYPE_ZIP
) {
710 return new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_ZIPCODE
, UFC_Address
::TYPE_ANY
, $flags);
712 return new PFC_False();
715 $byname = new UFC_AddressText(null
, UFC_Address
::CONTAINS
, UFC_Address
::TYPE_ANY
, $flags, null
, $this->val
);
716 $byzip = new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_ZIPCODE
, UFC_Address
::TYPE_ANY
, $flags);
717 if ($this->type
& self
::TYPE_ANY
) {
718 return new PFC_Or($byname, $byzip);
719 } else if ($this->type
& self
::TYPE_TEXT
) {
729 // {{{ class UFBF_Country
730 class UFBF_Country
extends UFBF_Mixed
732 protected $direnum = DirEnum
::COUNTRIES
;
733 protected $onlycurrentfield;
735 public function __construct($envfieldtext, $envfieldindex, $formtext = '', $onlycurrentfield = 'only_current')
737 parent
::__construct($envfieldtext, $envfieldindex, $formtext);
738 $this->onlycurrentfield
= $onlycurrentfield;
741 protected function buildUFC(UserFilterBuilder
&$ufb)
743 if ($ufb->isOn($this->onlycurrentfield
)) {
744 $flags = UFC_Address
::FLAG_CURRENT
;
746 $flags = UFC_Address
::FLAG_ANY
;
749 return new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_COUNTRY
, UFC_Address
::TYPE_ANY
, $flags);
754 // {{{ class UFBF_AdminArea
755 class UFBF_AdminArea
extends UFBF_Mixed
757 protected $direnum = DirEnum
::ADMINAREAS
;
758 protected $onlycurrentfield;
760 public function __construct($envfieldtext, $envfieldindex, $formtext = '', $onlycurrentfield = 'only_current')
762 parent
::__construct($envfieldtext, $envfieldindex, $formtext);
763 $this->onlycurrentfield
= $onlycurrentfield;
767 protected function buildUFC(UserFilterBuilder
&$ufb)
769 if ($ufb->isOn($this->onlycurrentfield
)) {
770 $flags = UFC_Address
::FLAG_CURRENT
;
772 $flags = UFC_Address
::FLAG_ANY
;
775 return new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_ADMAREA
, UFC_Address
::TYPE_ANY
, $flags);
780 // {{{ class UFBF_JobCompany
781 class UFBF_JobCompany
extends UFBF_Text
783 private $onlymentorfield;
785 public function __construct($envfield, $formtext = '', $onlymentorfield = 'only_referent')
787 parent
::__construct($envfield, $formtext);
788 $this->onlymentorfield
= $onlymentorfield;
791 public function check(UserFilterBuilder
&$ufb) {
792 if (parent
::check($ufb)) {
793 # No company check for mentors
794 if ($ufb->isOn($this->onlymentorfield
)) {
803 protected function buildUFC(UserFilterBuilder
&$ufb)
805 return new UFC_Job_Company(UFC_Job_Company
::JOBNAME
, $this->val
);
810 // {{{ class UFBF_JobSector
811 class UFBF_JobSector
extends UFBF_Mixed
813 protected $direnum = DirEnum
::SECTORS
;
814 private $onlymentorfield;
816 public function __construct($envfieldtext, $envfieldindex, $formtext = '', $onlymentorfield = 'only_referent')
818 parent
::__construct($envfieldtext, $envfieldindex, $formtext);
819 $this->onlymentorfield
= $onlymentorfield;
822 protected function buildUFC(UserFilterBuilder
&$ufb)
824 if ($ufb->isOn($this->onlymentorfield
)) {
825 return new UFC_Mentor_Sectorization($this->val
, UserFilter
::JOB_SUBSECTOR
);
827 return new UFC_Job_Sectorization($this->val
, UserFilter
::JOB_SUBSUBSECTOR
);
833 // {{{ class UFBF_JobDescription
834 class UFBF_JobDescription
extends UFBF_Text
836 private $onlymentorfield;
838 public function __construct($envfield, $formtext = '', $onlymentorfield = 'only_referent')
840 parent
::__construct($envfield, $formtext);
841 $this->onlymentorfield
= $onlymentorfield;
844 protected function buildUFC(UserFilterBuilder
&$ufb)
846 if ($ufb->isOn($this->onlymentorfield
)) {
847 return new UFC_Mentor_Expertise($this->val
);
849 return new UFC_Job_Description($this->val
, UserFilter
::JOB_USERDEFINED
);
855 // {{{ class UFBF_JobCv
856 class UFBF_JobCv
extends UFBF_Text
858 private $onlymentorfield;
860 public function __construct($envfield, $formtext = '', $onlymentorfield = 'only_referent')
862 parent
::__construct($envfield, $formtext);
863 $this->onlymentorfield
= $onlymentorfield;
866 protected function buildUFC(UserFilterBuilder
&$ufb)
868 if ($ufb->isOn($this->onlymentorfield
)) {
869 return new UFC_Mentor_Expertise($this->val
);
871 return new UFC_Job_Description($this->val
, UserFilter
::JOB_CV
);
877 // {{{ class UFBF_Nationality
878 class UFBF_Nationality
extends UFBF_Mixed
880 protected $direnum = DirEnum
::NATIONALITIES
;
882 protected function buildUFC(UserFilterBuilder
&$ufb)
884 return new UFC_Nationality($this->val
);
889 // {{{ class UFBF_Binet
890 class UFBF_Binet
extends UFBF_Mixed
892 protected $direnum = DirEnum
::BINETS
;
894 protected function buildUFC(UserFilterBuilder
&$ufb)
896 return new UFC_Binet($this->val
);
901 // {{{ class UFBF_Group
902 class UFBF_Group
extends UFBF_Mixed
904 protected $direnum = DirEnum
::GROUPESX
;
906 protected function buildUFC(UserFilterBuilder
&$ufb)
908 if (count($this->val
) == 1) {
909 return new UFC_Group($this->val
[0]);
913 foreach ($this->val
as $grp) {
914 $or->addChild(new UFC_Group($grp));
921 // {{{ class UFBF_Section
922 class UFBF_Section
extends UFBF_Index
924 protected $direnum = DirEnum
::SECTIONS
;
926 protected function buildUFC(UserFilterBuilder
&$ufb)
928 return new UFC_Section($this->val
);
933 // {{{ class UFBF_EducationSchool
934 class UFBF_EducationSchool
extends UFBF_Mixed
936 protected $direnum = DirEnum
::EDUSCHOOLS
;
938 protected function buildUFC(UserFilterBuilder
&$ufb)
940 return new UFC_EducationSchool($this->val
);
945 // {{{ class UFBF_EducationDegree
946 class UFBF_EducationDegree
extends UFBF_Mixed
948 protected $direnum = DirEnum
::EDUDEGREES
;
950 protected function buildUFC(UserFilterBuilder
&$ufb)
952 return new UFC_EducationDegree($this->val
);
957 // {{{ class UFBF_EducationField
958 class UFBF_EducationField
extends UFBF_Mixed
960 protected $direnum = DirEnum
::EDUFIELDS
;
962 protected function buildUFC(UserFilterBuilder
&$ufb)
964 return new UFC_EducationField($this->val
);
969 // {{{ class UFBF_Comment
970 class UFBF_Comment
extends UFBF_Text
972 protected function buildUFC(UserFilterBuilder
&$ufb)
974 return new UFC_Comment($this->val
);
979 // {{{ class UFBF_Phone
980 class UFBF_Phone
extends UFBF_Text
982 protected function buildUFC(UserFilterBuilder
&$ufb)
984 return new UFC_Phone($this->val
);
989 // {{{ class UFBF_Networking
990 class UFBF_Networking
extends UFBF_Text
992 private $networktypefield;
995 public function __construct($envfield, $networktypefield, $formtext = '')
997 parent
::__construct($envfield, $formtext);
998 $this->networktypefield
= $networktypefield;
1001 public function check(UserFilterBuilder
&$ufb)
1003 if (parent
::check($ufb)) {
1004 $this->nwtype
= $ufb->i($this->networktypefield
);
1011 public function buildUFC(UserFilterBuilder
&$ufb)
1013 return new UFC_Networking($this->nwtype
, $this->val
);
1018 // {{{ class UFBF_MentorCountry
1019 class UFBF_MentorCountry
extends UFBF_Index
1021 protected function buildUFC(UserFilterBuilder
&$ufb)
1023 return new UFC_Mentor_Country($this->val
);
1028 // {{{ class UFBF_MentorSectorization
1029 class UFBF_MentorSectorization
extends UFBF_Index
1033 public function __construct($envfield, $formtext = '', $type = UFC_Mentor_Sectorization
::SECTOR
)
1035 parent
::__construct($envfield, $formtext);
1036 $this->type
= $type;
1039 protected function buildUFC(UserFilterBuilder
&$ufb)
1041 return new UFC_Mentor_Sectorization($this->val
, $this->type
);
1046 // {{{ class UFBF_MentorExpertise
1047 class UFBF_MentorExpertise
extends UFBF_Text
1049 protected function buildUFC(UserFilterBuilder
&$ufb)
1051 return new UFC_Mentor_Expertise($this->val
);