X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fufbuilder.inc.php;h=09dc307dd242d65d99d33b487764710a42fa4024;hb=0b5aebe16a9eb47158fce84e84d16206d2789f31;hp=4a734b27e06bd08fff859fa11867e733e539ac9a;hpb=853ff307303faf861396c4e22dbaa56114366751;p=platal.git diff --git a/include/ufbuilder.inc.php b/include/ufbuilder.inc.php index 4a734b2..09dc307 100644 --- a/include/ufbuilder.inc.php +++ b/include/ufbuilder.inc.php @@ -140,6 +140,18 @@ class UserFilterBuilder return Env::blank($key, $strict); } + public function hasAlnum($key) + { + $str = $this->s($key); + return preg_match('/[a-z0-9]/i', $str); + } + + public function hasAlpha($key) + { + $str = $this->s($key); + return preg_match('/[a-z]/i', $str); + } + public function isOn($key) { return $this->has($key) && $this->t($key) == 'on'; @@ -181,6 +193,7 @@ class UFB_AdvancedSearch extends UserFilterBuilder new UFBF_JobSector('sector', 'Poste'), new UFBF_JobDescription('jobdescription', 'Fonction'), new UFBF_JobCv('cv', 'CV'), + new UFBF_JobTerms('jobterm', 'Mots-clefs'), new UFBF_Nationality('nationaliteTxt', 'nationalite', 'Nationalité'), new UFBF_Binet('binetTxt', 'binet', 'Binet'), @@ -194,6 +207,8 @@ class UFB_AdvancedSearch extends UserFilterBuilder new UFBF_Comment('free', 'Commentaire'), new UFBF_Phone('phone_number', 'Téléphone'), new UFBF_Networking('networking_address', 'networking_type', 'Networking et sites webs'), + + new UFBF_Mentor('only_referent', 'Référent'), ); parent::__construct($fields, $envprefix); } @@ -206,9 +221,8 @@ class UFB_MentorSearch extends UserFilterBuilder public function __construct($envprefix = '') { $fields = array( - new UFBF_MentorCountry('pays_sel'), - new UFBF_MentorSectorization('sector', '', UFC_Mentor_Sectorization::SECTOR), - new UFBF_MentorSectorization('subSector', '', UFC_Mentor_Sectorization::SUBSECTOR), + new UFBF_MentorCountry('country'), + new UFBF_MentorTerm('jobterm', 'jobtermText'), new UFBF_MentorExpertise('expertise'), ); parent::__construct($fields, $envprefix); @@ -308,7 +322,7 @@ abstract class UFBF_Text extends UFB_Field return $this->raise("Le champ %s est trop court (minimum {$this->minlength})."); } else if (strlen($this->val) > $this->maxlength) { return $this->raise("Le champ %s est trop long (maximum {$this->maxlength})."); - } else if (preg_match(":[\]\[<>{}~/§_`|%$^=+]|\*\*:u", $this->val)) { + } else if (preg_match(":[\]\[<>{}~§_`|%$^=]|\*\*:u", $this->val)) { return $this->raise('Le champ %s contient un caractère interdit rendant la recherche impossible.'); } @@ -436,7 +450,7 @@ abstract class UFBF_Mixed extends UFB_Field protected function check(UserFilterBuilder &$ufb) { - if ($ufb->blank($this->envfieldindex) && $ufb->blank($this->envfield)) { + if ($ufb->blank($this->envfieldindex) && !$ufb->hasAlnum($this->envfield)) { $this->empty = true; return true; } @@ -842,6 +856,16 @@ class UFBF_JobSector extends UFBF_Mixed } // }}} +// {{{ class UFBF_JobTerms +class UFBF_JobTerms extends UFBF_Index +{ + protected function buildUFC(UserFilterBuilder &$ufb) + { + return new UFC_Job_Terms($this->val); + } +} +// }}} + // {{{ class UFBF_JobDescription class UFBF_JobDescription extends UFBF_Text { @@ -1027,8 +1051,18 @@ class UFBF_Networking extends UFBF_Text } // }}} +// {{{ class UFBF_Mentor +class UFBF_Mentor extends UFBF_Bool +{ + protected function buildUFC(UserFilterBuilder &$ufb) + { + return new UFC_Mentor(); + } +} +// }}} + // {{{ class UFBF_MentorCountry -class UFBF_MentorCountry extends UFBF_Index +class UFBF_MentorCountry extends UFBF_Text { protected function buildUFC(UserFilterBuilder &$ufb) { @@ -1037,6 +1071,16 @@ class UFBF_MentorCountry extends UFBF_Index } // }}} +// {{{ class UFBF_Mentorterm +class UFBF_MentorTerm extends UFBF_Index +{ + protected function buildUFC(UserFilterBuilder &$ufb) + { + return new UFC_Mentor_Terms($this->val); + } +} +// }}} + // {{{ class UFBF_MentorSectorization class UFBF_MentorSectorization extends UFBF_Index {