X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fuserset.inc.php;h=92e041aa062d6385f94c00b5441e70d46957f04c;hb=470d14f6148c522e1ee2968cb61140104e7fade0;hp=fb6c5e8940b34295b72fdbd4deab5e5410ce795c;hpb=684195f33b11e3067200dd3a9e14304bd7d04463;p=platal.git diff --git a/include/userset.inc.php b/include/userset.inc.php index fb6c5e8..92e041a 100644 --- a/include/userset.inc.php +++ b/include/userset.inc.php @@ -53,8 +53,6 @@ class SearchSet extends ProfileSet public function __construct($quick = false, $no_search = false, PlFilterCondition $cond = null) { - Platal::load('search', 'search.inc.php'); - if ($no_search) { return; } @@ -93,13 +91,11 @@ class SearchSet extends ProfileSet $this->conds->addChild($ufc); $orders = $ufb->getOrders(); - $orders[] = new UFO_Promo(UserFilter::DISPLAY, true); - $orders[] = new UFO_Name(Profile::DN_SORT); if (S::logged() && Env::has('nonins')) { $this->conds = new PFC_And($this->conds, - new UFC_Not(new UFC_Dead()), - new UFC_Registered() + new PFC_Not(new UFC_Dead()), + new PFC_Not(new UFC_Registered()) ); } @@ -119,21 +115,13 @@ class SearchSet extends ProfileSet $this->conds->addChild($ufb->getUFC()); } - public function &get(PlLimit $limit = null, $orders = array()) + protected function &getFilterResults(PlFilter &$pf, PlLimit $limit) { - $orders = array_merge($orders, $this->orders); - - $uf = $this->buildFilter($this->conds, $orders); - if (is_null($limit)) { - $limit = new PlLimit(20, 0); - } - $it = $uf->getProfiles($limit); - $this->count = $uf->getTotalCount(); - return $it; + return $pf->getProfiles($limit, Profile::FETCH_MINIFICHES); } } -class ArraySet extends UserSet +class ArraySet extends ProfileSet { public function __construct(array $users) { @@ -147,7 +135,26 @@ class ArraySet extends UserSet } } -class MinificheView extends MultipageView +abstract class ProfileView extends MultipageView +{ + protected function getBoundValue($obj) + { + if ($obj instanceof Profile) { + switch ($this->bound_field) { + case 'name': + $name = $obj->name('%l'); + return strtoupper($name); + case 'promo': + return $obj->promo(); + default: + return null; + } + } + return null; + } +} + +class MinificheView extends ProfileView { public function __construct(PlSet &$set, $data, array $params) { @@ -178,22 +185,6 @@ class MinificheView extends MultipageView parent::__construct($set, $data, $params); } - protected function getBoundValue($obj) - { - if ($obj instanceof Profile) { - switch ($this->bound_field) { - case 'name': - $name = $obj->name('%l'); - return strtoupper($name[0]); - case 'promo': - return $obj->promo(); - default: - return null; - } - } - return null; - } - public function bounds() { $order = Env::v('order', $this->defaultkey); @@ -217,7 +208,7 @@ class MinificheView extends MultipageView } } -class MentorView extends MultipageView +class MentorView extends ProfileView { public function __construct(PlSet &$set, $data, array $params) { @@ -236,22 +227,6 @@ class MentorView extends MultipageView parent::__construct($set, $data, $params); } - protected function getBoundValue($obj) - { - if ($obj instanceof Profile) { - switch ($this->bound_field) { - case 'name': - $name = $obj->name('%l'); - return strtoupper($name[0]); - case 'promo': - return $obj->promo(); - default: - return null; - } - } - return null; - } - public function bounds() { $order = Env::v('order', $this->defaultkey); @@ -275,7 +250,7 @@ class MentorView extends MultipageView } } -class TrombiView extends MultipageView +class TrombiView extends ProfileView { public function __construct(PlSet &$set, $data, array $params) { @@ -293,25 +268,10 @@ class TrombiView extends MultipageView new UFO_Promo(UserFilter::DISPLAY, true), new UFO_Name(Profile::DN_SORT), ), 'promotion')); + $set->addCond(new UFC_Photo()); parent::__construct($set, $data, $params); } - protected function getBoundValue($obj) - { - if ($obj instanceof Profile) { - switch ($this->bound_field) { - case 'name': - $name = $obj->name('%l'); - return strtoupper($name[0]); - case 'promo': - return $obj->promo(); - default: - return null; - } - } - return null; - } - public function bounds() { $order = Env::v('order', $this->defaultkey);