Пример #1
0
 function onActivityContentDisplay($args)
 {
     $model =& CFactory::getModel('Wall');
     $wall =& JTable::getInstance('Wall', 'CTable');
     $my = CFactory::getUser();
     if (empty($args->content)) {
         return '';
     }
     $wall->load($args->cid);
     CFactory::load('libraries', 'privacy');
     CFactory::load('libraries', 'comment');
     $comment = CComment::stripCommentData($wall->comment);
     $config = CFactory::getConfig();
     $commentcut = false;
     if (strlen($comment) > $config->getInt('streamcontentlength')) {
         $origcomment = $comment;
         $comment = JString::substr($comment, 0, $config->getInt('streamcontentlength')) . ' ...';
         $commentcut = true;
     }
     if (CPrivacy::isAccessAllowed($my->id, $args->target, 'user', 'privacyProfileView')) {
         CFactory::load('helpers', 'videos');
         CFactory::load('libraries', 'videos');
         CFactory::load('libraries', 'wall');
         $videoContent = '';
         $params = new CParameter($args->params);
         $videoLink = $params->get('videolink');
         $image = $params->get('url');
         // For older activities that does not have videoLink , we need to process it the old way.
         if (!$videoLink) {
             $html = CWallLibrary::_processWallContent($comment);
             $tmpl = new CTemplate();
             $html = CStringHelper::escape($html);
             if ($commentcut) {
                 //add read more/less link for content
                 $html .= '<br /><br /><a href="javascript:void(0)" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').hide(); jQuery(\'#origcomment_' . $args->cid . '\').show();" >' . JText::_('COM_COMMUNITY_READ_MORE') . '</a>';
                 $html = '<div id="shortcomment_' . $args->cid . '">' . $html . '</div>';
                 $html .= '<div id="origcomment_' . $args->cid . '" style="display:none;">' . $origcomment . '<br /><br /><a href="javascript:void(0);" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').show(); jQuery(\'#origcomment_' . $args->cid . '\').hide();" >' . JText::_('COM_COMMUNITY_READ_LESS') . '</a></div>';
             }
             $tmpl->set('comment', $html);
             $html = $tmpl->fetch('activity.wall.post');
         } else {
             $html = '<ul class ="cDetailList clrfix">';
             $html .= '<li>';
             $image = !$image ? rtrim(JURI::root(), '/') . '/components/com_community/assets/playvideo.gif' : $image;
             $videoLib = new CVideoLibrary();
             $provider = $videoLib->getProvider($videoLink);
             $html .= '<!-- avatar --><div class="avatarWrap"><a href="javascript:void(0);" onclick="joms.activities.showVideo(\'' . $args->id . '\');"><img width="64" src="' . $image . '" class="cAvatar"/></a></div><!-- avatar -->';
             $videoPlayer = $provider->getViewHTML($provider->getId(), '300', '300');
             $comment = CString::str_ireplace($videoLink, '', $comment);
             $html .= '<!-- details --><div class="detailWrap alpha">' . $comment . '</div><!-- details -->';
             if (!empty($videoPlayer)) {
                 $html .= '<div style="display: none;clear: both;padding-top: 5px;" class="video-object">' . $videoPlayer . '</div>';
             }
             $html .= '</li>';
             $html .= '</ul>';
         }
         return $html;
     }
 }
Пример #2
0
 function _getWallHTML($wall, $wallComments, $appType, $isOwner, $processFunc, $templateFile)
 {
     CFactory::load('helpers', 'url');
     CFactory::load('helpers', 'user');
     CFactory::load('helpers', 'videos');
     CFactory::load('libraries', 'comment');
     CFactory::load('helpers', 'owner');
     CFactory::load('helpers', 'time');
     $user = CFactory::getUser($wall->post_by);
     $date = CTimeHelper::getDate($wall->date);
     $config = CFactory::getConfig();
     // @rule: for site super administrators we want to allow them to view the remove link
     $isOwner = COwnerHelper::isCommunityAdmin() ? true : $isOwner;
     $isEditable = CWall::isEditable($processFunc, $wall->id);
     // Apply any post processing on the content
     $wall->comment = CWallLibrary::_processWallContent($wall->comment);
     $commentsHTML = '';
     $comment = new CComment();
     // If the wall post is a user wall post (in profile pages), we
     // add wall comment feature
     if ($appType == 'user' || $appType == 'groups' || $appType == 'events') {
         $commentsHTML = $comment->getHTML($wallComments, 'wall-cmt-' . $wall->id, CWall::canComment($wall->type, $wall->contentid));
     }
     $avatarHTML = CUserHelper::getThumb($wall->post_by, 'avatar');
     //var_dump($avatarHTML);exit;
     // @rule: We only allow editing of wall in 15 minutes
     $now = JFactory::getDate();
     $interval = CTimeHelper::timeIntervalDifference($wall->date, $now->toMySQL());
     $interval = COMMUNITY_WALLS_EDIT_INTERVAL - abs($interval);
     $editInterval = round($interval / 60);
     // Create new instance of the template
     $tmpl = new CTemplate();
     $tmpl->set('id', $wall->id);
     $tmpl->set('author', $user->getDisplayName());
     $tmpl->set('avatarHTML', $avatarHTML);
     $tmpl->set('authorLink', CUrlHelper::userLink($user->id));
     $tmpl->set('created', $date->toFormat(JText::_('DATE_FORMAT_LC2')));
     $tmpl->set('content', $wall->comment);
     $tmpl->set('commentsHTML', $commentsHTML);
     $tmpl->set('avatar', $user->getThumbAvatar());
     $tmpl->set('isMine', $isOwner);
     $tmpl->set('isEditable', $isEditable);
     $tmpl->set('editInterval', $editInterval);
     $tmpl->set('processFunc', $processFunc);
     $tmpl->set('config', $config);
     return $tmpl->fetch($templateFile);
 }