本文整理汇总了PHP中KunenaForumMessageHelper::getMessagesByTopic方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaForumMessageHelper::getMessagesByTopic方法的具体用法?PHP KunenaForumMessageHelper::getMessagesByTopic怎么用?PHP KunenaForumMessageHelper::getMessagesByTopic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaForumMessageHelper
的用法示例。
在下文中一共展示了KunenaForumMessageHelper::getMessagesByTopic方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before
/**
* Prepare reply history display.
*
* @return void
*/
protected function before()
{
parent::before();
$id = $this->input->getInt('id');
$this->topic = KunenaForumTopicHelper::get($id);
$this->history = KunenaForumMessageHelper::getMessagesByTopic($this->topic, 0, (int) $this->config->historylimit, 'DESC');
$this->replycount = $this->topic->getReplies();
$this->historycount = count($this->history);
KunenaAttachmentHelper::getByMessage($this->history);
$userlist = array();
foreach ($this->history as $message) {
$userlist[(int) $message->userid] = (int) $message->userid;
}
KunenaUserHelper::loadUsers($userlist);
// Run events
$params = new JRegistry();
$params->set('ksource', 'kunena');
$params->set('kunena_view', 'topic');
$params->set('kunena_layout', 'history');
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('kunena');
$dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->history, &$params, 0));
// FIXME: need to improve BBCode class on this...
$this->attachments = KunenaAttachmentHelper::getByMessage($this->history);
$this->inline_attachments = array();
$this->headerText = JText::_('COM_KUNENA_POST_EDIT') . ' ' . $this->topic->subject;
}
示例2: getMessages
public function getMessages()
{
if ($this->messages === false) {
$layout = $this->getState('layout');
$threaded = $layout == 'indented' || $layout == 'threaded';
$this->messages = KunenaForumMessageHelper::getMessagesByTopic($this->getState('item.id'), $this->getState('list.start'), $this->getState('list.limit'), $this->getState('list.direction'), $this->getState('hold'), $threaded);
// Get thankyous for all messages in the page
$thankyous = KunenaForumMessageThankyouHelper::getByMessage($this->messages);
// First collect ids and users
$userlist = array();
$this->threaded = array();
$location = $this->getState('list.start');
foreach ($this->messages as $message) {
$message->replynum = ++$location;
if ($threaded) {
// Threaded ordering
if (isset($this->messages[$message->parent])) {
$this->threaded[$message->parent][] = $message->id;
} else {
$this->threaded[0][] = $message->id;
}
}
$userlist[intval($message->userid)] = intval($message->userid);
$userlist[intval($message->modified_by)] = intval($message->modified_by);
$thankyou_list = $thankyous[$message->id]->getList();
$message->thankyou = array();
if (!empty($thankyou_list)) {
$message->thankyou = $thankyou_list;
}
}
if (!isset($this->messages[$this->getState('item.mesid')]) && !empty($this->messages)) {
$this->setState('item.mesid', reset($this->messages)->id);
}
if ($threaded) {
if (!isset($this->messages[$this->topic->first_post_id])) {
$this->messages = $this->getThreadedOrdering(0, array('edge'));
} else {
$this->messages = $this->getThreadedOrdering();
}
}
// Prefetch all users/avatars to avoid user by user queries during template iterations
KunenaUserHelper::loadUsers($userlist);
// Get attachments
KunenaForumMessageAttachmentHelper::getByMessage($this->messages);
}
return $this->messages;
}
示例3: displayThreadHistory
function displayThreadHistory()
{
if (!$this->hasThreadHistory()) {
return;
}
$this->history = KunenaForumMessageHelper::getMessagesByTopic($this->topic, 0, (int) $this->config->historylimit, $ordering = 'DESC');
$this->historycount = count($this->history);
$this->replycount = $this->topic->getReplies();
KunenaAttachmentHelper::getByMessage($this->history);
$userlist = array();
foreach ($this->history as $message) {
$userlist[(int) $message->userid] = (int) $message->userid;
}
KunenaUserHelper::loadUsers($userlist);
// Run events
$params = new JRegistry();
$params->set('ksource', 'kunena');
$params->set('kunena_view', 'topic');
$params->set('kunena_layout', 'history');
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('kunena');
$dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->history, &$params, 0));
echo $this->loadTemplateFile('history');
}
示例4: displayThreadHistory
function displayThreadHistory()
{
if (!$this->hasThreadHistory()) {
return;
}
$db = JFactory::getDBO();
$this->history = KunenaForumMessageHelper::getMessagesByTopic($this->topic, 0, (int) $this->config->historylimit, $ordering = 'DESC');
$this->historycount = count($this->history);
KunenaForumMessageAttachmentHelper::getByMessage($this->history);
$userlist = array();
foreach ($this->history as $message) {
$userlist[(int) $message->userid] = (int) $message->userid;
}
KunenaUserHelper::loadUsers($userlist);
// Run events
if (version_compare(JVERSION, '1.6', '>')) {
// Joomla 1.6+
$params = new JRegistry();
} else {
// Joomla 1.5
$params = new JParameter('');
}
$params->set('ksource', 'kunena');
$params->set('kunena_view', 'topic');
$params->set('kunena_layout', 'history');
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('kunena');
$dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->history, &$params, 0));
echo $this->loadTemplateFile('history');
}
示例5: displayThreadHistory
function displayThreadHistory() {
if (! $this->hasThreadHistory())
return;
$db = JFactory::getDBO();
$this->history = KunenaForumMessageHelper::getMessagesByTopic($this->topic, 0, (int) $this->config->historylimit, $ordering='DESC');
$this->historycount = count ( $this->history );
KunenaForumMessageAttachmentHelper::getByMessage($this->history);
$userlist = array();
foreach ($this->history as $message) {
$userlist[(int) $message->userid] = (int) $message->userid;
}
KunenaUserHelper::loadUsers($userlist);
echo $this->loadTemplate ( 'history' );
}