Exemplo n.º 1
0
 public function getDurationInHMS()
 {
     if ($this->duration != 0) {
         $duration = CVideosHelper::formatDuration((int) $this->duration, 'HH:MM:SS');
         $duration = CVideosHelper::toNiceHMS($duration);
     } else {
         $duration = JText::_('COM_COMMUNITY_VIDEOS_DURATION_NOT_AVAILABLE');
     }
     return $duration;
 }
Exemplo n.º 2
0
$quoteContent = CActivities::format($act->title, $mood);
if (!empty($quoteContent) && $param->get('style') == COMMUNITY_STREAM_STYLE) {
    $attachment = new stdClass();
    $attachment->type = 'text';
    $attachment->message = $quoteContent;
    $attachment->hasMood = is_null($mood) ? false : true;
    /* Temporary fix for sprint 2 */
    if ($this->act instanceof CTableActivity) {
        /* If this's CTableActivity then we use getProperties() */
        $activity = new CActivity($this->act->getProperties());
    } else {
        /* If it's standard object than we just passing it */
        $activity = new CActivity($this->act);
    }
    $attachment->activity = $activity;
    $attachment->address = $activity->getLocation();
    $stream->attachments[] = $attachment;
}
$attachment = new stdClass();
$attachment->type = 'video';
$attachment->id = $act->cid;
$attachment->title = $video->title;
$attachment->thumbnail = $video->getThumbnail();
$attachment->description = $video->description;
$attachment->duration = CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration()));
$attachment->access = $act->access;
$attachment->video_type = $video->type;
$attachment->link = $video->path;
$stream->attachments[] = $attachment;
$this->set('stream', $stream);
$this->load('stream/base-extended');
Exemplo n.º 3
0
/**
 * Deprecated since 1.8
 */
function cToNiceHMS($hms)
{
    return CVideosHelper::toNiceHMS($hms);
}
            <a href="javascript:joms.walls.showVideoWindow('<?php 
echo $video->id;
?>
')" class="cVideo-Thumb">
                <div>
                    <img src="<?php 
echo $video->getThumbnail();
?>
"
                      alt="<?php 
echo $this->escape($video->title);
?>
"
                     />
                    <b><?php 
echo CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration()));
?>
</b>
                </div>
            </a>
        </div>
        <div class="span8">
            <article class="joms-stream-fetch-content" style="margin-left:0; padding-top:0">
                <a href="javascript:joms.walls.showVideoWindow('<?php 
echo $video->id;
?>
')"><?php 
echo $video->title;
?>
</a>
                <div class="separator"></div>
