new UFBF_Town('city', 'Ville / Code Postal'),
new UFBF_Country('countryTxt', 'country', 'Pays'),
- new UFBF_AdminArea('region', 'Région'),
+ new UFBF_AdminArea('administrativearea', 'Région'),
+ new UFBF_SubAdminArea('subadministrativearea', 'Département'),
new UFBF_JobCompany('entreprise', 'Entreprise'),
new UFBF_JobDescription('jobdescription', 'Fonction'),
return false;
}
- if (!$this->empty) {
+ if (!$this->isEmpty()) {
$ufc = $this->buildUFC($ufb);
if ($ufc != null) {
$ufb->addCond($ufc);
} 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_SubAdminArea
+class UFBF_SubAdminArea extends UFBF_Index
+{
+ protected $direnum = DirEnum::SUBADMINAREAS;
+ protected $onlycurrentfield;
+
+ public function __construct($envfield, $formtext = '', $onlycurrentfield = 'only_current')
+ {
+ parent::__construct($envfield, $formtext);
+ $this->onlycurrentfield = $onlycurrentfield;
+ }
+
+
+ protected function buildUFC(UserFilterBuilder &$ufb)
+ {
+ if ($ufb->isOn($this->onlycurrentfield)) {
+ $flags = UFC_Address::FLAG_CURRENT;
+ } else {
+ $flags = UFC_Address::FLAG_ANY;
+ }
+
+ return new UFC_AddressField($this->val, UFC_AddressField::FIELD_SUBADMAREA, UFC_Address::TYPE_ANY, $flags);
+ }
+}
+// }}}
+
// {{{ class UFBF_JobCompany
class UFBF_JobCompany extends UFBF_Text
{
// }}}
// {{{ 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);