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 // {{{ class UserFilterBuilder
23 class UserFilterBuilder
27 private $valid = true
;
29 private $orders = array();
32 * @param $fields An array of UFB_Field objects
33 * @param $envprefix Prefix to use for parts of the query
35 public function __construct($fields, $envprefix = '')
37 $this->fields
= $fields;
38 $this->envprefix
= $envprefix;
41 /** Builds the UFC; returns as soon as a field says it is invalid
43 private function buildUFC()
45 if ($this->ufc
!= null
) {
48 $this->ufc
= new PFC_And();
50 foreach ($this->fields
as $field) {
51 $this->valid
= $field->apply(&$this);
58 public function addCond(PlFilterCondition
&$cond)
60 $this->ufc
->addChild($cond);
63 public function addOrder(PlFilterOrder
&$order)
65 $this->order
[] = $order;
68 public function isValid()
74 public function isEmpty()
77 foreach ($this->fields
as $field) {
78 if (! $field->isEmpty()) {
85 /** Returns the built UFC
86 * @return The UFC, or PFC_False() if an error happened
88 public function getUFC()
94 return new PFC_False();
98 /** Returns adequate orders
100 public function getOrders()
103 return $this->orders
;
106 /** Wrappers around Env::i/s/..., to add envprefix
108 public function s($key, $def = '')
110 return Env
::s($this->envprefix
. $key, $def);
113 public function t($key, $def = '')
115 return Env
::t($this->envprefix
. $key, $def);
118 public function i($key, $def = 0)
120 return Env
::i($this->envprefix
. $key, $def);
123 public function v($key, $def = null
)
125 return Env
::v($this->envprefix
. $key, $def);
128 public function b($key, $def = false
)
130 return Env
::b($this->envprefix
. $key, $def);
133 public function has($key)
135 return Env
::has($this->envprefix
. $key);
138 public function blank($key, $strict = false
)
140 return Env
::blank($key, $strict);
143 public function hasAlnum($key)
145 $str = $this->s($key);
146 return preg_match('/[a-z0-9]/i', $str);
149 public function hasAlpha($key)
151 $str = $this->s($key);
152 return preg_match('/[a-z]/i', $str);
155 public function isOn($key)
157 return $this->has($key) && $this->t($key) == 'on';
162 // {{{ class UFB_QuickSearch
163 class UFB_QuickSearch
extends UserFilterBuilder
165 public function __construct($envprefix = '')
168 new UFBF_Quick('quick', 'Recherche rapide'),
170 parent
::__construct($fields, $envprefix);
175 // {{{ class UFB_AdvancedSearch
176 class UFB_AdvancedSearch
extends UserFilterBuilder
178 public function __construct($envprefix = '')
181 new UFBF_Name('name', 'Nom'),
182 new UFBF_Promo('promo1', 'Promotion', 'egal1'),
183 new UFBF_Promo('promo2', 'Promotion', 'egal2'),
184 new UFBF_Sex('woman', 'Sexe'),
185 new UFBF_Registered('subscriber', 'Inscrit'),
186 new UFBF_Dead('alive', 'En vie'),
188 new UFBF_Town('city', 'Ville / Code Postal'),
189 new UFBF_Country('countryTxt', 'country', 'Pays'),
190 new UFBF_AdminArea('region', 'RĂ©gion'),
192 new UFBF_JobCompany('entreprise', 'Entreprise'),
193 new UFBF_JobSector('sector', 'Poste'),
194 new UFBF_JobDescription('jobdescription', 'Fonction'),
195 new UFBF_JobCv('cv', 'CV'),
196 new UFBF_JobTerms('jobterm', 'Mots-clefs'),
198 new UFBF_Nationality('nationaliteTxt', 'nationalite', 'Nationalité'),
199 new UFBF_Binet('binetTxt', 'binet', 'Binet'),
200 new UFBF_Group('groupexTxt', 'groupex', 'Groupe X'),
201 new UFBF_Section('sectionTxt', 'section', 'Section'),
203 new UFBF_EducationSchool('schoolTxt', 'school', "École d'application"),
204 new UFBF_EducationDegree('diplomaTxt', 'diploma', 'DiplĂ´me'),
205 new UFBF_EducationField('fieldTxt', 'field', "Domaine d'Ă©tudes"),
207 new UFBF_Comment('free', 'Commentaire'),
208 new UFBF_Phone('phone_number', 'Téléphone'),
209 new UFBF_Networking('networking_address', 'networking_type', 'Networking et sites webs'),
211 parent
::__construct($fields, $envprefix);
216 // {{{ class UFB_MentorSearch
217 class UFB_MentorSearch
extends UserFilterBuilder
219 public function __construct($envprefix = '')
222 new UFBF_MentorCountry('country'),
223 new UFBF_MentorTerm('jobterm', 'jobtermText'),
224 new UFBF_MentorExpertise('expertise'),
226 parent
::__construct($fields, $envprefix);
231 // {{{ class UFB_Field
232 abstract class UFB_Field
237 protected $empty = false
;
238 protected $val = null
;
241 * @param $envfield Name of the field in the environment
242 * @param $formtext User-friendly name of that field
244 public function __construct($envfield, $formtext = '')
246 $this->envfield
= $envfield;
247 if ($formtext != '') {
248 $this->formtext
= $formtext;
250 $formtext = ucfirst($envfield);
254 /** Prints the given error message to the user, and returns false
255 * in order to be used as return $this->raise('ERROR');
257 * All %s in the $msg will be replaced with the formtext.
259 protected function raise($msg)
261 Platal
::page()->trigError(str_replace('%s', $this->formtext
, $msg));
265 public function apply(UserFilterBuilder
&$ufb) {
266 if (!$this->check($ufb)) {
271 $ufc = $this->buildUFC($ufb);
279 public function isEmpty()
284 /** Create the UFC associated to the field; won't be called
285 * if the field is "empty"
286 * @param &$ufb UFB to which fields must be added
289 abstract protected function buildUFC(UserFilterBuilder
&$ufb);
291 /** This function is intended to run consistency checks on the value
292 * @return boolean Whether the input is valid
294 abstract protected function check(UserFilterBuilder
&$ufb);
298 // {{{ class UFBF_Text
299 abstract class UFBF_Text
extends UFB_Field
304 public function __construct($envfield, $formtext = '', $minlength = 2, $maxlength = 255)
306 parent
::__construct($envfield, $formtext);
307 $this->minlength
= $minlength;
308 $this->maxlength
= $maxlength;
311 protected function check(UserFilterBuilder
&$ufb)
313 if ($ufb->blank($this->envfield
)) {
318 $this->val
= $ufb->t($this->envfield
);
319 if (strlen($this->val
) < $this->minlength
) {
320 return $this->raise("Le champ %s est trop court (minimum {$this->minlength}).");
321 } else if (strlen($this->val
) > $this->maxlength
) {
322 return $this->raise("Le champ %s est trop long (maximum {$this->maxlength}).");
323 } else if (preg_match(":[\]\[<>{}~/§_`|%$^=+]|\*\*:u", $this->val
)) {
324 return $this->raise('Le champ %s contient un caractère interdit rendant la recherche impossible.');
332 // {{{ class UFBF_Range
333 /** Subclass to use for fields which only allow integers within a range
335 abstract class UFBF_Range
extends UFB_Field
341 public function __construct($envfield, $formtext = '', $min = 0, $max = 65535)
343 parent
::__construct($envfield, $formtext);
348 protected function check(UserFilterBuilder
&$ufb)
350 if ($ufb->blank($this->envfield
)) {
355 $this->val
= $ufb->i($this->envfield
);
356 if ($this->val
< $this->min
) {
357 return $this->raise("Le champs %s est inférieur au minimum ({$this->min}).");
358 } else if ($this->val
> $this->max
) {
359 return $this->raise("Le champ %s est supérieur au maximum ({$this->max}).");
366 // {{{ class UFBF_Index
367 /** Subclass to use for indexed fields
369 abstract class UFBF_Index
extends UFB_Field
371 protected function check(UserFilterBuilder
&$ufb)
373 if ($ufb->blank($this->envfield
)) {
376 $this->val
= $ufb->i($this->envfield
);
382 // {{{ class UFBF_Enum
383 /** Subclass to use for fields whose value must belong to a specific set of values
385 abstract class UFBF_Enum
extends UFB_Field
387 protected $allowedvalues;
389 public function __construct($envfield, $formtext = '', $allowedvalues = array(), $strict = false
)
391 parent
::__construct($envfield, $formtext);
392 $this->allowedvalues
= $allowedvalues;
393 $this->strict
= $strict;
396 protected function check(UserFilterBuilder
&$ufb)
398 if ($ufb->blank($this->envfield
)) {
403 $this->val
= $ufb->v($this->envfield
);
404 if (! in_array($this->val
, $this->allowedvalues
)) {
406 return $this->raise("La valeur {$this->val} n'est pas valide pour le champ %s.");
416 // {{{ class UFBF_Bool
417 abstract class UFBF_Bool
extends UFB_Field
419 protected function check(UserFilterBuilder
&$ufb)
421 if ($ufb->blank($this->envfield
)) {
426 $this->val
= $ufb->b($this->envfield
);
432 // {{{ class UFBF_Mixed
433 /** A class for building UFBFs when the user can input either a text or an ID
435 abstract class UFBF_Mixed
extends UFB_Field
437 /** Name of the DirEnum on which class is based
441 protected $envfieldindex;
443 public function __construct($envfieldtext, $envfieldindex, $formtext = '')
445 parent
::__construct($envfieldtext, $formtext);
446 $this->envfieldindex
= $envfieldindex;
449 protected function check(UserFilterBuilder
&$ufb)
451 if ($ufb->blank($this->envfieldindex
) && !$ufb->hasAlnum($this->envfield
)) {
456 if (!$ufb->blank($this->envfieldindex
)) {
457 $index = $ufb->v($this->envfieldindex
);
458 if (is_int($index)) {
459 $index = intval($index);
461 $index = strtoupper($index);
463 $this->val
= array($index);
465 $indexes = DirEnum
::getIDs($this->direnum
, $ufb->t($this->envfield
),
466 $ufb->b('exact') ? XDB
::WILDCARD_EXACT
: XDB
::WILDCARD_CONTAINS
);
467 if (count($indexes) == 0) {
470 $this->val
= $indexes;
477 // {{{ class UFBF_Quick
478 class UFBF_Quick
extends UFB_Field
480 protected function check(UserFilterBuilder
&$ufb)
482 if ($ufb->blank($this->envfield
)) {
487 $this->val
= str_replace('*', '%', replace_accent($ufb->t($this->envfield
)));
492 protected function buildUFC(UserFilterBuilder
&$ufb)
495 $r = $s = $this->val
;
499 if (S
::admin() && strpos($s, '@') !== false
) {
500 return new UFC_Email($s);
501 } else if (S
::admin() && preg_match('/[0-9]+\.([0-9]+|%)\.([0-9]+|%)\.([0-9]+|%)/', $s)) {
502 return new UFC_Ip($s);
505 $conds = new PFC_And();
509 $s = preg_replace('!\d+!', ' ', $s);
510 $strings = preg_split("![^a-zA-Z%]+!",$s, -1, PREG_SPLIT_NO_EMPTY
);
511 if (count($strings) > 5) {
512 Platal
::page()->trigWarning("Tu as indiqué trop d'éléments dans ta recherche, seuls les 5 premiers seront pris en compte");
513 $strings = array_slice($strings, 0, 5);
516 if (count($strings)) {
520 $flags = array('public');
522 if ($ufb->b('with_soundex')) {
525 foreach ($strings as $string) {
526 $st[] = soundex_fr($string);
532 $exact =$ufb->b('exact');
533 $conds->addChild(new UFC_NameTokens($st, $flags, $soundex, $exact));
535 $ufb->addOrder(new UFO_Score());
540 $s = preg_replace('! *- *!', '-', $r);
541 $s = preg_replace('!([<>]) *!', ' \1', $s);
542 $s = preg_replace('![^0-9\-><]!', ' ', $s);
543 $s = preg_replace('![<>\-] !', '', $s);
544 $ranges = preg_split('! +!', $s, -1, PREG_SPLIT_NO_EMPTY
);
545 foreach ($ranges as $r) {
546 if (preg_match('!^\d{4}$!', $r)) {
547 $conds->addChild(new UFC_Promo('=', UserFilter
::DISPLAY
, 'X' . $r));
548 } elseif (preg_match('!^(\d{4})-(\d{4})$!', $r, $matches)) {
549 $p1=min(intval($matches[1]), intval($matches[2]));
550 $p2=max(intval($matches[1]), intval($matches[2]));
551 $conds->addChild(new PFC_And(
552 new UFC_Promo('>=', UserFilter
::DISPLAY
, 'X' . $p1),
553 new UFC_Promo('<=', UserFilter
::DISPLAY
, 'X' . $p2)
555 } elseif (preg_match('!^<(\d{4})!', $r, $matches)) {
556 $conds->addChild(new UFC_Promo('<=', UserFilter
::DISPLAY
, 'X' . $matches[1]));
557 } elseif (preg_match('!^>(\d{4})!', $r, $matches)) {
558 $conds->addChild(new UFC_Promo('>=', UserFilter
::DISPLAY
, 'X' . $matches[1]));
564 $t = preg_replace('!(\d{4}-\d{4}|>\d{4}|<\d{4})!', '', $s);
565 $t = preg_replace('![<>\- ]!', '', $t);
566 if (strlen($t) > 4) {
567 $conds->addChild(new UFC_Phone($t));
575 // {{{ class UFBF_Name
576 class UFBF_Name
extends UFBF_Text
578 protected function check(UserFilterBuilder
&$ufb)
580 if (!parent
::check($ufb)) {
584 $this->val
= preg_split('/[[:space:]]/', $this->val
);
585 if (count($this->val
) == 0) {
591 protected function buildUFC(UserFilterBuilder
&$ufb)
593 return new UFC_NameTokens($this->val
, array(), $ufb->b('with_soundex'), $ufb->b('exact'));
598 // {{{ class UFBF_Promo
599 class UFBF_Promo
extends UFB_Field
601 private static $validcomps = array('<', '<=', '=', '>=', '>');
603 private $envfieldcomp;
605 public function __construct($envfield, $fromtext = '', $envfieldcomp)
607 parent
::__construct($envfield, $fromtext);
608 $this->envfieldcomp
= $envfieldcomp;
611 protected function check(UserFilterBuilder
&$ufb)
613 if ($ufb->blank($this->envfield
) ||
$ufb->blank($this->envfieldcomp
)) {
618 $this->val
= $ufb->i($this->envfield
);
619 $this->comp
= $ufb->v($this->envfieldcomp
);
621 if (!in_array($this->comp
, self
::$validcomps)) {
622 return $this->raise("Le critère {$this->comp} n'est pas valide pour le champ %s");
625 if (preg_match('/^[0-9]{2}$/', $this->val
)) {
628 if ($this->val
< 1900 ||
$this->val
> 9999) {
629 return $this->raise("Le champ %s doit Ăªtre une annĂ©e Ă 4 chiffres.");
634 protected function buildUFC(UserFilterBuilder
&$ufb) {
635 return new UFC_Promo($this->comp
, UserFilter
::GRADE_ING
, $this->val
);
640 // {{{ class UFBF_Sex
641 class UFBF_Sex
extends UFBF_Enum
643 public function __construct($envfield, $formtext = '')
645 parent
::__construct($envfield, $formtext, array(1, 2));
648 private static function getVal($id)
652 return User
::GENDER_MALE
;
655 return User
::GENDER_FEMALE
;
660 protected function buildUFC(UserFilterBuilder
&$ufb)
662 return new UFC_Sex(self
::getVal($this->val
));
667 // {{{ class UFBF_Registered
668 class UFBF_Registered
extends UFBF_Enum
670 public function __construct($envfield, $formtext = '')
672 parent
::__construct($envfield, $formtext, array(1, 2));
675 protected function buildUFC(UserFilterBuilder
&$ufb)
677 if ($this->val
== 1) {
678 return new UFC_Registered();
679 } else if ($this->val
== 2) {
680 return new PFC_Not(new UFC_Registered());
686 // {{{ class UFBF_Dead
687 class UFBF_Dead
extends UFBF_Enum
689 public function __construct($envfield, $formtext = '')
691 parent
::__construct($envfield, $formtext, array(1, 2));
694 protected function buildUFC(UserFilterBuilder
&$ufb)
696 if ($this->val
== 1) {
697 return new PFC_Not(new UFC_Dead());
698 } else if ($this->val
== 2) {
699 return new UFC_Dead();
705 // {{{ class UFBF_Town
706 /** Retrieves a town, either from a postal code or a town name
708 class UFBF_Town
extends UFBF_Text
715 private $onlycurrentfield;
717 public function __construct($envfield, $formtext = '', $type = self
::TYPE_ANY
, $onlycurrentfield = 'only_current')
720 $this->onlycurrentfield
= $onlycurrentfield;
721 parent
::__construct($envfield, $formtext, 2, 30);
724 protected function buildUFC(UserFilterBuilder
&$ufb)
726 if ($ufb->isOn($this->onlycurrentfield
)) {
727 $flags = UFC_Address
::FLAG_CURRENT
;
729 $flags = UFC_Address
::FLAG_ANY
;
732 if (preg_match('/[0-9]/', $this->val
)) {
733 if ($this->type
& self
::TYPE_ZIP
) {
734 return new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_ZIPCODE
, UFC_Address
::TYPE_ANY
, $flags);
736 return new PFC_False();
739 $byname = new UFC_AddressText(null
, XDB
::WILDCARD_CONTAINS
, UFC_Address
::TYPE_ANY
, $flags, null
, $this->val
);
740 $byzip = new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_ZIPCODE
, UFC_Address
::TYPE_ANY
, $flags);
741 if ($this->type
& self
::TYPE_ANY
) {
742 return new PFC_Or($byname, $byzip);
743 } else if ($this->type
& self
::TYPE_TEXT
) {
753 // {{{ class UFBF_Country
754 class UFBF_Country
extends UFBF_Mixed
756 protected $direnum = DirEnum
::COUNTRIES
;
757 protected $onlycurrentfield;
759 public function __construct($envfieldtext, $envfieldindex, $formtext = '', $onlycurrentfield = 'only_current')
761 parent
::__construct($envfieldtext, $envfieldindex, $formtext);
762 $this->onlycurrentfield
= $onlycurrentfield;
765 protected function buildUFC(UserFilterBuilder
&$ufb)
767 if ($ufb->isOn($this->onlycurrentfield
)) {
768 $flags = UFC_Address
::FLAG_CURRENT
;
770 $flags = UFC_Address
::FLAG_ANY
;
773 return new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_COUNTRY
, UFC_Address
::TYPE_ANY
, $flags);
778 // {{{ class UFBF_AdminArea
779 class UFBF_AdminArea
extends UFBF_Mixed
781 protected $direnum = DirEnum
::ADMINAREAS
;
782 protected $onlycurrentfield;
784 public function __construct($envfieldtext, $envfieldindex, $formtext = '', $onlycurrentfield = 'only_current')
786 parent
::__construct($envfieldtext, $envfieldindex, $formtext);
787 $this->onlycurrentfield
= $onlycurrentfield;
791 protected function buildUFC(UserFilterBuilder
&$ufb)
793 if ($ufb->isOn($this->onlycurrentfield
)) {
794 $flags = UFC_Address
::FLAG_CURRENT
;
796 $flags = UFC_Address
::FLAG_ANY
;
799 return new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_ADMAREA
, UFC_Address
::TYPE_ANY
, $flags);
804 // {{{ class UFBF_JobCompany
805 class UFBF_JobCompany
extends UFBF_Text
807 private $onlymentorfield;
809 public function __construct($envfield, $formtext = '', $onlymentorfield = 'only_referent')
811 parent
::__construct($envfield, $formtext);
812 $this->onlymentorfield
= $onlymentorfield;
815 public function check(UserFilterBuilder
&$ufb) {
816 if (parent
::check($ufb)) {
817 # No company check for mentors
818 if ($ufb->isOn($this->onlymentorfield
)) {
827 protected function buildUFC(UserFilterBuilder
&$ufb)
829 return new UFC_Job_Company(UFC_Job_Company
::JOBNAME
, $this->val
);
834 // {{{ class UFBF_JobSector
835 class UFBF_JobSector
extends UFBF_Mixed
837 protected $direnum = DirEnum
::SECTORS
;
838 private $onlymentorfield;
840 public function __construct($envfieldtext, $envfieldindex, $formtext = '', $onlymentorfield = 'only_referent')
842 parent
::__construct($envfieldtext, $envfieldindex, $formtext);
843 $this->onlymentorfield
= $onlymentorfield;
846 protected function buildUFC(UserFilterBuilder
&$ufb)
848 if ($ufb->isOn($this->onlymentorfield
)) {
849 return new UFC_Mentor_Sectorization($this->val
, UserFilter
::JOB_SUBSECTOR
);
851 return new UFC_Job_Sectorization($this->val
, UserFilter
::JOB_SUBSUBSECTOR
);
857 // {{{ class UFBF_JobTerms
858 class UFBF_JobTerms
extends UFBF_Index
860 protected function buildUFC(UserFilterBuilder
&$ufb)
862 return new UFC_Job_Terms($this->val
);
867 // {{{ class UFBF_JobDescription
868 class UFBF_JobDescription
extends UFBF_Text
870 private $onlymentorfield;
872 public function __construct($envfield, $formtext = '', $onlymentorfield = 'only_referent')
874 parent
::__construct($envfield, $formtext);
875 $this->onlymentorfield
= $onlymentorfield;
878 protected function buildUFC(UserFilterBuilder
&$ufb)
880 if ($ufb->isOn($this->onlymentorfield
)) {
881 return new UFC_Mentor_Expertise($this->val
);
883 return new UFC_Job_Description($this->val
, UserFilter
::JOB_USERDEFINED
);
889 // {{{ class UFBF_JobCv
890 class UFBF_JobCv
extends UFBF_Text
892 private $onlymentorfield;
894 public function __construct($envfield, $formtext = '', $onlymentorfield = 'only_referent')
896 parent
::__construct($envfield, $formtext);
897 $this->onlymentorfield
= $onlymentorfield;
900 protected function buildUFC(UserFilterBuilder
&$ufb)
902 if ($ufb->isOn($this->onlymentorfield
)) {
903 return new UFC_Mentor_Expertise($this->val
);
905 return new UFC_Job_Description($this->val
, UserFilter
::JOB_CV
);
911 // {{{ class UFBF_Nationality
912 class UFBF_Nationality
extends UFBF_Mixed
914 protected $direnum = DirEnum
::NATIONALITIES
;
916 protected function buildUFC(UserFilterBuilder
&$ufb)
918 return new UFC_Nationality($this->val
);
923 // {{{ class UFBF_Binet
924 class UFBF_Binet
extends UFBF_Mixed
926 protected $direnum = DirEnum
::BINETS
;
928 protected function buildUFC(UserFilterBuilder
&$ufb)
930 return new UFC_Binet($this->val
);
935 // {{{ class UFBF_Group
936 class UFBF_Group
extends UFBF_Mixed
938 protected $direnum = DirEnum
::GROUPESX
;
940 protected function buildUFC(UserFilterBuilder
&$ufb)
942 if (count($this->val
) == 1) {
943 return new UFC_Group($this->val
[0]);
947 foreach ($this->val
as $grp) {
948 $or->addChild(new UFC_Group($grp));
955 // {{{ class UFBF_Section
956 class UFBF_Section
extends UFBF_Index
958 protected $direnum = DirEnum
::SECTIONS
;
960 protected function buildUFC(UserFilterBuilder
&$ufb)
962 return new UFC_Section($this->val
);
967 // {{{ class UFBF_EducationSchool
968 class UFBF_EducationSchool
extends UFBF_Mixed
970 protected $direnum = DirEnum
::EDUSCHOOLS
;
972 protected function buildUFC(UserFilterBuilder
&$ufb)
974 return new UFC_EducationSchool($this->val
);
979 // {{{ class UFBF_EducationDegree
980 class UFBF_EducationDegree
extends UFBF_Mixed
982 protected $direnum = DirEnum
::EDUDEGREES
;
984 protected function buildUFC(UserFilterBuilder
&$ufb)
986 return new UFC_EducationDegree($this->val
);
991 // {{{ class UFBF_EducationField
992 class UFBF_EducationField
extends UFBF_Mixed
994 protected $direnum = DirEnum
::EDUFIELDS
;
996 protected function buildUFC(UserFilterBuilder
&$ufb)
998 return new UFC_EducationField($this->val
);
1003 // {{{ class UFBF_Comment
1004 class UFBF_Comment
extends UFBF_Text
1006 protected function buildUFC(UserFilterBuilder
&$ufb)
1008 return new UFC_Comment($this->val
);
1013 // {{{ class UFBF_Phone
1014 class UFBF_Phone
extends UFBF_Text
1016 protected function buildUFC(UserFilterBuilder
&$ufb)
1018 return new UFC_Phone($this->val
);
1023 // {{{ class UFBF_Networking
1024 class UFBF_Networking
extends UFBF_Text
1026 private $networktypefield;
1029 public function __construct($envfield, $networktypefield, $formtext = '')
1031 parent
::__construct($envfield, $formtext);
1032 $this->networktypefield
= $networktypefield;
1035 public function check(UserFilterBuilder
&$ufb)
1037 if (parent
::check($ufb)) {
1038 $this->nwtype
= $ufb->i($this->networktypefield
);
1045 public function buildUFC(UserFilterBuilder
&$ufb)
1047 return new UFC_Networking($this->nwtype
, $this->val
);
1052 // {{{ class UFBF_MentorCountry
1053 class UFBF_MentorCountry
extends UFBF_Text
1055 protected function buildUFC(UserFilterBuilder
&$ufb)
1057 return new UFC_Mentor_Country($this->val
);
1062 // {{{ class UFBF_Mentorterm
1063 class UFBF_MentorTerm
extends UFBF_Index
1065 protected function buildUFC(UserFilterBuilder
&$ufb)
1067 return new UFC_Mentor_Terms($this->val
);
1072 // {{{ class UFBF_MentorSectorization
1073 class UFBF_MentorSectorization
extends UFBF_Index
1077 public function __construct($envfield, $formtext = '', $type = UFC_Mentor_Sectorization
::SECTOR
)
1079 parent
::__construct($envfield, $formtext);
1080 $this->type
= $type;
1083 protected function buildUFC(UserFilterBuilder
&$ufb)
1085 return new UFC_Mentor_Sectorization($this->val
, $this->type
);
1090 // {{{ class UFBF_MentorExpertise
1091 class UFBF_MentorExpertise
extends UFBF_Text
1093 protected function buildUFC(UserFilterBuilder
&$ufb)
1095 return new UFC_Mentor_Expertise($this->val
);
1100 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: