Esempio n. 1
0
 /**
  * Return the HTML formatted activity content
  */
 static function getActivityContent($act)
 {
     $cache = CFactory::getFastCache();
     $cacheid = __FILE__ . __LINE__ . serialize(func_get_args());
     if ($data = $cache->get($cacheid)) {
         return $data;
     }
     // Return empty content or content with old, invalid data
     // In some old version, some content might have 'This is the body'
     if ($act->content == 'This is the body') {
         return '';
     }
     $html = $act->content;
     // For known core, apps, we can simply call the content command
     switch ($act->app) {
         case 'videos':
             CFactory::load('libraries', 'videos');
             $html = CVideos::getActivityContentHTML($act);
             break;
         case 'photos':
             CFactory::load('libraries', 'photos');
             $html = CPhotos::getActivityContentHTML($act);
             break;
         case 'events':
             CFactory::load('libraries', 'events');
             $html = CEvents::getActivityContentHTML($act);
             break;
         case 'groups.wall':
         case 'groups':
             CFactory::load('libraries', 'groups');
             $html = CGroups::getActivityContentHTML($act);
             break;
         case 'groups.discussion.reply':
         case 'groups.discussion':
             CFactory::load('libraries', 'groups');
             $html = CGroups::getActivityContentHTML($act);
             break;
         case 'groups.bulletin':
             CFactory::load('libraries', 'groups');
             $html = CGroups::getActivityContentHTML($act);
         case 'system':
             CFactory::load('libraries', 'adminstreams');
             $html = CAdminstreams::getActivityContentHTML($act);
             break;
         case 'walls':
             // If a wall does not have any content, do not
             // display the summary
             if ($act->app == 'walls' && $act->cid == 0) {
                 $html = '';
                 return $html;
             }
             if ($act->cid != 0) {
                 CFactory::load('libraries', 'wall');
                 $html = CWall::getActivityContentHTML($act);
             }
             break;
         default:
             // for other unknown apps, we include the plugin see if it is is callable
             // we call the onActivityContentDisplay();
             CFactory::load('libraries', 'apps');
             $apps =& CAppPlugins::getInstance();
             $plugin =& $apps->get($act->app);
             $method = 'onActivityContentDisplay';
             if (is_callable(array($plugin, $method))) {
                 $args = array();
                 $args[] = $act;
                 $html = call_user_func_array(array($plugin, $method), $args);
             } else {
                 $html = $act->content;
             }
     }
     $cache->store($html, $cacheid, array('activities'));
     return $html;
 }
Esempio n. 2
0
 public function _convertVideos()
 {
     CFactory::load('libraries', 'videos');
     $videos = new CVideos();
     $videos->runConvert();
     if (trim($videos->errorMsg[0]) == 'No videos pending for conversion.') {
         $this->message[] = "No videos pending for conversion.";
     } else {
         if (strpos($videos->errorMsg[0], 'videos converted successfully')) {
             $this->message[] = $videos->errorMsg[0];
         } else {
             $this->message[] = 'Could not convert video';
         }
     }
 }
Esempio n. 3
0
if ($act->groupid) {
    $group = JTable::getInstance('Group', 'CTable');
    $group->load($act->groupid);
    $stream->group = $group;
    $act->appTitle = $group->name;
}
// get created date time
$date = JFactory::getDate($this->act->created);
if ($config->get('activitydateformat') == "lapse") {
    $createdTime = CTimeHelper::timeLapse($date);
} else {
    $createdTime = $date->format($config->get('profileDateFormat'));
}
$stream->actor = $user;
$stream->target = null;
$stream->headline = CVideos::getActivityTitleHTML($act);
$stream->message = "";
$stream->groupid = $act->groupid;
$stream->eventid = $act->eventid;
$stream->attachments = array();
$stream->access = $video->permissions;
$stream->createdtime = $createdTime;
$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() */
Esempio n. 4
0
 private function _convertVideos()
 {
     $videos = new CVideos();
     $videos->runConvert();
     if (trim($videos->errorMsg[0]) == 'No videos pending for conversion.') {
         $this->_message[] = "No videos pending for conversion.";
     } else {
         if (strpos($videos->errorMsg[0], 'videos converted successfully')) {
             $this->_message[] = $videos->errorMsg[0];
         } else {
             $this->_message[] = 'Could not convert video';
         }
     }
 }
Esempio n. 5
0
 /**
  * Return HTML formatted activity title
  */
 public static function getActivityTitle($act)
 {
     $cache = CFactory::getFastCache();
     $cacheid = __FILE__ . __LINE__ . serialize(func_get_args());
     if ($data = $cache->get($cacheid)) {
         return $data;
     }
     $html = '';
     $user = CFactory::getUser($act->actor);
     // For known core, apps, we can simply call the content command
     switch ($act->app) {
         case 'videos':
             $html = CVideos::getActivityTitleHTML($act);
             break;
         case 'photos':
             $html = CPhotos::getActivityTitleHTML($act);
             break;
         default:
             // For everything else, use User > Group format
             $html = '<a href="' . CUrlHelper::userLink($act->actor) . '">' . CStringHelper::escape($user->getDisplayName()) . '</a>';
     }
     $cache->store($html, $cacheid, array('activities'));
     return $html;
 }
Esempio n. 6
0
 /**
  * Return the HTML formatted activity contet
  */
 static function getActivityContent($act)
 {
     // Return empty content or content with old, invalid data
     // In some old version, some content might have 'This is the body'
     if ($act->content == 'This is the body') {
         return '';
     }
     $html = $act->content;
     // For know core, apps, we can simply call the content command
     switch ($act->app) {
         case 'videos':
             CFactory::load('libraries', 'videos');
             $html = CVideos::getActivityContentHTML($act);
             break;
         case 'photos':
             CFactory::load('libraries', 'photos');
             $html = CPhotos::getActivityContentHTML($act);
             break;
         case 'events':
             CFactory::load('libraries', 'events');
             $html = CEvents::getActivityContentHTML($act);
             break;
         case 'groups':
             CFactory::load('libraries', 'groups');
             $html = CGroups::getActivityContentHTML($act);
             break;
         case 'walls':
             // If a wall does not have any content, do not
             // display the summary
             if ($act->app == 'walls' && $act->cid == 0) {
                 $html = '';
                 return $html;
             }
         default:
             // for other unknown apps, we include the plugin see if it is is callable
             // we call the onActivityContentDisplay();
             CFactory::load('libraries', 'apps');
             $apps =& CAppPlugins::getInstance();
             $plugin =& $apps->get($act->app);
             $method = 'onActivityContentDisplay';
             if (is_callable(array($plugin, $method))) {
                 $args = array();
                 $args[] = $act;
                 $html = call_user_func_array(array($plugin, $method), $args);
             } else {
                 $html = $act->content;
             }
     }
     return $html;
 }
Esempio n. 7
0
 function _convertVideos()
 {
     CFactory::load('libraries', 'videos');
     $videos = new CVideos();
     $videos->runConvert();
     if ($videos->errorMsg[0]) {
         echo $videos->errorMsg[0];
     }
 }
Esempio n. 8
0
 public function createVideoThumbFromRemote(&$videoObj)
 {
     $thumbData = CRemoteHelper::getContent($video->thumb);
     if ($thumbData) {
         jimport('joomla.filesystem.file');
         $thumbPath = CVideos::getPath($table->creator, 'thumb');
         $thumbFileName = CFileHelper::getRandomFilename($thumbPath);
         $tmpThumbPath = $thumbPath . '/' . $thumbFileName;
         if (JFile::write($tmpThumbPath, $thumbData)) {
             // Get the image type first so we can determine what extensions to use
             $info = getimagesize($tmpThumbPath);
             $mime = image_type_to_mime_type($info[2]);
             $thumbExtension = CImageHelper::getExtension($mime);
             $thumbFilename = $thumbFileName . $thumbExtension;
             $thumbPath = $thumbPath . '/' . $thumbFilename;
             JFile::move($tmpThumbPath, $thumbPath);
             // Resize the thumbnails
             //CFactory::load( 'libraries', 'videos' );
             CImageHelper::resizeProportional($thumbPath, $thumbPath, $mime, CVideos::thumbSize('width'), CVideo::thumbSize('height'));
             // Save
             $config = CFactory::getConfig();
             $thumb = $config->get('videofolder') . '/' . VIDEO_FOLDER_NAME . '/' . $table->creator . '/' . VIDEO_THUMB_FOLDER_NAME . '/' . $thumbFilename;
             $table->set('thumb', $thumb);
             $table->store();
         }
     }
 }