* Extends the conversation object with functions to create, update and delete conversations.
*
* @author Marcel Werk
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf.conversation
* @subpackage data.conversation
* @category Community Framework
+ *
+ * @method Conversation getDecoratedObject()
+ * @mixin Conversation
*/
class ConversationEditor extends DatabaseObjectEditor {
/**
- * @see \wcf\data\DatabaseObjectEditor::$baseClass
+ * @inheritDoc
*/
- protected static $baseClass = 'wcf\data\conversation\Conversation';
+ protected static $baseClass = Conversation::class;
/**
* Adds a new message to this conversation.
*
- * @param \wcf\data\conversation\message\ConversationMessage $message
+ * @param ConversationMessage $message
*/
public function addMessage(ConversationMessage $message) {
- $data = array(
+ $this->update([
'lastPoster' => $message->username,
'lastPostTime' => $message->time,
'lastPosterID' => $message->userID,
'replies' => $this->replies + 1,
'attachments' => $this->attachments + $message->attachments
- );
-
- $this->update($data);
+ ]);
}
/**
WHERE conversationID = ?
AND participantID <> ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($this->conversationID, $this->userID));
+ $statement->execute([$this->conversationID, $this->userID]);
}
/**
* @param integer[] $participantIDs
* @param integer[] $invisibleParticipantIDs
*/
- public function updateParticipants(array $participantIDs, array $invisibleParticipantIDs = array()) {
- $usernames = array();
+ public function updateParticipants(array $participantIDs, array $invisibleParticipantIDs = []) {
+ $usernames = [];
if (!empty($participantIDs) || !empty($invisibleParticipantIDs)) {
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("userID IN (?)", array(array_merge($participantIDs, $invisibleParticipantIDs)));
+ $conditions->add("userID IN (?)", [array_merge($participantIDs, $invisibleParticipantIDs)]);
$sql = "SELECT userID, username
FROM wcf".WCF_N."_user
$statement = WCF::getDB()->prepareStatement($sql);
foreach ($participantIDs as $userID) {
- $statement->execute(array(
+ $statement->execute([
$this->conversationID,
$userID,
$usernames[$userID],
0
- ));
+ ]);
}
WCF::getDB()->commitTransaction();
}
$statement = WCF::getDB()->prepareStatement($sql);
foreach ($invisibleParticipantIDs as $userID) {
- $statement->execute(array(
+ $statement->execute([
$this->conversationID,
$userID,
$usernames[$userID],
1
- ));
+ ]);
}
WCF::getDB()->commitTransaction();
}
)
WHERE conversation.conversationID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(
+ $statement->execute([
Conversation::STATE_LEFT,
$this->userID,
0,
$this->conversationID
- ));
+ ]);
}
/**
* Updates the participant summary of this conversation.
*/
public function updateParticipantSummary() {
- $users = array();
+ $users = [];
$sql = "SELECT participantID AS userID, hideConversation, username
FROM wcf".WCF_N."_conversation_to_user
WHERE conversationID = ?
AND isInvisible = 0
ORDER BY username";
$statement = WCF::getDB()->prepareStatement($sql, 5);
- $statement->execute(array($this->conversationID, $this->userID));
+ $statement->execute([$this->conversationID, $this->userID]);
while ($row = $statement->fetchArray()) {
$users[] = $row;
}
- $this->update(array(
- 'participantSummary' => serialize($users)
- ));
+ $this->update(['participantSummary' => serialize($users)]);
}
/**
WHERE conversationID = ?
AND participantID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(
+ $statement->execute([
2,
$this->conversationID,
$userID
- ));
+ ]);
// decrease participant count unless it is the author
if ($userID != $this->userID) {
- $this->updateCounters(array(
+ $this->updateCounters([
'participants' => -1
- ));
+ ]);
}
}
WHERE conversationID = ?
ORDER BY time ASC";
$statement = WCF::getDB()->prepareStatement($sql, 1);
- $statement->execute(array(
+ $statement->execute([
$this->conversationID
- ));
+ ]);
- $this->update(array(
+ $this->update([
'firstMessageID' => $statement->fetchColumn()
- ));
+ ]);
}
/**
WHERE conversationID = ?
ORDER BY time DESC";
$statement = WCF::getDB()->prepareStatement($sql, 1);
- $statement->execute(array(
+ $statement->execute([
$this->conversationID
- ));
+ ]);
$row = $statement->fetchArray();
- $this->update(array(
+ $this->update([
'lastPostTime' => $row['time'],
'lastPosterID' => $row['userID'],
'lastPoster' => $row['username']
- ));
+ ]);
}
/**
* @package com.woltlab.wcf.conversation
* @subpackage data.conversation
* @category Community Framework
+ *
+ * @method Conversation getDecoratedObject()
+ * @mixin Conversation
*/
class ViewableConversation extends DatabaseObjectDecorator {
use TLegacyUserPropertyAccess;
/**
* @inheritDoc
*/
- protected static $baseClass = 'wcf\data\conversation\Conversation';
+ protected static $baseClass = Conversation::class;
/**
* maps legacy direct access to last poster's user profile data to the real
* Extends the label object with functions to create, update and delete labels.
*
* @author Marcel Werk
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf.conversation
* @subpackage data.conversation.label
* @category Community Framework
+ *
+ * @method ConversationLabel getDecoratedObject()
+ * @mixin ConversationLabel
*/
class ConversationLabelEditor extends DatabaseObjectEditor {
/**
- * @see \wcf\data\DatabaseObjectEditor::$baseClass
+ * @inheritDoc
*/
- protected static $baseClass = 'wcf\data\conversation\label\ConversationLabel';
+ protected static $baseClass = ConversationLabel::class;
}
* @package com.woltlab.wcf.conversation
* @subpackage data.conversation.message
* @category Community Framework
+ *
+ * @method ConversationMessage getDecoratedObject()
+ * @mixin ConversationMessage
*/
class ConversationMessageEditor extends DatabaseObjectEditor {
/**
- * @see \wcf\data\DatabaseObjectEditor::$baseClass
+ * @inheritDoc
*/
- protected static $baseClass = 'wcf\data\conversation\message\ConversationMessage';
+ protected static $baseClass = ConversationMessage::class;
}
* Represents a viewable conversation message.
*
* @author Marcel Werk
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf.conversation
* @subpackage data.conversation.message
* @category Community Framework
+ *
+ * @method ConversationMessage getDecoratedObject()
+ * @mixin ConversationMessage
*/
class ViewableConversationMessage extends DatabaseObjectDecorator {
use TLegacyUserPropertyAccess;
/**
- * @see \wcf\data\DatabaseObjectDecorator::$baseClass
+ * @inheritDoc
*/
- protected static $baseClass = 'wcf\data\conversation\message\ConversationMessage';
+ protected static $baseClass = ConversationMessage::class;
/**
* user profile object
- * @var \wcf\data\user\UserProfile
+ * @var UserProfile
*/
protected $userProfile = null;
/**
* Returns the user profile object.
*
- * @return \wcf\data\user\UserProfile
+ * @return UserProfile
*/
public function getUserProfile() {
if ($this->userProfile === null) {
* Returns the viewable conversation message with the given id.
*
* @param integer $messageID
- * @return \wcf\data\conversation\message\ViewableConversationMessage
+ * @return ViewableConversationMessage
*/
public static function getViewableConversationMessage($messageID) {
$messageList = new ViewableConversationMessageList();
- $messageList->setObjectIDs(array($messageID));
+ $messageList->setObjectIDs([$messageID]);
$messageList->readObjects();
return $messageList->search($messageID);
* Provides a viewable conversation modification log.
*
* @author Alexander Ebert
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf.conversation
* @subpackage data.modification.log
* @category Community Framework
+ *
+ * @method ModificationLog getDecoratedObject()
+ * @mixin ModificationLog
*/
class ViewableConversationModificationLog extends DatabaseObjectDecorator {
use TLegacyUserPropertyAccess;
/**
- * @see \wcf\data\DatabaseObjectDecorator::$baseClass
+ * @inheritDoc
*/
- protected static $baseClass = 'wcf\data\modification\log\ModificationLog';
+ protected static $baseClass = ModificationLog::class;
/**
* user profile object
- * @var \wcf\data\user\UserProfile
+ * @var UserProfile
*/
protected $userProfile = null;
* @return string
*/
public function __toString() {
- return WCF::getLanguage()->getDynamicVariable('wcf.conversation.log.conversation.'.$this->action, array('additionalData' => $this->additionalData));
+ return WCF::getLanguage()->getDynamicVariable('wcf.conversation.log.conversation.'.$this->action, ['additionalData' => $this->additionalData]);
}
/**
* Returns the profile object of the user who created the modification entry.
*
- * @return \wcf\data\user\UserProfile
+ * @return UserProfile
*/
public function getUserProfile() {
if ($this->userProfile === null) {
<?php
namespace wcf\system\user\notification\object;
+use wcf\data\conversation\message\ConversationMessage;
use wcf\data\DatabaseObjectDecorator;
use wcf\system\request\LinkHandler;
* Notification object for conversations.
*
* @author Marcel Werk
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf.conversation
* @subpackage system.user.notification.object
* @category Community Framework
+ *
+ * @method ConversationMessage getDecoratedObject()
+ * @mixin ConversationMessage
*/
class ConversationMessageUserNotificationObject extends DatabaseObjectDecorator implements IStackableUserNotificationObject {
/**
- * @see \wcf\data\DatabaseObjectDecorator::$baseClass
+ * @inheritDoc
*/
- protected static $baseClass = 'wcf\data\conversation\message\ConversationMessage';
+ protected static $baseClass = ConversationMessage::class;
/**
- * @see \wcf\system\user\notification\object\IUserNotificationObject::getTitle()
+ * @inheritDoc
*/
public function getTitle() {
return $this->getConversation()->subject;
}
/**
- * @see \wcf\system\user\notification\object\IUserNotificationObject::getURL()
+ * @inheritDoc
*/
public function getURL() {
- return LinkHandler::getInstance()->getLink('Conversation', array(
+ return LinkHandler::getInstance()->getLink('Conversation', [
'object' => $this->getConversation(),
'messageID' => $this->messageID
- )).'#message'.$this->messageID;
+ ]).'#message'.$this->messageID;
}
/**
- * @see \wcf\system\user\notification\object\IUserNotificationObject::getAuthorID()
+ * @inheritDoc
*/
public function getAuthorID() {
return $this->userID;
}
/**
- * @see \wcf\system\user\notification\object\IStackableUserNotificationObject::getRelatedObjectID()
+ * @inheritDoc
*/
public function getRelatedObjectID() {
return $this->conversationID;
<?php
namespace wcf\system\user\notification\object;
+use wcf\data\conversation\Conversation;
use wcf\data\DatabaseObjectDecorator;
use wcf\system\request\LinkHandler;
* Notification object for conversations.
*
* @author Marcel Werk
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf.conversation
* @subpackage system.user.notification.object
* @category Community Framework
+ *
+ * @method Conversation getDecoratedObject()
+ * @mixin Conversation
*/
class ConversationUserNotificationObject extends DatabaseObjectDecorator implements IUserNotificationObject {
/**
- * @see \wcf\data\DatabaseObjectDecorator::$baseClass
+ * @inheritDoc
*/
- protected static $baseClass = 'wcf\data\conversation\Conversation';
+ protected static $baseClass = Conversation::class;
/**
- * @see \wcf\system\user\notification\object\IUserNotificationObject::getTitle()
+ * @inheritDoc
*/
public function getTitle() {
return $this->subject;
}
/**
- * @see \wcf\system\user\notification\object\IUserNotificationObject::getURL()
+ * @inheritDoc
*/
public function getURL() {
- return LinkHandler::getInstance()->getLink('Conversation', array(
+ return LinkHandler::getInstance()->getLink('Conversation', [
'object' => $this->getDecoratedObject()
- ));
+ ]);
}
/**
- * @see \wcf\system\user\notification\object\IUserNotificationObject::getAuthorID()
+ * @inheritDoc
*/
public function getAuthorID() {
return $this->userID;