From 20938467d7476f71dfd454aa87ca967b39dbfdf0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Thu, 14 Apr 2011 23:04:27 +0200 Subject: [PATCH] Update the UFO_Promo and UFO_Name to work cleanly with the new MultiPageView grouping features. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Barrois --- classes/userfilter/orders.inc.php | 29 ++++++++++++++++++++++++++++- core | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) 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 -- 2.1.4