Файл: concrete5.7.5.6/concrete/src/User/PrivateMessage/PrivateMessageList.php
Строк: 19
<?php
namespace ConcreteCoreUserPrivateMessage;
use ConcreteCoreLegacyDatabaseItemList;
use Loader;
use ConcreteCoreUserPrivateMessagePrivateMessage as UserPrivateMessage;
class PrivateMessageList extends DatabaseItemList {
protected $itemsPerPage = 10;
protected $mailbox;
public function filterByMailbox($mailbox) {
$this->filter('msgMailboxID', $mailbox->getMailboxID());
$this->filter('uID', $mailbox->getMailboxUserID());
$this->mailbox = $mailbox;
}
function __construct() {
$this->setQuery("select UserPrivateMessagesTo.msgID from UserPrivateMessagesTo inner join UserPrivateMessages on UserPrivateMessagesTo.msgID = UserPrivateMessages.msgID");
$this->sortBy('msgDateCreated', 'desc');
}
public function get($itemsToGet = 0, $offset = 0) {
$messages = array();
$r = parent::get($itemsToGet, $offset);
foreach($r as $row) {
$messages[] = UserPrivateMessage::getByID($row['msgID'], $this->mailbox);
}
return $messages;
}
}