From: Raphaël Barrois Date: Thu, 14 Apr 2011 21:04:27 +0000 (+0200) Subject: Update the UFO_Promo and UFO_Name to work cleanly with the new MultiPageView grouping... X-Git-Tag: xorg/1.1.1~76 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=20938467d7476f71dfd454aa87ca967b39dbfdf0;p=platal.git Update the UFO_Promo and UFO_Name to work cleanly with the new MultiPageView grouping features. Signed-off-by: Raphaël Barrois --- diff --git a/classes/userfilter/orders.inc.php b/classes/userfilter/orders.inc.php index f640e00..ad41bb3 100644 --- a/classes/userfilter/orders.inc.php +++ b/classes/userfilter/orders.inc.php @@ -89,6 +89,11 @@ class UFO_Promo extends PlFilterGroupableOrder } } + public function getCondition($promo) + { + return new UFC_Promo(UserFilterCondition::OP_EQUALS, $this->grade, $promo); + } + public function export() { $export = $this->buildExport('promo'); @@ -106,7 +111,7 @@ class UFO_Promo extends PlFilterGroupableOrder * @param $particle Set to true if particles should be included in the sorting order * @param $desc If sort order should be descending */ -class UFO_Name extends PlFilterOrder +class UFO_Name extends PlFilterGroupableOrder { private $type; private $variant; @@ -141,6 +146,28 @@ class UFO_Name extends PlFilterOrder } } + public function getGroupToken(PlFilter $pf) + { + return 'SUBSTRING(' . $this->_tokens . ', 1, 1)'; + } + + public function getCondition($initial) + { + if (Profile::isDisplayName($this->type)) { + switch ($this->type) { + case Profile::DN_PRIVATE: + case Profile::DN_SHORT: + case Profile::DN_YOURSELF: + $type = Profile::FIRSTNAME; + default: + $type = Profile::LASTNAME; + } + } else { + $type = $this->type; + } + return new UFC_Name($type, $initial, UFC_Name::PREFIX); + } + public function export() { $export = $this->buildExport($this->type); diff --git a/core b/core index 36b41c6..852e640 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 36b41c6c79c3a434b7e5b374befb3090105dd3aa +Subproject commit 852e6400e7b7dbc0c0d4c8b4e72ca009954056cb