本文整理汇总了PHP中CActivityStream::getActivityContent方法的典型用法代码示例。如果您正苦于以下问题:PHP CActivityStream::getActivityContent方法的具体用法?PHP CActivityStream::getActivityContent怎么用?PHP CActivityStream::getActivityContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActivityStream
的用法示例。
在下文中一共展示了CActivityStream::getActivityContent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajaxGetContent
/**
* Get content for activity based on the activity id.
*
* @params $activityId Int Activity id
**/
public function ajaxGetContent($activityId)
{
$my = CFactory::getUser();
$showMore = true;
$objResponse = new JAXResponse();
$model = CFactory::getModel('Activities');
CFactory::load('libraries', 'privacy');
CFactory::load('libraries', 'activities');
// These core apps has default privacy issues with it
$coreapps = array('photos', 'walls', 'videos', 'groups');
// make sure current user has access to the content item
// For known apps, we can filter this manually
$activity = $model->getActivity($activityId);
if (in_array($activity->app, $coreapps)) {
CFactory::load('helpers', 'privacy');
switch ($activity->app) {
case 'walls':
// make sure current user has permission to the profile
$showMore = CPrivacy::isAccessAllowed($my->id, $activity->target, 'user', 'privacyProfileView');
break;
case 'videos':
// Each video has its own privacy setting within the video itself
CFactory::load('models', 'videos');
$video = JTable::getInstance('Video', 'CTable');
$video->load($activity->cid);
$showMore = CPrivacy::isAccessAllowed($my->id, $activity->actor, 'custom', $video->permissions);
break;
case 'photos':
// for photos, we uses the actor since the target is 0 and he
// is doing the action himself
$showMore = CPrivacy::isAccessAllowed($my->id, $activity->actor, 'user', 'privacyPhotoView');
break;
case 'groups':
}
} else {
// if it is not one of the core apps, we should allow plugins to decide
// if they want to block the 'more' view
}
if ($showMore) {
$act = $model->getActivity($activityId);
$content = CActivityStream::getActivityContent($act);
$objResponse->addScriptCall('joms.activities.setContent', $activityId, $content);
} else {
$content = JText::_('CC ACCESS FORBIDDEN');
$content = nl2br($content);
$content = JString::str_ireplace("\n", '', $content);
$objResponse->addScriptCall('joms.activities.setContent', $activityId, $content);
}
$objResponse->addScriptCall('joms.tooltip.setup();');
return $objResponse->sendResponse();
}