当前位置: 首页>>代码示例>>PHP>>正文


PHP KunenaAttachmentHelper::getByMessage方法代码示例

本文整理汇总了PHP中KunenaAttachmentHelper::getByMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaAttachmentHelper::getByMessage方法的具体用法?PHP KunenaAttachmentHelper::getByMessage怎么用?PHP KunenaAttachmentHelper::getByMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KunenaAttachmentHelper的用法示例。


在下文中一共展示了KunenaAttachmentHelper::getByMessage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:32,代码来源:display.php

示例2: loadattachments

 /**
  * Get attachments attached to a message with AJAX.
  *
  * @throws RuntimeException
  *
  * @return string
  */
 public function loadattachments()
 {
     // Only support JSON requests.
     if ($this->input->getWord('format', 'html') != 'json') {
         throw new RuntimeException(JText::_('Bad Request'), 400);
     }
     if (!JSession::checkToken('request')) {
         throw new RuntimeException(JText::_('Forbidden'), 403);
     }
     $mes_id = $this->input->getInt('mes_id', 0);
     $attachments = KunenaAttachmentHelper::getByMessage($mes_id);
     $list = array();
     foreach ($attachments as $attach) {
         $object = new stdClass();
         $object->id = $attach->id;
         $object->size = round($attach->size / '1024', 0);
         $object->name = $attach->filename;
         $object->folder = $attach->folder;
         $object->caption = $attach->caption;
         $object->type = $attach->filetype;
         $object->path = $attach->getUrl();
         $object->image = $attach->isImage();
         $list['files'][] = $object;
     }
     header('Content-type: application/json');
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     header("Cache-Control: no-store, no-cache, must-revalidate");
     header("Cache-Control: post-check=0, pre-check=0", false);
     header("Pragma: no-cache");
     while (@ob_end_clean()) {
     }
     echo json_encode($list);
     jexit();
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:42,代码来源:topic.php

示例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');
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:24,代码来源:view.html.php

示例4: getAttachments

 /**
  * @param  bool|array  $ids
  * @param  string      $action
  *
  * @return KunenaAttachment[]
  */
 public function getAttachments($ids = false, $action = 'read')
 {
     if ($ids === false) {
         $attachments = KunenaAttachmentHelper::getByMessage($this->id, $action);
     } else {
         $attachments = KunenaAttachmentHelper::getById($ids, $action);
         foreach ($attachments as $id => $attachment) {
             if ($attachment->mesid && $attachment->mesid != $this->id) {
                 unset($attachments[$id]);
             }
         }
     }
     return $attachments;
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:20,代码来源:message.php

示例5: prepareMessages

 /**
  * Prepare messages for display.
  *
  * @param   int  $mesid  Selected message Id.
  *
  * @return  void
  */
 protected function prepareMessages($mesid)
 {
     // Get thank yous for all messages in the page
     $thankyous = KunenaForumMessageThankyouHelper::getByMessage($this->messages);
     // First collect ids and users.
     $threaded = $this->layout == 'indented' || $this->layout == 'threaded';
     $userlist = array();
     $this->threaded = array();
     $location = $this->pagination->limitstart;
     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[(int) $message->userid] = (int) $message->userid;
         $userlist[(int) $message->modified_by] = (int) $message->modified_by;
         $thankyou_list = $thankyous[$message->id]->getList();
         $message->thankyou = array();
         if (!empty($thankyou_list)) {
             $message->thankyou = $thankyou_list;
         }
     }
     if (!isset($this->messages[$mesid]) && !empty($this->messages)) {
         $this->message = reset($this->messages);
     }
     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);
     // Prefetch attachments.
     KunenaAttachmentHelper::getByMessage($this->messages);
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:49,代码来源:display.php

示例6: 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
         KunenaAttachmentHelper::getByMessage($this->messages);
     }
     return $this->messages;
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:47,代码来源:topic.php


注:本文中的KunenaAttachmentHelper::getByMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。