new UFBF_AdminArea('region', 'Région'),
new UFBF_JobCompany('entreprise', 'Entreprise'),
- new UFBF_JobSector('sector', 'Poste'),
new UFBF_JobDescription('jobdescription', 'Fonction'),
new UFBF_JobCv('cv', 'CV'),
new UFBF_JobTerms('jobterm', 'Mots-clefs'),
return false;
}
- if (!$this->empty) {
+ if (!$this->isEmpty()) {
$ufc = $this->buildUFC($ufb);
if ($ufc != null) {
$ufb->addCond($ufc);
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.');
}
} else {
$flags = array('public');
}
- if ($ufb->b('with_soundex')) {
- $soundex = true;
- $st = array();
- foreach ($strings as $string) {
- $st[] = soundex_fr($string);
- }
- } else {
- $soundex = false;
- $st = $strings;
- }
$exact =$ufb->b('exact');
- $conds->addChild(new UFC_NameTokens($st, $flags, $soundex, $exact));
+ $conds->addChild(new UFC_NameTokens($strings, $flags, $ufb->b('with_soundex'), $exact));
$ufb->addOrder(new UFO_Score());
}
// }}}
// {{{ class UFBF_AdminArea
-class UFBF_AdminArea extends UFBF_Mixed
+class UFBF_AdminArea extends UFBF_Index
{
protected $direnum = DirEnum::ADMINAREAS;
protected $onlycurrentfield;
- public function __construct($envfieldtext, $envfieldindex, $formtext = '', $onlycurrentfield = 'only_current')
+ public function __construct($envfield, $formtext = '', $onlycurrentfield = 'only_current')
{
- parent::__construct($envfieldtext, $envfieldindex, $formtext);
+ parent::__construct($envfield, $formtext);
$this->onlycurrentfield = $onlycurrentfield;
}
}
// }}}
-// {{{ class UFBF_JobSector
-class UFBF_JobSector extends UFBF_Mixed
-{
- protected $direnum = DirEnum::SECTORS;
- private $onlymentorfield;
-
- public function __construct($envfieldtext, $envfieldindex, $formtext = '', $onlymentorfield = 'only_referent')
- {
- parent::__construct($envfieldtext, $envfieldindex, $formtext);
- $this->onlymentorfield = $onlymentorfield;
- }
-
- protected function buildUFC(UserFilterBuilder &$ufb)
- {
- if ($ufb->isOn($this->onlymentorfield)) {
- return new UFC_Mentor_Sectorization($this->val, UserFilter::JOB_SUBSECTOR);
- } else {
- return new UFC_Job_Sectorization($this->val, UserFilter::JOB_SUBSUBSECTOR);
- }
- }
-}
-// }}}
-
// {{{ class UFBF_JobTerms
class UFBF_JobTerms extends UFBF_Index
{
// }}}
// {{{ class UFBF_Section
-class UFBF_Section extends UFBF_Index
+class UFBF_Section extends UFBF_Mixed
{
protected $direnum = DirEnum::SECTIONS;
}
}
+ public function isEmpty()
+ {
+ return parent::isEmpty() || $this->nwtype == 0;
+ }
+
public function buildUFC(UserFilterBuilder &$ufb)
{
return new UFC_Networking($this->nwtype, $this->val);
}
// }}}
-// {{{ class UFBF_MentorSectorization
-class UFBF_MentorSectorization extends UFBF_Index
-{
- protected $type;
-
- public function __construct($envfield, $formtext = '', $type = UFC_Mentor_Sectorization::SECTOR)
- {
- parent::__construct($envfield, $formtext);
- $this->type = $type;
- }
-
- protected function buildUFC(UserFilterBuilder &$ufb)
- {
- return new UFC_Mentor_Sectorization($this->val, $this->type);
- }
-}
-// }}}
-
// {{{ class UFBF_MentorExpertise
class UFBF_MentorExpertise extends UFBF_Text
{