本文整理汇总了PHP中CActivityStream::formatSharePopup方法的典型用法代码示例。如果您正苦于以下问题:PHP CActivityStream::formatSharePopup方法的具体用法?PHP CActivityStream::formatSharePopup怎么用?PHP CActivityStream::formatSharePopup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActivityStream
的用法示例。
在下文中一共展示了CActivityStream::formatSharePopup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajaxSharePopup
/**
* Function to call Popup window for share status
* @param [int] $activityId [activity stream id]
* @return
*/
public function ajaxSharePopup($activityId)
{
$my = CFactory::getUser();
if ($my->id == 0) {
$this->ajaxBlockUnregister();
}
$act = JTable::getInstance('Activity', 'CTable');
$act->load($activityId);
$user = CFactory::getUser($act->creator);
$act = CActivityStream::formatSharePopup($act);
if (!empty($act->params)) {
if (!is_object($act->params)) {
$act->params = new JRegistry($act->params);
}
$mood = $act->params->get('mood', null);
} else {
$mood = null;
}
switch ($act->app) {
case 'groups.discussion':
$db = JFactory::getDbo();
$query = ' SELECT `d`.`title`, `d`.`message`, `g`.`name`, `g`.`description`, `g`.`id` ';
$query .= ' FROM ' . $db->quoteName('#__community_groups_discuss') . ' AS `d` ';
$query .= ' INNER JOIN ' . $db->quoteName('#__community_groups') . ' AS `g` ON `g`.`id` = `d`.`groupid` ';
$query .= ' WHERE `d`.`id` = ' . (int) $act->cid;
$db->setQuery($query);
$data = $db->loadObject();
break;
}
$tmpl = new CTemplate();
isset($data) ? $tmpl->set('data', $data) : null;
$tmpl->set('act', $act)->set('user', $user)->set('mood', $mood);
$html = $tmpl->fetch('ajax.showsharepopup');
$json = array('title' => JText::_('COM_COMMUNITY_SHARE_STATUS_TITLE'), 'html' => $html, 'btnShare' => JText::_('COM_COMMUNITY_SHARE'), 'btnCancel' => JText::_('COM_COMMUNITY_CANCEL_BUTTON'));
die(json_encode($json));
}
示例2: formatStreamAttachment
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 */
//.........这里部分代码省略.........