X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fuserset.inc.php;h=f99faf2ff3a0cd0f679a1ae352c367c56eaab599;hb=956cd5c10a027f75283d91545a5d5feeed1874ef;hp=c648005a4f2a8455901fba48dd9259d0149f8949;hpb=2d89ec936167033886ae76b153605d7ccf19bc20;p=platal.git diff --git a/include/userset.inc.php b/include/userset.inc.php index c648005..f99faf2 100644 --- a/include/userset.inc.php +++ b/include/userset.inc.php @@ -1,6 +1,6 @@ quick = $quick; - if (is_null($cond)) { $conds = new PFC_And(); } else if ($cond instanceof PFC_And) { @@ -68,30 +62,6 @@ class SearchSet extends ProfileSet $conds = new PFC_And($cond); } - if ($quick) { - $this->getQuick($conds); - } else { - $this->getAdvanced($conds); - } - } - - public function isValid() - { - return $this->valid; - } - - /** Sets up the conditions for a Quick Search - * @param $conds Additional conds (as a PFC_And) - */ - private function getQuick($conds) - { - if (!S::logged()) { - Env::kill('with_soundex'); - } - - require_once 'ufbuilder.inc.php'; - $ufb = new UFB_QuickSearch(); - if (!$ufb->isValid()) { $this->valid = false; return; @@ -102,36 +72,12 @@ class SearchSet extends ProfileSet $orders = $ufb->getOrders(); - if (S::logged() && Env::has('nonins')) { - $conds = new PFC_And($conds, - new PFC_Not(new UFC_Dead()), - new PFC_Not(new UFC_Registered()) - ); - } - parent::__construct($conds, $orders); } - /** Sets up the conditions for an Advanced Search - * @param $conds Additional conds (as a PFC_And) - */ - private function getAdvanced($conds) + public function isValid() { - $this->advanced = true; - require_once 'ufbuilder.inc.php'; - $ufb = new UFB_AdvancedSearch(); - - if (!$ufb->isValid()) { - $this->valid = false; - return; - } - - $ufc = $ufb->getUFC(); - $conds->addChild($ufc); - - $orders = $ufb->getOrders(); - - parent::__construct($conds, $orders); + return $this->valid; } /** Add a "rechercher=Chercher" field to the query to simulate the POST @@ -153,6 +99,30 @@ class SearchSet extends ProfileSet } } +// Specialized SearchSet for quick search. +class QuickSearchSet extends SearchSet +{ + public function __construct(PlFilterCondition $cond = null) + { + if (!S::logged()) { + Env::kill('with_soundex'); + } + + parent::__construct(new UFB_QuickSearch(), $cond); + } +} + +// Specialized SearchSet for advanced search. +class AdvancedSearchSet extends SearchSet +{ + public function __construct($xorg_admin_fields, $ax_admin_fields, + PlFilterCondition $cond = null) + { + parent::__construct(new UFB_AdvancedSearch($xorg_admin_fields, $ax_admin_fields), + $cond); + } +} + /** Simple set based on an array of User objects */ class ArraySet extends ProfileSet @@ -363,7 +333,7 @@ class AddressesView implements PlView { $pids = $this->set->getIds(new PlLimit()); $visibility = new ProfileVisibility(ProfileVisibility::VIS_AX); - pl_content_headers('text/x-csv'); + pl_cached_content_headers('text/x-csv', 1); $csv = fopen('php://output', 'w'); fputcsv($csv, array('adresses'), ';');