Debug commit
authorAlexander Ebert <ebert@woltlab.com>
Mon, 21 Nov 2011 10:53:18 +0000 (11:53 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 21 Nov 2011 10:53:18 +0000 (11:53 +0100)
wcfsetup/install/files/lib/data/user/option/ViewableUserOption.class.php
wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php

index b388a077ad7a3e255ce7c381fa3ad20f5f4fe6c4..fa1cfab9724146b8f34585d908eaff17115af749 100644 (file)
@@ -2,6 +2,7 @@
 namespace wcf\data\user\option;
 use wcf\data\user\User;
 use wcf\data\DatabaseObjectDecorator;
+use wcf\system\exception\SystemException;
 use wcf\system\option\user\IUserOptionOutputContactInformation;
 use wcf\util\ClassUtil;
 use wcf\util\StringUtil;
@@ -41,7 +42,7 @@ class ViewableUserOption extends DatabaseObjectDecorator {
                
                // use output class
                if ($this->outputClass) {
-                       $outputObj = $this->getOutputObject($this->outputClass);
+                       $outputObj = $this->getOutputObject();
                        
                        if ($outputObj instanceof IUserOptionOutputContactInformation) {
                                $this->outputData = $outputObj->getOutputData($user, $this->getDecoratedObject(), $optionValue);
@@ -62,20 +63,20 @@ class ViewableUserOption extends DatabaseObjectDecorator {
         * @return      wcf\system\option\user\IUserOptionOutput
         */
        public function getOutputObject() {
-               if (!isset(self::$outputObjects[$this->className])) {
+               if (!isset(self::$outputObjects[$this->outputClass])) {
                        // create instance
-                       if (!class_exists($this->className)) {
-                               throw new SystemException("unable to find class '".$this->className."'");
+                       if (!class_exists($this->outputClass)) {
+                               throw new SystemException("unable to find class '".$this->outputClass."'");
                        }
                        
                        // validate interface
-                       if (!ClassUtil::isInstanceOf($this->className, 'wcf\system\user\option\IUserOptionOutput')) {
-                               throw new SystemException("'".$this->className."' should implement wcf\system\user\option\IUserOptionOutput");
+                       if (!ClassUtil::isInstanceOf($this->outputClass, 'wcf\system\option\user\IUserOptionOutput')) {
+                               throw new SystemException("'".$this->outputClass."' should implement wcf\system\option\user\IUserOptionOutput");
                        }
                        
-                       self::$outputObjects[$this->className] = new $this->className();
+                       self::$outputObjects[$this->outputClass] = new $this->outputClass();
                }
                
-               return self::$outputObjects[$this->className];
+               return self::$outputObjects[$this->outputClass];
        }
 }
index 62c7502547b3435922667b44dff7862ff5b9955e..c692513f3cdf09cd4554f3d55f70915499ab94aa 100644 (file)
@@ -51,6 +51,10 @@ class UserOptionHandler extends OptionHandler {
        public function getCategoryOptions($categoryName = '', $inherit = true) {
                $options = parent::getCategoryOptions($categoryName, $inherit);
                
+               foreach ($options as $optionData) {
+                       $optionData['object'] = new ViewableUserOption($optionData['object']);
+                       $optionData['object']->setOptionValue($this->user);
+               }
                die('<pre>'.print_r($options, true));
        }