本文整理汇总了PHP中KunenaForumTopicHelper::fetchNewStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaForumTopicHelper::fetchNewStatus方法的具体用法?PHP KunenaForumTopicHelper::fetchNewStatus怎么用?PHP KunenaForumTopicHelper::fetchNewStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaForumTopicHelper
的用法示例。
在下文中一共展示了KunenaForumTopicHelper::fetchNewStatus方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareTopics
/**
* Prepare topics by pre-loading needed information.
*
* @param array $userIds List of additional user Ids to be loaded.
* @param array $mesIds List of additional message Ids to be loaded.
*
* @return void
*/
protected function prepareTopics(array $userIds = array(), array $mesIds = array())
{
// Collect user Ids for avatar prefetch when integrated.
$lastIds = array();
foreach ($this->topics as $topic) {
$userIds[(int) $topic->first_post_userid] = (int) $topic->first_post_userid;
$userIds[(int) $topic->last_post_userid] = (int) $topic->last_post_userid;
$lastIds[(int) $topic->last_post_id] = (int) $topic->last_post_id;
}
// Prefetch all users/avatars to avoid user by user queries during template iterations.
if (!empty($userIds)) {
KunenaUserHelper::loadUsers($userIds);
}
$topicIds = array_keys($this->topics);
KunenaForumTopicHelper::getUserTopics($topicIds);
/* KunenaForumTopicHelper::getKeywords($topicIds); */
$mesIds += KunenaForumTopicHelper::fetchNewStatus($this->topics);
// Fetch also last post positions when user can see unapproved or deleted posts.
// TODO: Optimize? Take account of configuration option...
if ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus()) {
$mesIds += $lastIds;
}
// Load position information for all selected messages.
if ($mesIds) {
KunenaForumMessageHelper::loadLocation($mesIds);
}
}
示例2: before
/**
* Redirect unread layout to the page that contains the first unread message.
*
* @return void
*
* @throws KunenaExceptionAuthorise
*/
protected function before()
{
$catid = $this->input->getInt('catid', 0);
$id = $this->input->getInt('id', 0);
$category = KunenaForumCategoryHelper::get($catid);
$category->tryAuthorise();
$topic = KunenaForumTopicHelper::get($id);
$topic->tryAuthorise();
KunenaForumTopicHelper::fetchNewStatus(array($topic->id => $topic));
$message = KunenaForumMessageHelper::get($topic->lastread ? $topic->lastread : $topic->last_post_id);
$message->tryAuthorise();
while (@ob_end_clean()) {
}
$this->app->redirect($topic->getUrl($category, false, $message));
}
示例3: _common
protected function _common() {
if ($this->total > 0) {
$config = KunenaFactory::getConfig ();
// collect user ids for avatar prefetch when integrated
$userlist = array();
$lastpostlist = array();
foreach ( $this->topics as $topic ) {
$userlist[intval($topic->first_post_userid)] = intval($topic->first_post_userid);
$userlist[intval($topic->last_post_userid)] = intval($topic->last_post_userid);
$lastpostlist[intval($topic->last_post_id)] = intval($topic->last_post_id);
}
// Prefetch all users/avatars to avoid user by user queries during template iterations
if ( !empty($userlist) ) KunenaUserHelper::loadUsers($userlist);
KunenaForumTopicHelper::getUserTopics(array_keys($this->topics));
KunenaForumTopicHelper::getKeywords(array_keys($this->topics));
$lastreadlist = KunenaForumTopicHelper::fetchNewStatus($this->topics);
// Fetch last / new post positions when user can see unapproved or deleted posts
$me = KunenaUserHelper::get();
if (($lastpostlist || $lastreadlist) && $me->userid && $me->isModerator()) {
KunenaForumMessageHelper::loadLocation($lastpostlist + $lastreadlist);
}
}
}
示例4: _common
/**
* @param array $userlist
* @param array $postlist
*/
protected function _common(array $userlist = array(), array $postlist = array())
{
if ($this->total > 0) {
// collect user ids for avatar prefetch when integrated
$lastpostlist = array();
foreach ($this->topics as $topic) {
$userlist[intval($topic->first_post_userid)] = intval($topic->first_post_userid);
$userlist[intval($topic->last_post_userid)] = intval($topic->last_post_userid);
$lastpostlist[intval($topic->last_post_id)] = intval($topic->last_post_id);
}
// Prefetch all users/avatars to avoid user by user queries during template iterations
if (!empty($userlist)) {
KunenaUserHelper::loadUsers($userlist);
}
KunenaForumTopicHelper::getUserTopics(array_keys($this->topics));
KunenaForumTopicHelper::getKeywords(array_keys($this->topics));
$lastreadlist = KunenaForumTopicHelper::fetchNewStatus($this->topics);
// Fetch last / new post positions when user can see unapproved or deleted posts
if ($postlist || $lastreadlist || $this->me->userid && ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus())) {
KunenaForumMessageHelper::loadLocation($postlist + $lastpostlist + $lastreadlist);
}
}
}
示例5: displayUnread
public function displayUnread($tpl = null)
{
// Redirect unread layout to the page that contains the first unread message
$category = $this->get('Category');
$topic = $this->get('Topic');
KunenaForumTopicHelper::fetchNewStatus(array($topic->id => $topic));
$message = KunenaForumMessage::getInstance($topic->lastread ? $topic->lastread : $topic->last_post_id);
while (@ob_end_clean()) {
}
$this->app->redirect($topic->getUrl($category, false, $message));
}
示例6: getTopics
public function getTopics()
{
if ($this->topics === false) {
$catid = $this->getState('item.id');
$limitstart = $this->getState('list.start');
$limit = $this->getState('list.limit');
$format = $this->getState('format');
$topic_ordering = $this->getCategory()->topic_ordering;
$access = KunenaAccess::getInstance();
$hold = $format == 'feed' ? 0 : $access->getAllowedHold($this->me, $catid);
$moved = $format == 'feed' ? 0 : 1;
$params = array('hold' => $hold, 'moved' => $moved);
switch ($topic_ordering) {
case 'alpha':
$params['orderby'] = 'tt.ordering DESC, tt.subject ASC ';
break;
case 'creation':
$params['orderby'] = 'tt.ordering DESC, tt.first_post_time ' . strtoupper($this->getState('list.direction'));
break;
case 'lastpost':
default:
$params['orderby'] = 'tt.ordering DESC, tt.last_post_time ' . strtoupper($this->getState('list.direction'));
}
if ($format == 'feed') {
$catid = array_keys(KunenaForumCategoryHelper::getChildren($catid, 100) + array($catid => 1));
}
list($this->total, $this->topics) = KunenaForumTopicHelper::getLatestTopics($catid, $limitstart, $limit, $params);
if ($this->total > 0) {
// collect user ids for avatar prefetch when integrated
$userlist = array();
$lastpostlist = array();
foreach ($this->topics as $topic) {
$userlist[intval($topic->first_post_userid)] = intval($topic->first_post_userid);
$userlist[intval($topic->last_post_userid)] = intval($topic->last_post_userid);
$lastpostlist[intval($topic->last_post_id)] = intval($topic->last_post_id);
}
// Prefetch all users/avatars to avoid user by user queries during template iterations
if (!empty($userlist)) {
KunenaUserHelper::loadUsers($userlist);
}
KunenaForumTopicHelper::getUserTopics(array_keys($this->topics));
KunenaForumTopicHelper::getKeywords(array_keys($this->topics));
$lastreadlist = KunenaForumTopicHelper::fetchNewStatus($this->topics);
// Fetch last / new post positions when user can see unapproved or deleted posts
if (($lastpostlist || $lastreadlist) && ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus())) {
KunenaForumMessageHelper::loadLocation($lastpostlist + $lastreadlist);
}
}
}
return $this->topics;
}
示例7: before
/**
* Prepare category display.
*
* @return void
*
* @throws KunenaExceptionAuthorise
*/
protected function before()
{
parent::before();
require_once KPATH_SITE . '/models/category.php';
$this->model = new KunenaModelCategory();
$this->me = KunenaUserHelper::getMyself();
$catid = $this->input->getInt('catid');
$limitstart = $this->input->getInt('limitstart', 0);
$limit = $this->input->getInt('limit', 0);
if ($limit < 1 || $limit > 100) {
$limit = $this->config->threads_per_page;
}
// TODO:
$direction = 'DESC';
$this->category = KunenaForumCategoryHelper::get($catid);
$this->category->tryAuthorise();
$this->headerText = JText::_('COM_KUNENA_THREADS_IN_FORUM') . ': ' . $this->category->name;
$topic_ordering = $this->category->topic_ordering;
$access = KunenaAccess::getInstance();
$hold = $access->getAllowedHold($this->me, $catid);
$moved = 1;
$params = array('hold' => $hold, 'moved' => $moved);
switch ($topic_ordering) {
case 'alpha':
$params['orderby'] = 'tt.ordering DESC, tt.subject ASC ';
break;
case 'creation':
$params['orderby'] = 'tt.ordering DESC, tt.first_post_time ' . $direction;
break;
case 'lastpost':
default:
$params['orderby'] = 'tt.ordering DESC, tt.last_post_time ' . $direction;
}
list($this->total, $this->topics) = KunenaForumTopicHelper::getLatestTopics($catid, $limitstart, $limit, $params);
if ($this->total > 0) {
// Collect user ids for avatar prefetch when integrated.
$userlist = array();
$lastpostlist = array();
foreach ($this->topics as $topic) {
$userlist[intval($topic->first_post_userid)] = intval($topic->first_post_userid);
$userlist[intval($topic->last_post_userid)] = intval($topic->last_post_userid);
$lastpostlist[intval($topic->last_post_id)] = intval($topic->last_post_id);
}
// Prefetch all users/avatars to avoid user by user queries during template iterations.
if (!empty($userlist)) {
KunenaUserHelper::loadUsers($userlist);
}
KunenaForumTopicHelper::getUserTopics(array_keys($this->topics));
KunenaForumTopicHelper::getKeywords(array_keys($this->topics));
$lastreadlist = KunenaForumTopicHelper::fetchNewStatus($this->topics);
// Fetch last / new post positions when user can see unapproved or deleted posts.
if ($lastreadlist || $this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus()) {
KunenaForumMessageHelper::loadLocation($lastpostlist + $lastreadlist);
}
}
$this->topicActions = $this->model->getTopicActions();
$this->actionMove = $this->model->getActionMove();
$this->pagination = new KunenaPagination($this->total, $limitstart, $limit);
$this->pagination->setDisplayedPages(5);
}