Added viewable comment list
authorMarcel Werk <burntime@woltlab.com>
Sat, 22 Feb 2014 21:29:12 +0000 (22:29 +0100)
committerMarcel Werk <burntime@woltlab.com>
Sat, 22 Feb 2014 21:29:12 +0000 (22:29 +0100)
wcfsetup/install/files/lib/data/comment/ViewableCommentList.class.php [new file with mode: 0644]

diff --git a/wcfsetup/install/files/lib/data/comment/ViewableCommentList.class.php b/wcfsetup/install/files/lib/data/comment/ViewableCommentList.class.php
new file mode 100644 (file)
index 0000000..e725d42
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+namespace wcf\data\comment;
+
+/**
+ * Represents a list of decorated comment objects.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage data.comment
+ * @category   Community Framework
+ */
+class ViewableCommentList extends CommentList {
+       /**
+        * @see \wcf\data\DatabaseObjectList::$decoratorClassName
+        */
+       public $decoratorClassName = 'wcf\data\comment\ViewableComment';
+
+       /**
+        * Creates a new ViewableCommentList object.
+        */
+       public function __construct() {
+               parent::__construct();
+       
+               // get avatars
+               if (!empty($this->sqlSelects)) $this->sqlSelects .= ',';
+               $this->sqlSelects .= "user_avatar.*, user_table.*";
+               $this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_user user_table ON (user_table.userID = comment.userID)";
+               $this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_user_avatar user_avatar ON (user_avatar.avatarID = user_table.avatarID)";
+       }
+}