Exemplo n.º 5
0
 public static function formatStreamAttachment($obj)
 {
     switch ($obj->app) {
         case 'videos.linking':
             $video = JTable::getInstance('Video', 'CTable');
             $video->load($obj->cid);
             $attachment = new stdClass();
             $attachment->type = 'videos.linking';
             $attachment->type = 'video';
             $attachment->id = $obj->cid;
             $attachment->title = $video->title;
             $attachment->thumbnail = $video->getThumbnail();
             $attachment->description = $video->description;
             $attachment->duration = CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration()));
             $attachment->access = $obj->access;
             $attachment->video_type = $video->type;
             $attachment->link = $video->path;
             $attachment->video = $video;
             break;
         case 'profile.status.share':
             $params = new CParameter($obj->params);
             $act = JTable::getInstance('Activity', 'CTable');
             $act->load($params->get('activityId'));
             $attachment = self::formatStreamAttachment($act);
             break;
         case 'groups.wall':
         case 'events.wall':
         case 'profile':
             $params = new CParameter($obj->params);
             $headMetas = $params->get('headMetas', NULL);
             $headers = new CParameter($headMetas);
             if (!is_null($headers->get('title'))) {
                 $attachment = new stdClass();
                 $attachment->type = 'fetched';
                 $data = new stdClass();
                 $headers = new CParameter($headMetas);
                 $data->title = $headers->get('title');
                 $data->description = $headers->get('description');
                 $data->thumb = $headers->get('image');
                 $data->app = $obj->app;
                 $data->params = $obj->params;
                 $attachment->message = CActivityStream::formatSharePopup($data)->content;
             } else {
                 $attachment = new stdClass();
                 $attachment->type = 'quote';
                 $attachment->id = $obj->id;
                 $attachment->location = $obj->location;
                 $attachment->message = CActivities::format($obj->title, $params->get('mood'));
             }
             break;
         case 'videos':
             $video = JTable::getInstance('Video', 'CTable');
             $video->load($obj->cid);
             $attachment = new stdClass();
             $attachment->type = 'video';
             $attachment->id = $obj->cid;
             $attachment->title = $video->title;
             $attachment->thumbnail = $video->getThumbnail();
             $attachment->description = $video->description;
             $attachment->duration = CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration()));
             $attachment->link = $video->getURL();
             $attachment->video_type = $video->type;
             $attachment->link = $video->path;
             $attachment->video = $video;
             break;
         case 'photos':
             $params = new CParameter($obj->params);
             $count = $params->get('count', 1);
             $photoId = $params->get('photoid', 0);
             $photoIds = explode(',', $params->get('photosId', 0));
             $attachment = new stdClass();
             if ($count == 1 && $photoId > 0) {
                 $attachment->type = 'photo';
                 $photo = JTable::getInstance('Photo', 'CTable');
                 if ($photo->load($photoId) && $photo->status != 'delete') {
                     $attachment->singlephoto = $photo->getImageURI();
                     $attachment->caption = $photo->caption;
                     $attachment->thumbnail = $photo->getThumbURI();
                     $attachment->link = $params->get('photo_url');
                     $attachment->albumid = $photo->albumid;
                     $attachment->id = $photo->id;
                 }
             } elseif ($count > 1 && $photoId > 0) {
                 $attachment->type = 'photos';
                 $album = JTable::getInstance('Album', 'CTable');
                 $album->load($obj->cid);
                 if (count($photoIds) > 1) {
                     foreach ($photoIds as $pid) {
                         $photo = JTable::getInstance('Photo', 'CTable');
                         $photo->load($pid);
                         /* Make sure photo is not deleted */
                         if ($photo->status != 'delete') {
                             $photos[] = $photo;
                         }
                         foreach ($photos as $key => $data) {
                             if ($data->id == $photoId) {
                                 unset($photos[$key]);
                                 /* remove this photo */
                                 array_unshift($photos, $data);
                                 /* move it to beginning of array */
                             }
                         }
                     }
                 } else {
                     $photos = $album->getLatestPhoto($count);
                 }
                 $tmpIdArray = array();
                 $tmpAlbumArray = array();
                 $tmpUrlArray = array();
                 $tmpThumbArray = array();
                 $tmpCaptionArray = array();
                 if ($count >= 5) {
                     $photos = array_slice($photos, 0, 5);
                 }
                 foreach ($photos as $photo) {
                     $tmpIdArray[] = $photo->id;
                     $tmpAlbumArray[] = $photo->albumid;
                     $tmpThumbArray[] = $photo->getImageURI();
                     $tmpUrlArray[] = $photo->getPhotoLink();
                     $tmpCaptionArray[] = $photo->caption;
                 }
                 $attachment->id = $tmpIdArray;
                 $attachment->album = $tmpAlbumArray;
                 $attachment->link = $tmpUrlArray;
                 $attachment->thumbnail = $tmpThumbArray;
                 $attachment->caption = $tmpCaptionArray;
             }
             break;
         case 'groups':
             $attachment = new stdClass();
             $attachment->type = 'group_share';
             $group = JTable::getInstance('Group', 'CTable');
             $group->load($obj->cid);
             $attachment->message = new stdClass();
             $attachment->message->title = $group->name;
             $attachment->message->description = $group->description;
             $attachment->message->link = $group->getLink();
             break;
         case 'events':
             $attachment = new stdClass();
             $attachment->type = 'event_share';
             $event = JTable::getInstance('Event', 'CTable');
             $event->load($obj->cid);
             $attachment->message = $event;
             break;
         case 'cover.upload':
             $params = new CParameter($obj->params);
             $attachment = new stdClass();
             $attachment->type = 'cover';
             $attachment->thumbnail = $params->get('attachment');
             break;
         case 'profile.avatar.upload':
             $params = new CParameter($obj->params);
             $attachment = new stdClass();
             $attachment->type = 'profile_avatar';
             $attachment->thumbnail = $params->get('attachment');
             break;
         default:
             $attachment = new stdClass();
             $attachment->type = '';
             break;
     }
     return $attachment;
 }
