Ejemplo n.º 1
0
 public function getDescription(XenForo_Model $model)
 {
     $resource = $this->_resourceDw->getMergedData();
     $resource = $model->getModelFromCache('XenResource_Model_Resource')->prepareResource($resource, null, $this->getViewingUser());
     $resource = $model->getModelFromCache('XenResource_Model_Resource')->prepareResourceCustomFields($resource, array(), $this->getViewingUser());
     $params = array('resource' => $resource);
     if ($resource['user_id'] == $this->getViewingUserId()) {
         return $this->_getSimulationTemplate('bdsocialshare_description_xenresource_resource', $params);
     } else {
         return $this->_getSimulationTemplate('bdsocialshare_description_xenresource_resource_aut', $params);
     }
 }
Ejemplo n.º 2
0
 public function getUserText(XenForo_Model $model)
 {
     $params = array();
     $params['trophyId'] = $this->_trophyId;
     $params['trophyPhrase'] = $this->_getPhrase($model->getModelFromCache('XenForo_Model_Trophy')->getTrophyTitlePhraseName($this->_trophyId));
     return $this->_getSimulationTemplate('bdsocialshare_user_text_i_am_awarded_trophy_x', $params);
 }
Ejemplo n.º 3
0
 protected function _getAttachment(XenForo_Model $model)
 {
     if ($this->_attachment === null) {
         $this->_attachment = $model->getModelFromCache('XenForo_Model_Attachment')->getAttachmentById($this->_mediaDw->get('attachment_id'));
     }
     return $this->_attachment;
 }
Ejemplo n.º 4
0
 protected function _getVideoData(XenForo_Model $model)
 {
     if ($this->_videoData === null) {
         $this->_videoData = $model->getModelFromCache('sonnb_XenGallery_Model_VideoData')->getDataByDataId($this->_videoDw->get('content_data_id'));
     }
     return $this->_videoData;
 }
Ejemplo n.º 5
0
 protected function _getPhotoData(XenForo_Model $model)
 {
     if ($this->_photoData === null) {
         $dataId = $this->_photoDw->get('photo_data_id');
         if (empty($dataId)) {
             // sonnb - XenGallery v2.0.0
             $dataId = $this->_photoDw->get('content_data_id');
         }
         $this->_photoData = $model->getModelFromCache('sonnb_XenGallery_Model_PhotoData')->getDataByDataId($dataId);
     }
     return $this->_photoData;
 }
Ejemplo n.º 6
0
 public function getImage(XenForo_Model $model)
 {
     $item = $this->_itemDw->getMergedData();
     if ($item['attach_count'] > 0) {
         if ($this->_image === false) {
             $item = $model->getModelFromCache('NFLJ_Showcase_Model_Item')->getAndMergeAttachmentsIntoItem($item);
             if (!empty($item['cover_image'])) {
                 $this->_image = XenForo_Link::convertUriToAbsoluteUri($item['cover_image']['thumbnailUrl'], true);
             } else {
                 $this->_image = '';
             }
         }
         if (!empty($this->_image)) {
             return $this->_image;
         }
     }
     return parent::getImage($model);
 }
Ejemplo n.º 7
0
 public function notifyTaggedUsers3($contentType, $contentId, $contentUserId, $contentUserName, $alertAction, array $taggedUsers, array $noAlertUserIds = array(), array $noEmailUserIds = array(), XenForo_Model $someRandomModel = null, array $options = array())
 {
     $options = array_merge(array(self::OPTION_MAX_TAGGED_USERS => bdTagMe_Option::get('max')), $options);
     if ($someRandomModel != null) {
         /* @var $userModel XenForo_Model_User */
         $userModel = $someRandomModel->getModelFromCache('XenForo_Model_User');
     } else {
         /* @var $userModel XenForo_Model_User */
         $userModel = XenForo_Model::create('XenForo_Model_User');
     }
     $neededUserIds = array();
     $taggableUserGroups = $this->getTaggableUserGroups();
     foreach ($taggedUsers as $taggedUserId => $taggedUserName) {
         if (is_numeric($taggedUserId)) {
             $neededUserIds[] = $taggedUserId;
         } else {
             if (strpos($taggedUserId, 'ug_') === 0) {
                 $userGroupId = substr($taggedUserId, 3);
                 if (isset($taggableUserGroups[$userGroupId])) {
                     $neededUserIds += array_keys($taggableUserGroups[$userGroupId]['userIds']);
                 }
             }
         }
     }
     if (!empty($neededUserIds)) {
         if ($options[self::OPTION_MAX_TAGGED_USERS] > 0) {
             // there are limit of maximum tagged users
             $userIds = array_slice($neededUserIds, 0, $options[self::OPTION_MAX_TAGGED_USERS]);
         } else {
             $userIds = $neededUserIds;
         }
     } else {
         $userIds = array();
     }
     if (count($userIds) > self::USERS_PER_BATCH) {
         $deferredUserIds = array_slice($userIds, self::USERS_PER_BATCH);
         $userIds = array_slice($userIds, 0, self::USERS_PER_BATCH);
         XenForo_Application::defer('bdTagMe_Deferred_NotifyUserIds', array($contentType, $contentId, $contentUserId, $contentUserName, $alertAction, $deferredUserIds, $noAlertUserIds, $noEmailUserIds, $options));
     }
     return $this->notifyUserIds($contentType, $contentId, $contentUserId, $contentUserName, $alertAction, $userIds, $noAlertUserIds, $noEmailUserIds, $userModel, $options);
 }
Ejemplo n.º 8
0
 protected function _getImageForAttachment($attachment, XenForo_Model $model)
 {
     // try to use full size link if possible
     $image = XenForo_Link::buildPublicLink('attachments', $attachment);
     if (Zend_URi::check($image) and substr($image, -1) !== '/') {
         $filename = basename($image);
         $ext = XenForo_Helper_File::getFileExtension($filename);
         if (in_array($ext, array('gif', 'jpg', 'jpeg', 'png'), true)) {
             return $image;
         }
     }
     // fallback to thumbnail
     $image = $model->getModelFromCache('XenForo_Model_Attachment')->getAttachmentThumbnailUrl($attachment);
     $image = XenForo_Link::convertUriToAbsoluteUri($image, true);
     return $image;
 }
Ejemplo n.º 9
0
 protected function _getFirstPost(XenForo_Model $model)
 {
     if ($this->_firstPost === null) {
         $thread = $this->_postDw->getDiscussionData();
         if (!empty($thread['first_post_id'])) {
             $this->_firstPost = $model->getModelFromCache('XenForo_Model_Post')->getPostById($thread['first_post_id']);
         }
     }
     return $this->_firstPost;
 }