From abcf0f93d7de2eb60b9062195b80ec87820b7fe8 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 12 Mar 2012 23:06:06 +0100 Subject: [PATCH] Fixed user search Fixes #507 --- .../install/files/acp/templates/userSearch.tpl | 7 ++++--- .../files/lib/acp/form/UserSearchForm.class.php | 15 ++++++++++++--- .../files/lib/acp/page/UserListPage.class.php | 2 +- .../lib/system/option/OptionHandler.class.php | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/userSearch.tpl b/wcfsetup/install/files/acp/templates/userSearch.tpl index 9555190383..58ec577b89 100644 --- a/wcfsetup/install/files/acp/templates/userSearch.tpl +++ b/wcfsetup/install/files/acp/templates/userSearch.tpl @@ -184,8 +184,9 @@
{lang}wcf.acp.user.search.display.columns{/lang} - - {if $optionTree|count} + + {* TODO: Do we still want all this columns supported? *} + {*if $optionTree|count}
@@ -204,7 +205,7 @@
- {/if} + {/if*}
diff --git a/wcfsetup/install/files/lib/acp/form/UserSearchForm.class.php b/wcfsetup/install/files/lib/acp/form/UserSearchForm.class.php index 4697385819..0e9b037ccb 100755 --- a/wcfsetup/install/files/lib/acp/form/UserSearchForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserSearchForm.class.php @@ -125,6 +125,12 @@ class UserSearchForm extends UserOptionListForm { */ public $maxResults = 0; + /** + * list of option values + * @var array + */ + public $values = array(); + /** * @see wcf\form\IForm::readFormParameters() */ @@ -142,6 +148,8 @@ class UserSearchForm extends UserOptionListForm { if (isset($_POST['sortField'])) $this->sortField = $_POST['sortField']; if (isset($_POST['sortOrder'])) $this->sortOrder = $_POST['sortOrder']; if (isset($_POST['columns']) && is_array($_POST['columns'])) $this->columns = $_POST['columns']; + + if (isset($_POST['values']) && is_array($_POST['values'])) $this->values = $_POST['values']; } /** @@ -293,10 +301,11 @@ class UserSearchForm extends UserOptionListForm { * Builds the dynamic conditions. */ protected function buildDynamicConditions() { - foreach ($this->optionTree as $option) { + foreach ($this->optionHandler->getCategoryOptions('profile') as $option) { + $option = $option['object']; + $value = isset($this->values[$option->optionName]) ? $this->values[$option->optionName] : null; - $condition = $this->getTypeObject($option->optionType)->getCondition($option, $value); - if ($condition !== false) $this->conditions->add($condition); + $this->optionHandler->getTypeObject($option->optionType)->getCondition($this->conditions, $option->getDecoratedObject(), $value); } } diff --git a/wcfsetup/install/files/lib/acp/page/UserListPage.class.php b/wcfsetup/install/files/lib/acp/page/UserListPage.class.php index 584cf339fc..03524663fc 100755 --- a/wcfsetup/install/files/lib/acp/page/UserListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/UserListPage.class.php @@ -190,7 +190,7 @@ class UserListPage extends SortablePage { $conditions->add("user_table.userID IN (?)", array($userIDs)); $sql = "SELECT userID, groupID - FROM wcf".WCF_N."_user_to_group user_table + FROM wcf".WCF_N."_user_to_group ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); diff --git a/wcfsetup/install/files/lib/system/option/OptionHandler.class.php b/wcfsetup/install/files/lib/system/option/OptionHandler.class.php index 71827b6cf4..79d431d670 100644 --- a/wcfsetup/install/files/lib/system/option/OptionHandler.class.php +++ b/wcfsetup/install/files/lib/system/option/OptionHandler.class.php @@ -324,7 +324,7 @@ class OptionHandler implements IOptionHandler { * @param string $type * @return wcf\system\option\IOptionType */ - protected function getTypeObject($type) { + public function getTypeObject($type) { if (!isset($this->typeObjects[$type])) { $className = $this->getClassName($type); if ($className === null) { -- 2.20.1