Exemplo n.º 6
0
 /**
  * Return the content of acitivity stream
  */
 public static function getActivityContentHTML($act)
 {
     $html = '';
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $param = new CParameter($act->params);
     // Legacy issue. We could have either wall or video upload notice here
     $action = $param->get('action', 'upload');
     //CFactory::load( 'libraries' , 'wall' );
     // wall activity have either empty content (old) or $param action = 'wall'
     if ($action == 'wall') {
         // Only if the param wallid is specified that we could retrive the wall content
         $wallid = $param->get('wallid', false);
         if ($wallid) {
             $html = CWallLibrary::getWallContentSummary($wallid);
         }
     } elseif ($action == 'upload') {
         $video = $act->video;
         $url = $video->getViewUri();
         $template = 'activity.videos.upload';
         $tmpl = new CTemplate();
         $html = $tmpl->set('url', $url)->set('video', $video)->set('duration', CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration())))->fetch('videos.activity.upload');
     }
     return $html;
 }
Exemplo n.º 7
0
 /**
  * Return the content of acitivity stream
  */
 public static function getActivityContentHTML($act)
 {
     $html = '';
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $param = new CParameter($act->params);
     // Legacy issue. We could have either wall or video upload notice here
     $action = $param->get('action', 'upload');
     CFactory::load('libraries', 'wall');
     // wall activity have either empty content (old) or $param action = 'wall'
     if ($action == 'wall') {
         // Only if the param wallid is specified that we could retrive the wall content
         $wallid = $param->get('wallid', false);
         if ($wallid) {
             $html = CWallLibrary::getWallContentSummary($wallid);
         }
     } elseif ($action == 'upload') {
         CFactory::load('models', 'videos');
         $video = JTable::getInstance('Video', 'CTable');
         $video->load($act->cid);
         $url = $video->getViewUri();
         // Add tagging code
         /*
         $tagsHTML = '';
         if($config->get('tags_videos') && $config->get('tags_show_in_stream')){
         	CFactory::load('libraries', 'tags');
         	$tags = new CTags();
         	$tagsHTML = $tags->getHTML('videos', $video->id, false);
         }
         */
         $template = 'activity.videos.upload';
         $tmpl = new CTemplate();
         $html = $tmpl->set('url', $url)->set('video', $video)->set('duration', CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration())))->fetch('videos.activity.upload');
     }
     return $html;
 }
Exemplo n.º 8
0
 /**
  * Return the content of acitivity stream
  */
 static function getActivityContentHTML($act)
 {
     $html = '';
     $param = new JParameter($act->params);
     // Legacy issue. We could have either wall or video upload notice here
     $action = $param->get('action', 'upload');
     // wall activity have either empty content (old) or $param action = 'wall'
     if ($action == 'wall') {
         // Only if the param wallid is specified that we could retrive the wall content
         $wallid = $param->get('wallid', false);
         if ($wallid) {
             $config = CFactory::getConfig();
             CFactory::load('models', 'wall');
             $wall = JTable::getInstance('Wall', 'CTable');
             $wall->load($wallid);
             $tmpl = new CTemplate();
             $comment = JString::substr($wall->comment, 0, $config->getInt('streamcontentlength'));
             $tmpl->set('comment', CStringHelper::escape(JString::substr($comment, 0, $config->getInt('streamcontentlength'))));
             $html = $tmpl->fetch('activity.wall.post');
             //$html = JString::substr($wall->comment, 0, $config->getInt('streamcontentlength'));
         }
     } elseif ($action == 'upload') {
         CFactory::load('models', 'videos');
         $video = JTable::getInstance('Video', 'CTable');
         $video->load($act->cid);
         $url = $video->getViewUri();
         $template = 'activity.videos.upload';
         $tmpl = new CTemplate();
         $tmpl->set('url', $url);
         $tmpl->set('video', $video);
         $tmpl->set('duration', CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration())));
         $html = $tmpl->fetch('videos.activity.upload');
     }
     return $html;
 }