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 isOn($key)
145 return $this->has($key) && $this->t($key) == 'on';
150 // {{{ class UFB_QuickSearch
151 class UFB_QuickSearch
extends UserFilterBuilder
153 public function __construct($envprefix = '')
156 new UFBF_Quick('quick', 'Recherche rapide'),
158 parent
::__construct($fields, $envprefix);
163 // {{{ class UFB_AdvancedSearch
164 class UFB_AdvancedSearch
extends UserFilterBuilder
166 public function __construct($envprefix = '')
169 new UFBF_Name('name', 'Nom'),
170 new UFBF_Promo('promo1', 'Promotion', 'egal1'),
171 new UFBF_Promo('promo2', 'Promotion', 'egal2'),
172 new UFBF_Sex('woman', 'Sexe'),
173 new UFBF_Registered('subscriber', 'Inscrit'),
174 new UFBF_Dead('alive', 'En vie'),
176 new UFBF_Town('city', 'Ville / Code Postal'),
177 new UFBF_Country('countryTxt', 'country', 'Pays'),
178 new UFBF_AdminArea('region', 'Région'),
180 new UFBF_JobCompany('entreprise', 'Entreprise'),
181 new UFBF_JobSector('sector', 'Poste'),
182 new UFBF_JobDescription('jobdescription', 'Fonction'),
183 new UFBF_JobCv('cv', 'CV'),
185 new UFBF_Nationality('nationaliteTxt', 'nationalite', 'Nationalité'),
186 new UFBF_Binet('binetTxt', 'binet', 'Binet'),
187 new UFBF_Group('groupexTxt', 'groupex', 'Groupe X'),
188 new UFBF_Section('sectionTxt', 'section', 'Section'),
190 new UFBF_EducationSchool('schoolTxt', 'school', "École d'application"),
191 new UFBF_EducationDegree('diplomaTxt', 'diploma', 'Diplôme'),
192 new UFBF_EducationField('fieldTxt', 'field', "Domaine d'études"),
194 new UFBF_Comment('free', 'Commentaire'),
195 new UFBF_Phone('phone_number', 'Téléphone'),
196 new UFBF_Networking('networking_address', 'networking_type', 'Networking et sites webs'),
198 parent
::__construct($fields, $envprefix);
203 // {{{ class UFB_MentorSearch
204 class UFB_MentorSearch
extends UserFilterBuilder
206 public function __construct($envprefix = '')
209 new UFBF_MentorCountry('pays_sel'),
210 new UFBF_MentorSectorization('sector', '', UFC_Mentor_Sectorization
::SECTOR
),
211 new UFBF_MentorSectorization('subSector', '', UFC_Mentor_Sectorization
::SUBSECTOR
),
212 new UFBF_MentorExpertise('expertise'),
214 parent
::__construct($fields, $envprefix);
219 // {{{ class UFB_Field
220 abstract class UFB_Field
225 protected $empty = false
;
226 protected $val = null
;
229 * @param $envfield Name of the field in the environment
230 * @param $formtext User-friendly name of that field
232 public function __construct($envfield, $formtext = '')
234 $this->envfield
= $envfield;
235 if ($formtext != '') {
236 $this->formtext
= $formtext;
238 $formtext = ucfirst($envfield);
242 /** Prints the given error message to the user, and returns false
243 * in order to be used as return $this->raise('ERROR');
245 * All %s in the $msg will be replaced with the formtext.
247 protected function raise($msg)
249 Platal
::page()->trigError(str_replace('%s', $this->formtext
, $msg));
253 public function apply(UserFilterBuilder
&$ufb) {
254 if (!$this->check($ufb)) {
259 $ufc = $this->buildUFC($ufb);
267 public function isEmpty()
272 /** Create the UFC associated to the field; won't be called
273 * if the field is "empty"
274 * @param &$ufb UFB to which fields must be added
277 abstract protected function buildUFC(UserFilterBuilder
&$ufb);
279 /** This function is intended to run consistency checks on the value
280 * @return boolean Whether the input is valid
282 abstract protected function check(UserFilterBuilder
&$ufb);
286 // {{{ class UFBF_Text
287 abstract class UFBF_Text
extends UFB_Field
292 public function __construct($envfield, $formtext = '', $minlength = 2, $maxlength = 255)
294 parent
::__construct($envfield, $formtext);
295 $this->minlength
= $minlength;
296 $this->maxlength
= $maxlength;
299 protected function check(UserFilterBuilder
&$ufb)
301 if ($ufb->blank($this->envfield
)) {
306 $this->val
= $ufb->t($this->envfield
);
307 if (strlen($this->val
) < $this->minlength
) {
308 return $this->raise("Le champ %s est trop court (minimum {$this->minlength}).");
309 } else if (strlen($this->val
) > $this->maxlength
) {
310 return $this->raise("Le champ %s est trop long (maximum {$this->maxlength}).");
311 } else if (preg_match(":[\]\[<>{}~/§_`|%$^=+]|\*\*:u", $this->val
)) {
312 return $this->raise('Le champ %s contient un caractère interdit rendant la recherche impossible.');
320 // {{{ class UFBF_Range
321 /** Subclass to use for fields which only allow integers within a range
323 abstract class UFBF_Range
extends UFB_Field
329 public function __construct($envfield, $formtext = '', $min = 0, $max = 65535)
331 parent
::__construct($envfield, $formtext);
336 protected function check(UserFilterBuilder
&$ufb)
338 if ($ufb->blank($this->envfield
)) {
343 $this->val
= $ufb->i($this->envfield
);
344 if ($this->val
< $this->min
) {
345 return $this->raise("Le champs %s est inférieur au minimum ({$this->min}).");
346 } else if ($this->val
> $this->max
) {
347 return $this->raise("Le champ %s est supérieur au maximum ({$this->max}).");
354 // {{{ class UFBF_Index
355 /** Subclass to use for indexed fields
357 abstract class UFBF_Index
extends UFB_Field
359 protected function check(UserFilterBuilder
&$ufb)
361 if ($ufb->blank($this->envfield
)) {
364 $this->val
= $ufb->i($this->envfield
);
370 // {{{ class UFBF_Enum
371 /** Subclass to use for fields whose value must belong to a specific set of values
373 abstract class UFBF_Enum
extends UFB_Field
375 protected $allowedvalues;
377 public function __construct($envfield, $formtext = '', $allowedvalues = array(), $strict = false
)
379 parent
::__construct($envfield, $formtext);
380 $this->allowedvalues
= $allowedvalues;
381 $this->strict
= $strict;
384 protected function check(UserFilterBuilder
&$ufb)
386 if ($ufb->blank($this->envfield
)) {
391 $this->val
= $ufb->v($this->envfield
);
392 if (! in_array($this->val
, $this->allowedvalues
)) {
394 return $this->raise("La valeur {$this->val} n'est pas valide pour le champ %s.");
404 // {{{ class UFBF_Bool
405 abstract class UFBF_Bool
extends UFB_Field
407 protected function check(UserFilterBuilder
&$ufb)
409 if ($ufb->blank($this->envfield
)) {
414 $this->val
= $ufb->b($this->envfield
);
420 // {{{ class UFBF_Mixed
421 /** A class for building UFBFs when the user can input either a text or an ID
423 abstract class UFBF_Mixed
extends UFB_Field
425 /** Name of the DirEnum on which class is based
429 protected $envfieldindex;
431 public function __construct($envfieldtext, $envfieldindex, $formtext = '')
433 parent
::__construct($envfieldtext, $formtext);
434 $this->envfieldindex
= $envfieldindex;
437 protected function check(UserFilterBuilder
&$ufb)
439 if ($ufb->blank($this->envfieldindex
) && $ufb->blank($this->envfield
)) {
444 if (!$ufb->blank($this->envfieldindex
)) {
445 $index = $ufb->v($this->envfieldindex
);
446 if (is_int($index)) {
447 $index = intval($index);
449 $index = strtoupper($index);
451 $this->val
= array($index);
453 $indexes = DirEnum
::getIDs($this->direnum
, $ufb->t($this->envfield
),
454 $ufb->b('exact') ? XDB
::WILDCARD_EXACT
: XDB
::WILDCARD_CONTAINS
);
455 if (count($indexes) == 0) {
458 $this->val
= $indexes;
465 // {{{ class UFBF_Quick
466 class UFBF_Quick
extends UFB_Field
468 protected function check(UserFilterBuilder
&$ufb)
470 if ($ufb->blank($this->envfield
)) {
475 $this->val
= str_replace('*', '%', replace_accent($ufb->t($this->envfield
)));
480 protected function buildUFC(UserFilterBuilder
&$ufb)
483 $r = $s = $this->val
;
487 if (S
::admin() && strpos($s, '@') !== false
) {
488 return new UFC_Email($s);
489 } else if (S
::admin() && preg_match('/[0-9]+\.([0-9]+|%)\.([0-9]+|%)\.([0-9]+|%)/', $s)) {
490 $this->conds
->addChild(new UFC_Ip($s));
494 $conds = new PFC_And();
498 $s = preg_replace('!\d+!', ' ', $s);
499 $strings = preg_split("![^a-zA-Z%]+!",$s, -1, PREG_SPLIT_NO_EMPTY
);
500 if (count($strings) > 5) {
501 Platal
::page()->trigWarning("Tu as indiqué trop d'éléments dans ta recherche, seuls les 5 premiers seront pris en compte");
502 $strings = array_slice($strings, 0, 5);
505 if (count($strings)) {
509 $flags = array('public');
511 if ($ufb->b('with_soundex')) {
514 foreach ($strings as $string) {
515 $st[] = soundex_fr($string);
521 $exact =$ufb->b('exact');
522 $conds->addChild(new UFC_NameTokens($st, $flags, $soundex, $exact));
524 $ufb->addOrder(new UFO_Score());
529 $s = preg_replace('! *- *!', '-', $r);
530 $s = preg_replace('!([<>]) *!', ' \1', $s);
531 $s = preg_replace('![^0-9\-><]!', ' ', $s);
532 $s = preg_replace('![<>\-] !', '', $s);
533 $ranges = preg_split('! +!', $s, -1, PREG_SPLIT_NO_EMPTY
);
534 foreach ($ranges as $r) {
535 if (preg_match('!^\d{4}$!', $r)) {
536 $conds->addChild(new UFC_Promo('=', UserFilter
::DISPLAY
, 'X' . $r));
537 } elseif (preg_match('!^(\d{4})-(\d{4})$!', $r, $matches)) {
538 $p1=min(intval($matches[1]), intval($matches[2]));
539 $p2=max(intval($matches[1]), intval($matches[2]));
540 $conds->addChild(new PFC_And(
541 new UFC_Promo('>=', UserFilter
::DISPLAY
, 'X' . $p1),
542 new UFC_Promo('<=', UserFilter
::DISPLAY
, 'X' . $p2)
544 } elseif (preg_match('!^<(\d{4})!', $r, $matches)) {
545 $conds->addChild(new UFC_Promo('<=', UserFilter
::DISPLAY
, 'X' . $matches[1]));
546 } elseif (preg_match('!^>(\d{4})!', $r, $matches)) {
547 $conds->addChild(new UFC_Promo('>=', UserFilter
::DISPLAY
, 'X' . $matches[1]));
553 $t = preg_replace('!(\d{4}-\d{4}|>\d{4}|<\d{4})!', '', $s);
554 $t = preg_replace('![<>\- ]!', '', $t);
555 if (strlen($t) > 4) {
556 $conds->addChild(new UFC_Phone($t));
564 // {{{ class UFBF_Name
565 class UFBF_Name
extends UFBF_Text
567 protected function check(UserFilterBuilder
&$ufb)
569 if (!parent
::check($ufb)) {
573 $this->val
= preg_split('/[[:space:]]/', $this->val
);
574 if (count($this->val
) == 0) {
580 protected function buildUFC(UserFilterBuilder
&$ufb)
582 return new UFC_NameTokens($this->val
, array(), $ufb->b('with_soundex'), $ufb->b('exact'));
587 // {{{ class UFBF_Promo
588 class UFBF_Promo
extends UFB_Field
590 private static $validcomps = array('<', '<=', '=', '>=', '>');
592 private $envfieldcomp;
594 public function __construct($envfield, $fromtext = '', $envfieldcomp)
596 parent
::__construct($envfield, $fromtext);
597 $this->envfieldcomp
= $envfieldcomp;
600 protected function check(UserFilterBuilder
&$ufb)
602 if ($ufb->blank($this->envfield
) ||
$ufb->blank($this->envfieldcomp
)) {
607 $this->val
= $ubf->i($this->envfield
);
608 $this->comp
= $ubf->v($this->envfieldcomp
);
610 if (!in_array($this->comp
, self
::$validcomps)) {
611 return $this->raise("Le critère {$this->comp} n'est pas valide pour le champ %s");
614 if (preg_match('/^[0-9]{2}$/', $this->val
)) {
617 if ($this->val
< 1900 ||
$this->val
> 9999) {
618 return $this->raise("Le champ %s doit être une année à 4 chiffres.");
623 protected function buildUFC(UserFilterBuilder
&$ufb) {
624 return new UFC_Promo($this->comp
, UserFilter
::DISPLAY
, 'X' . $this->val
);
629 // {{{ class UFBF_Sex
630 class UFBF_Sex
extends UFBF_Enum
632 public function __construct($envfield, $formtext = '')
634 parent
::__construct($envfield, $formtext, array(1, 2));
637 private static function getVal($id)
641 return User
::GENDER_MALE
;
644 return User
::GENDER_FEMALE
;
649 protected function buildUFC(UserFilterBuilder
&$ufb)
651 return new UFC_Sex(self
::getVal($this->val
));
656 // {{{ class UFBF_Registered
657 class UFBF_Registered
extends UFBF_Enum
659 public function __construct($envfield, $formtext = '')
661 parent
::__construct($envfield, $formtext, array(1, 2));
664 protected function buildUFC(UserFilterBuilder
&$ufb)
666 if ($this->val
== 1) {
667 return new UFC_Registered();
668 } else if ($this->val
== 2) {
669 return new PFC_Not(UFC_Registered());
675 // {{{ class UFBF_Dead
676 class UFBF_Dead
extends UFBF_Enum
678 public function __construct($envfield, $formtext = '')
680 parent
::__construct($envfield, $formtext, array(1, 2));
683 protected function buildUFC(UserFilterBuilder
&$ufb)
685 if ($this->val
== 1) {
686 return new PFC_Not(UFC_Dead());
687 } else if ($this->val
== 2) {
688 return new UFC_Dead();
694 // {{{ class UFBF_Town
695 /** Retrieves a town, either from a postal code or a town name
697 class UFBF_Town
extends UFBF_Text
704 private $onlycurrentfield;
706 public function __construct($envfield, $formtext = '', $type = self
::TYPE_ANY
, $onlycurrentfield = 'only_current')
709 $this->onlycurrentfield
= $onlycurrentfield;
710 parent
::__construct($envfield, $formtext, 2, 30);
713 protected function buildUFC(UserFilterBuilder
&$ufb)
715 if ($ufb->isOn($this->onlycurrentfield
)) {
716 $flags = UFC_Address
::FLAG_CURRENT
;
718 $flags = UFC_Address
::FLAG_ANY
;
721 if (preg_match('/[0-9]/', $this->val
)) {
722 if ($this->type
& self
::TYPE_ZIP
) {
723 return new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_ZIPCODE
, UFC_Address
::TYPE_ANY
, $flags);
725 return new PFC_False();
728 $byname = new UFC_AddressText(null
, UFC_Address
::CONTAINS
, UFC_Address
::TYPE_ANY
, $flags, null
, $this->val
);
729 $byzip = new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_ZIPCODE
, UFC_Address
::TYPE_ANY
, $flags);
730 if ($this->type
& self
::TYPE_ANY
) {
731 return new PFC_Or($byname, $byzip);
732 } else if ($this->type
& self
::TYPE_TEXT
) {
742 // {{{ class UFBF_Country
743 class UFBF_Country
extends UFBF_Mixed
745 protected $direnum = DirEnum
::COUNTRIES
;
746 protected $onlycurrentfield;
748 public function __construct($envfieldtext, $envfieldindex, $formtext = '', $onlycurrentfield = 'only_current')
750 parent
::__construct($envfieldtext, $envfieldindex, $formtext);
751 $this->onlycurrentfield
= $onlycurrentfield;
754 protected function buildUFC(UserFilterBuilder
&$ufb)
756 if ($ufb->isOn($this->onlycurrentfield
)) {
757 $flags = UFC_Address
::FLAG_CURRENT
;
759 $flags = UFC_Address
::FLAG_ANY
;
762 return new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_COUNTRY
, UFC_Address
::TYPE_ANY
, $flags);
767 // {{{ class UFBF_AdminArea
768 class UFBF_AdminArea
extends UFBF_Mixed
770 protected $direnum = DirEnum
::ADMINAREAS
;
771 protected $onlycurrentfield;
773 public function __construct($envfieldtext, $envfieldindex, $formtext = '', $onlycurrentfield = 'only_current')
775 parent
::__construct($envfieldtext, $envfieldindex, $formtext);
776 $this->onlycurrentfield
= $onlycurrentfield;
780 protected function buildUFC(UserFilterBuilder
&$ufb)
782 if ($ufb->isOn($this->onlycurrentfield
)) {
783 $flags = UFC_Address
::FLAG_CURRENT
;
785 $flags = UFC_Address
::FLAG_ANY
;
788 return new UFC_AddressField($this->val
, UFC_AddressField
::FIELD_ADMAREA
, UFC_Address
::TYPE_ANY
, $flags);
793 // {{{ class UFBF_JobCompany
794 class UFBF_JobCompany
extends UFBF_Text
796 private $onlymentorfield;
798 public function __construct($envfield, $formtext = '', $onlymentorfield = 'only_referent')
800 parent
::__construct($envfield, $formtext);
801 $this->onlymentorfield
= $onlymentorfield;
804 public function check(UserFilterBuilder
&$ufb) {
805 if (parent
::check($ufb)) {
806 # No company check for mentors
807 if ($ufb->isOn($this->onlymentorfield
)) {
816 protected function buildUFC(UserFilterBuilder
&$ufb)
818 return new UFC_Job_Company(UFC_Job_Company
::JOBNAME
, $this->val
);
823 // {{{ class UFBF_JobSector
824 class UFBF_JobSector
extends UFBF_Mixed
826 protected $direnum = DirEnum
::SECTORS
;
827 private $onlymentorfield;
829 public function __construct($envfieldtext, $envfieldindex, $formtext = '', $onlymentorfield = 'only_referent')
831 parent
::__construct($envfieldtext, $envfieldindex, $formtext);
832 $this->onlymentorfield
= $onlymentorfield;
835 protected function buildUFC(UserFilterBuilder
&$ufb)
837 if ($ufb->isOn($this->onlymentorfield
)) {
838 return new UFC_Mentor_Sectorization($this->val
, UserFilter
::JOB_SUBSECTOR
);
840 return new UFC_Job_Sectorization($this->val
, UserFilter
::JOB_SUBSUBSECTOR
);
846 // {{{ class UFBF_JobDescription
847 class UFBF_JobDescription
extends UFBF_Text
849 private $onlymentorfield;
851 public function __construct($envfield, $formtext = '', $onlymentorfield = 'only_referent')
853 parent
::__construct($envfield, $formtext);
854 $this->onlymentorfield
= $onlymentorfield;
857 protected function buildUFC(UserFilterBuilder
&$ufb)
859 if ($ufb->isOn($this->onlymentorfield
)) {
860 return new UFC_Mentor_Expertise($this->val
);
862 return new UFC_Job_Description($this->val
, UserFilter
::JOB_USERDEFINED
);
868 // {{{ class UFBF_JobCv
869 class UFBF_JobCv
extends UFBF_Text
871 private $onlymentorfield;
873 public function __construct($envfield, $formtext = '', $onlymentorfield = 'only_referent')
875 parent
::__construct($envfield, $formtext);
876 $this->onlymentorfield
= $onlymentorfield;
879 protected function buildUFC(UserFilterBuilder
&$ufb)
881 if ($ufb->isOn($this->onlymentorfield
)) {
882 return new UFC_Mentor_Expertise($this->val
);
884 return new UFC_Job_Description($this->val
, UserFilter
::JOB_CV
);
890 // {{{ class UFBF_Nationality
891 class UFBF_Nationality
extends UFBF_Mixed
893 protected $direnum = DirEnum
::NATIONALITIES
;
895 protected function buildUFC(UserFilterBuilder
&$ufb)
897 return new UFC_Nationality($this->val
);
902 // {{{ class UFBF_Binet
903 class UFBF_Binet
extends UFBF_Mixed
905 protected $direnum = DirEnum
::BINETS
;
907 protected function buildUFC(UserFilterBuilder
&$ufb)
909 return new UFC_Binet($this->val
);
914 // {{{ class UFBF_Group
915 class UFBF_Group
extends UFBF_Mixed
917 protected $direnum = DirEnum
::GROUPESX
;
919 protected function buildUFC(UserFilterBuilder
&$ufb)
921 if (count($this->val
) == 1) {
922 return new UFC_Group($this->val
[0]);
926 foreach ($this->val
as $grp) {
927 $or->addChild(new UFC_Group($grp));
934 // {{{ class UFBF_Section
935 class UFBF_Section
extends UFBF_Index
937 protected $direnum = DirEnum
::SECTIONS
;
939 protected function buildUFC(UserFilterBuilder
&$ufb)
941 return new UFC_Section($this->val
);
946 // {{{ class UFBF_EducationSchool
947 class UFBF_EducationSchool
extends UFBF_Mixed
949 protected $direnum = DirEnum
::EDUSCHOOLS
;
951 protected function buildUFC(UserFilterBuilder
&$ufb)
953 return new UFC_EducationSchool($this->val
);
958 // {{{ class UFBF_EducationDegree
959 class UFBF_EducationDegree
extends UFBF_Mixed
961 protected $direnum = DirEnum
::EDUDEGREES
;
963 protected function buildUFC(UserFilterBuilder
&$ufb)
965 return new UFC_EducationDegree($this->val
);
970 // {{{ class UFBF_EducationField
971 class UFBF_EducationField
extends UFBF_Mixed
973 protected $direnum = DirEnum
::EDUFIELDS
;
975 protected function buildUFC(UserFilterBuilder
&$ufb)
977 return new UFC_EducationField($this->val
);
982 // {{{ class UFBF_Comment
983 class UFBF_Comment
extends UFBF_Text
985 protected function buildUFC(UserFilterBuilder
&$ufb)
987 return new UFC_Comment($this->val
);
992 // {{{ class UFBF_Phone
993 class UFBF_Phone
extends UFBF_Text
995 protected function buildUFC(UserFilterBuilder
&$ufb)
997 return new UFC_Phone($this->val
);
1002 // {{{ class UFBF_Networking
1003 class UFBF_Networking
extends UFBF_Text
1005 private $networktypefield;
1008 public function __construct($envfield, $networktypefield, $formtext = '')
1010 parent
::__construct($envfield, $formtext);
1011 $this->networktypefield
= $networktypefield;
1014 public function check(UserFilterBuilder
&$ufb)
1016 if (parent
::check($ufb)) {
1017 $this->nwtype
= $ufb->i($this->networktypefield
);
1024 public function buildUFC(UserFilterBuilder
&$ufb)
1026 return new UFC_Networking($this->nwtype
, $this->val
);
1031 // {{{ class UFBF_MentorCountry
1032 class UFBF_MentorCountry
extends UFBF_Index
1034 protected function buildUFC(UserFilterBuilder
&$ufb)
1036 return new UFC_Mentor_Country($this->val
);
1041 // {{{ class UFBF_MentorSectorization
1042 class UFBF_MentorSectorization
extends UFBF_Index
1046 public function __construct($envfield, $formtext = '', $type = UFC_Mentor_Sectorization
::SECTOR
)
1048 parent
::__construct($envfield, $formtext);
1049 $this->type
= $type;
1052 protected function buildUFC(UserFilterBuilder
&$ufb)
1054 return new UFC_Mentor_Sectorization($this->val
, $this->type
);
1059 // {{{ class UFBF_MentorExpertise
1060 class UFBF_MentorExpertise
extends UFBF_Text
1062 protected function buildUFC(UserFilterBuilder
&$ufb)
1064 return new UFC_Mentor_Expertise($this->val
);
1069 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: