protected function _getList($query, $limitstart = 0, $limit = 0)
 {
     $this->_db->setQuery($query, $limitstart, $limit);
     $ids = $this->_db->loadColumn();
     $results = KunenaAttachmentHelper::getById($ids);
     $userids = array();
     $mesids = array();
     foreach ($results as $result) {
         $userids[$result->userid] = $result->userid;
         $mesids[$result->mesid] = $result->mesid;
     }
     KunenaUserHelper::loadUsers($userids);
     KunenaForumMessageHelper::getMessages($mesids);
     return $results;
 }
Exemple #2
0
 /**
  * @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;
 }