* Represents a viewable comment.
*
* @author Alexander Ebert
- * @copyright 2001-2014 WoltLab GmbH
+ * @copyright 2001-2015 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage data.comment
return $this->userProfile;
}
+
+ /**
+ * Gets a specific comment decorated as comment entry.
+ *
+ * @param integer $commentID
+ * @return \wcf\data\comment\ViewableComment
+ */
+ public static function getComment($commentID) {
+ $list = new ViewableCommentList();
+ $list->setObjectIDs(array($commentID));
+ $list->readObjects();
+ $objects = $list->getObjects();
+ if (isset($objects[$commentID])) return $objects[$commentID];
+ return null;
+ }
}
* Represents a viewable comment response.
*
* @author Alexander Ebert
- * @copyright 2001-2014 WoltLab GmbH
+ * @copyright 2001-2015 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage data.comment.response
return $this->userProfile;
}
+
+ /**
+ * Gets a specific comment response decorated as viewable comment response.
+ *
+ * @param integer $responseID
+ * @return \wcf\data\comment\response\ViewableCommentResponse
+ */
+ public static function getResponse($responseID) {
+ $list = new ViewableCommentResponseList();
+ $list->setObjectIDs(array($responseID));
+ $list->readObjects();
+ $objects = $list->getObjects();
+ if (isset($objects[$responseID])) return $objects[$responseID];
+ return null;
+ }
}
--- /dev/null
+<?php
+namespace wcf\data\comment\response;
+
+/**
+ * Represents a list of decorated comment response objects.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2015 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage data.comment.response
+ * @category Community Framework
+ */
+class ViewableCommentResponseList extends CommentResponseList {
+ /**
+ * @see \wcf\data\DatabaseObjectList::$decoratorClassName
+ */
+ public $decoratorClassName = 'wcf\data\comment\response\ViewableCommentResponse';
+
+ /**
+ * Creates a new ViewableCommentResponseList 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_response.userID)";
+ $this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_user_avatar user_avatar ON (user_avatar.avatarID = user_table.avatarID)";
+ }
+}
* An implementation of IModerationQueueReportHandler for comments.
*
* @author Alexander Ebert
- * @copyright 2001-2014 WoltLab GmbH
+ * @copyright 2001-2015 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.moderation.queue
*/
public function getReportedContent(ViewableModerationQueue $queue) {
WCF::getTPL()->assign(array(
- 'message' => new ViewableComment($queue->getAffectedObject())
+ 'message' => ViewableComment::getComment($queue->objectID)
));
return WCF::getTPL()->fetch('moderationComment');
* An implementation of IModerationQueueReportHandler for comment responses.
*
* @author Alexander Ebert
- * @copyright 2001-2014 WoltLab GmbH
+ * @copyright 2001-2015 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.moderation.queue
*/
public function getReportedContent(ViewableModerationQueue $queue) {
WCF::getTPL()->assign(array(
- 'message' => new ViewableCommentResponse($queue->getAffectedObject())
+ 'message' => ViewableCommentResponse::getResponse($queue->objectID)
));
return WCF::getTPL()->fetch('moderationComment');