X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fufbuilder.inc.php;h=0e2b8720578d31d98e984e8fa6037d9a0446deb7;hb=e429cd03ff90d7f50f68775245df33403ddcd986;hp=40c5a7465985392f22f016fc7c35147ae715861e;hpb=cecdf74795e71ed038411915dad5e0dff6ea51fa;p=platal.git diff --git a/include/ufbuilder.inc.php b/include/ufbuilder.inc.php index 40c5a74..0e2b872 100644 --- a/include/ufbuilder.inc.php +++ b/include/ufbuilder.inc.php @@ -187,7 +187,8 @@ class UFB_AdvancedSearch extends UserFilterBuilder 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'), @@ -268,7 +269,7 @@ abstract class UFB_Field return false; } - if (!$this->empty) { + if (!$this->isEmpty()) { $ufc = $this->buildUFC($ufb); if ($ufc != null) { $ufb->addCond($ufc); @@ -792,6 +793,32 @@ class UFBF_AdminArea extends UFBF_Index } // }}} +// {{{ 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 { @@ -1010,6 +1037,11 @@ class UFBF_Networking extends UFBF_Text } } + public function isEmpty() + { + return parent::isEmpty() || $this->nwtype == 0; + } + public function buildUFC(UserFilterBuilder &$ufb) { return new UFC_Networking($this->nwtype, $this->val);