return $this->valid;
}
+ public function isEmpty()
+ {
+ $this->buildUFC();
+ foreach ($this->fields as $field) {
+ if (! $field->isEmpty()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
/** Returns the built UFC
* @return The UFC, or PFC_False() if an error happened
*/
- public function &getUFC()
+ public function getUFC()
{
$this->buildUFC();
if ($this->valid) {
new UFBF_Group('groupexTxt', 'groupex', 'Groupe X'),
new UFBF_Section('sectionTxt', 'section', 'Section'),
- new UFBF_Formation('schoolTxt', 'school', "École d'application"),
- new UFBF_Diploma('diplomaTxt', 'diploma', 'Diplôme'),
- new UFBF_StudiesDomain('fieldTxt', 'field', "Domaine d'études"),
+ new UFBF_EducationSchool('schoolTxt', 'school', "École d'application"),
+ new UFBF_EducationDegree('diplomaTxt', 'diploma', 'Diplôme'),
+ new UFBF_EducationField('fieldTxt', 'field', "Domaine d'études"),
new UFBF_Comment('free', 'Commentaire'),
new UFBF_Phone('phone_number', 'Téléphone'),
}
// }}}
+// {{{ class UFB_MentorSearch
+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_MentorExpertise('expertise'),
+ );
+ parent::__construct($fields, $envprefix);
+ }
+}
+// }}}
+
// {{{ class UFB_Field
abstract class UFB_Field
{
return true;
}
+ public function isEmpty()
+ {
+ return $this->empty;
+ }
+
/** Create the UFC associated to the field; won't be called
* if the field is "empty"
* @param &$ufb UFB to which fields must be added
if (!$ufb->has($this->envfield)) {
$this->empty = true;
}
+ $this->val = $ufb->i($this->envfield);
return true;
}
}
$this->val = array($index);
} else {
$indexes = DirEnum::getIDs($this->direnum, $ufb->s($this->envfield),
- $ufb->i('exact') ? DirEnumeration::MODE_EXACT : DirEnumeration::MODE_CONTAINS);
+ $ufb->i('exact') ? XDB::WILDCARD_EXACT : XDB::WILDCARD_CONTAINS);
if (count($indexes) == 0) {
return false;
}
if (S::admin() && strpos($s, '@') !== false) {
return new UFC_Email($s);
} else if (S::admin() && preg_match('/[0-9]+\.([0-9]+|%)\.([0-9]+|%)\.([0-9]+|%)/', $s)) {
- // TODO: create UFC_Ip
-// $this->conds->addChild(new UFC_Ip($s));
+ $this->conds->addChild(new UFC_Ip($s));
return;
}
}
// }}}
-// {{{ class UFBF_Formation
-class UFBF_Formation extends UFBF_Mixed
+// {{{ class UFBF_EducationSchool
+class UFBF_EducationSchool extends UFBF_Mixed
{
- protected $direnum = DirEnum::SCHOOLS;
+ protected $direnum = DirEnum::EDUSCHOOLS;
protected function buildUFC(UserFilterBuilder &$ufb)
{
- return new UFC_Formation($this->val);
+ return new UFC_EducationSchool($this->val);
}
}
// }}}
-// {{{ class UFBF_Diploma
-class UFBF_Diploma extends UFBF_Mixed
+// {{{ class UFBF_EducationDegree
+class UFBF_EducationDegree extends UFBF_Mixed
{
- protected $direnum = DirEnum::DEGREES;
+ protected $direnum = DirEnum::EDUDEGREES;
protected function buildUFC(UserFilterBuilder &$ufb)
{
- return new UFC_Diploma($this->val);
+ return new UFC_EducationDegree($this->val);
}
}
// }}}
-// {{{ class UFBF_StudiesDomain
-class UFBF_StudiesDomain extends UFBF_Mixed
+// {{{ class UFBF_EducationField
+class UFBF_EducationField extends UFBF_Mixed
{
- protected $direnum = DirEnum::STUDIESDOMAINS;
+ protected $direnum = DirEnum::EDUFIELDS;
protected function buildUFC(UserFilterBuilder &$ufb)
{
- return new UFC_StudyField($this->val);
+ return new UFC_EducationField($this->val);
}
}
// }}}
}
}
// }}}
+
+// {{{ class UFBF_MentorCountry
+class UFBF_MentorCountry extends UFBF_Index
+{
+ protected function buildUFC(UserFilterBuilder &$ufb)
+ {
+ return new UFC_Mentor_Country($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
+{
+ protected function buildUFC(UserFilterBuilder &$ufb)
+ {
+ return new UFC_Mentor_Expertise($this->val);
+ }
+}
+// }}}
?>