Fixed user search
authorAlexander Ebert <ebert@woltlab.com>
Mon, 12 Mar 2012 22:06:06 +0000 (23:06 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 12 Mar 2012 22:06:06 +0000 (23:06 +0100)
Fixes #507

wcfsetup/install/files/acp/templates/userSearch.tpl
wcfsetup/install/files/lib/acp/form/UserSearchForm.class.php
wcfsetup/install/files/lib/acp/page/UserListPage.class.php
wcfsetup/install/files/lib/system/option/OptionHandler.class.php

index 95551903834da6cd40a1c1ae262f23744fbd2ade..58ec577b89f377df71b33972e30f6a1c34942485 100644 (file)
                        
                                <fieldset>
                                        <legend>{lang}wcf.acp.user.search.display.columns{/lang}</legend>
-                               
-                                       {if $optionTree|count}
+                                       
+                                       {* TODO: Do we still want all this columns supported? *}
+                                       {*if $optionTree|count}
                                                <dl>
                                                        <dt>
                                                                <label>{lang}wcf.acp.user.search.display.columns.profile{/lang}</label>
                                                                </fieldset>
                                                        </dd>
                                                </dl>
-                                       {/if}
+                                       {/if*}
                                
                                        <dl>
                                                <dt><label>{lang}wcf.acp.user.search.display.columns.other{/lang}</label></dt>
index 46973858190e38fe5566fba8927089f5990e42c0..0e9b037ccb723debca7df3c3d19b2168450fa55d 100755 (executable)
@@ -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);
                }
        }
        
index 584cf339fc3f4e5bb0104c415d602053171eb38a..03524663fc24808dd45d7c0e75b2836aeea7d684 100755 (executable)
@@ -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());
index 71827b6cf4eca2dac93b6e64e442ebca269c1dd0..79d431d67077ad1360a44e633e83e84e3e733d42 100644 (file)
@@ -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) {