本文整理汇总了PHP中CActivityStream::add方法的典型用法代码示例。如果您正苦于以下问题:PHP CActivityStream::add方法的具体用法?PHP CActivityStream::add怎么用?PHP CActivityStream::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActivityStream
的用法示例。
在下文中一共展示了CActivityStream::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAfterVote
function onAfterVote($poll, $option_id)
{
$user =& JFactory::getUser();
$points = JPATH_ROOT . '/components/com_community/libraries/core.php';
$activity = JPATH_ROOT . '/components/com_community/libraries/core.php';
if ($this->params->get('points', '0') == '1' && file_exists($points)) {
require_once $points;
CUserPoints::assignPoint('com_acepolls.vote');
}
if ($this->params->get('activity', '0') == '1' && file_exists($activity)) {
require_once $activity;
$text = JText::_('COM_ACEPOLLS_ACTIVITY_TEXT');
$link = JRoute::_('index.php?option=com_acepolls&view=poll&id=' . $poll->id . ":" . $poll->alias . self::getItemid($poll->id));
$act = new stdClass();
$act->cmd = 'wall.write';
$act->actor = $user->id;
$act->target = 0;
$act->title = JText::_('{actor} ' . $text . ' <a href="' . $link . '">' . $poll->title . '</a>');
$act->content = '';
$act->app = 'wall';
$act->cid = 0;
CFactory::load('libraries', 'activities');
CActivityStream::add($act);
}
}
示例2: add_stream
function add_stream($listing_id, $cids, $ctype = '')
{
include_once JPATH_BASE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
// load language strings for this component so we get translated activity stream messages
$lang =& JFactory::getLanguage();
$lang->load('com_relate');
$sql = "SELECT id, title, catid FROM #__content WHERE id = '{$listing_id}'";
$this->_db->setQuery($sql);
$listing = $this->_db->loadObject();
$listing_title = $listing->title;
$listing_href = CRoute::_('index.php?option=com_content&view=article&catid=' . $listing->catid . '&id=' . $listing->id);
$listing_link = '<a href="' . $listing_href . '">' . $listing_title . '</a>';
if ($ctype != '') {
$content_type = $ctype;
$category_id = 1;
$is_listing = false;
} else {
$sql = "SELECT l.id, l.catid, l.title, c.title AS cat_title FROM #__categories c, #__content l " . "WHERE c.id = l.catid AND l.id IN (" . implode(",", $cids) . ")";
$this->_db->setQuery($sql);
$content = $this->_db->loadObjectList('id');
$is_listing = true;
}
foreach ($cids as $cid) {
if ($is_listing) {
$content_title = $content[$cid]->title;
$content_type = $content[$cid]->cat_title;
$category_id = $content[$cid]->catid;
$content_id = $content[$cid]->id;
$href = CRoute::_('index.php?option=com_content&view=article&catid=' . $category_id . '&id=' . $content_id);
$content_link = '<a href="' . $href . '">' . $content_title . '</a>';
$content_info = $content_link . ' (' . $content_type . ')';
} else {
$content_id = $cid;
$tab = '';
if ($content_type == "photo") {
$tab = '#bilder';
} else {
if ($content_type == "video") {
$tab = '#video';
}
}
$content_link = '<a href="' . $listing_href . $tab . '">' . JText::_("a {$content_type}") . '</a>';
$content_info = $content_link;
}
$act = new stdClass();
$act->cmd = 'wall.write';
$act->actor = JFactory::getUser()->id;
$act->target = 0;
$act->title = JText::sprintf('RELATION ADDED', $content_info, $listing_link);
$act->content = '';
$act->app = 'wall';
$act->cid = $content_id;
CFactory::load('libraries', 'activities');
CActivityStream::add($act);
}
}
示例3: upload
//.........这里部分代码省略.........
//echo $orientation; exit;
// A newly uplaoded image might not be resized yet, do it now
$displayWidth = $config->getInt('photodisplaysize');
JRequest::setVar('imgid', $photoTable->id, 'GET');
JRequest::setVar('maxW', $displayWidth, 'GET');
JRequest::setVar('maxH', $displayWidth, 'GET');
$this->showimage(false);
// Rotata resized files ince it is smaller
switch ($orientation) {
case 1:
// nothing
break;
case 2:
// horizontal flip
// $image->flipImage($public,1);
break;
case 3:
// 180 rotate left
// $image->rotateImage($public,180);
CImageHelper::rotate($storedPath, $storedPath, 180);
CImageHelper::rotate($thumbPath, $thumbPath, 180);
break;
case 4:
// vertical flip
// $image->flipImage($public,2);
break;
case 5:
// vertical flip + 90 rotate right
//$image->flipImage($public, 2);
//$image->rotateImage($public, -90);
break;
case 6:
// 90 rotate right
// $image->rotateImage($public, -90);
CImageHelper::rotate($storedPath, $storedPath, -90);
CImageHelper::rotate($thumbPath, $thumbPath, -90);
break;
case 7:
// horizontal flip + 90 rotate right
// $image->flipImage($public,1);
// $image->rotateImage($public, -90);
break;
case 8:
// 90 rotate left
// $image->rotateImage($public, 90);
CImageHelper::rotate($storedPath, $storedPath, 90);
CImageHelper::rotate($thumbPath, $thumbPath, 90);
break;
}
}
// Trigger for onPhotoCreate
CFactory::load('libraries', 'apps');
$apps =& CAppPlugins::getInstance();
$apps->loadApplications();
$params = array();
$params[] =& $photoTable;
$apps->triggerEvent('onPhotoCreate', $params);
// Set image as default if necessary
// Load photo album table
if ($isDefaultPhoto) {
// Set the photo id
$album->photoid = $photoTable->id;
$album->store();
}
// @rule: Set first photo as default album cover if enabled
if (!$isDefaultPhoto && $config->get('autoalbumcover')) {
$photosModel = CFactory::getModel('Photos');
$totalPhotos = $photosModel->getTotalPhotos($album->id);
if ($totalPhotos <= 1) {
$album->photoid = $photoTable->id;
$album->store();
}
}
$act = new stdClass();
$act->cmd = 'photo.upload';
$act->actor = $my->id;
$act->access = $my->getParam('privacyPhotoView');
$act->target = 0;
$act->title = JText::sprintf($handler->getUploadActivityTitle(), '{photo_url}', $album->name);
$act->content = '<img src="' . rtrim(JURI::root(), '/') . '/' . $photoTable->thumbnail . '" style=\\"border: 1px solid #eee;margin-right: 3px;" />';
$act->app = 'photos';
$act->cid = $albumId;
$params = new JParameter('');
$params->set('multiUrl', $handler->getAlbumURI($albumId, false));
$params->set('photoid', $photoTable->id);
$params->set('action', 'upload');
$params->set('photo_url', $handler->getPhotoURI($albumId, $photoTable->id, false));
// Add activity logging
CFactory::load('libraries', 'activities');
CActivityStream::add($act, $params->toString());
//add user points
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('photo.upload');
// Photo upload was successfull, display a proper message
//$this->_showUploadError( false , JText::sprintf('CC PHOTO UPLOADED SUCCESSFULLY', $photoTable->caption ) , $photoTable->getThumbURI(), $albumId );
$returns[] = array('album_id' => $albumId, 'image_id' => $photoTable->id, 'caption' => $photoTable->caption, 'created' => $photoTable->created, 'storage' => $photoTable->storage, 'thumbnail' => $photoTable->getThumbURI(), 'image' => $photoTable->getImageURI());
}
return $returns;
exit;
}
示例4: pushToJomsocialActivity
function pushToJomsocialActivity($actor_id, $act_type = '', $act_subtype = '', $act_description = '', $act_link = '', $act_title = '', $act_access)
{
/*load Jomsocial core*/
$linkHTML = '';
$jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
if (file_exists($jspath)) {
include_once $jspath . DS . 'libraries' . DS . 'core.php';
}
//push activity
if ($act_title and $act_link) {
$linkHTML = '<a href="' . $act_link . '">' . $act_title . '</a>';
}
$act = new stdClass();
$act->cmd = 'wall.write';
$act->actor = $actor_id;
$act->target = 0;
// no target
$act->title = '{actor} ' . $act_description . ' ' . $linkHTML;
$act->content = '';
$act->app = 'wall';
$act->cid = 0;
$act->access = $act_access;
CFactory::load('libraries', 'activities');
if (defined('CActivities::COMMENT_SELF')) {
$act->comment_id = CActivities::COMMENT_SELF;
$act->comment_type = 'profile.location';
}
if (defined('CActivities::LIKE_SELF')) {
$act->like_id = CActivities::LIKE_SELF;
$act->like_type = 'profile.location';
}
$res = CActivityStream::add($act);
return true;
}
示例5: _addAvatarUploadActivity
private function _addAvatarUploadActivity($userid, $thumbnail)
{
if (CUserPoints::assignPoint('profile.avatar.upload')) {
// Generate activity stream.
$act = new stdClass();
$act->cmd = 'profile.avatar.upload';
$act->actor = $userid;
$act->target = 0;
$act->title = '';
$act->content = '';
$act->app = 'profile.avatar.upload';
$act->cid = 0;
$act->comment_id = CActivities::COMMENT_SELF;
$act->comment_type = 'profile.avatar.upload';
$act->like_id = CActivities::LIKE_SELF;
$act->like_type = 'profile.avatar.upload';
// We need to make a copy of current avatar and set it as stream 'attachement'
// which will only gets deleted once teh stream is deleted
$params = new JRegistry();
// store a copy of the avatar
$imageAttachment = str_replace('thumb_', 'stream_', $thumbnail);
$thumbnail = str_replace('thumb_', '', $thumbnail);
JFile::copy($thumbnail, $imageAttachment);
$params->set('attachment', $imageAttachment);
// Add activity logging
CActivityStream::add($act, $params->toString());
}
}
示例6: ajaxUpdate
/**
* Update the status of current user
*/
public function ajaxUpdate($message = '')
{
$filter = JFilterInput::getInstance();
$message = $filter->clean($message, 'string');
$cache = CFactory::getFastCache();
$cache->clean(array('activities'));
if (!COwnerHelper::isRegisteredUser()) {
return $this->ajaxBlockUnregister();
}
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$objResponse = new JAXResponse();
//@rule: In case someone bypasses the status in the html, we enforce the character limit.
$config = CFactory::getConfig();
if (JString::strlen($message) > $config->get('statusmaxchar')) {
$message = JHTML::_('string.truncate', $message, $config->get('statusmaxchar'));
}
//trim it here so that it wun go into activities stream.
$message = JString::trim($message);
$my = CFactory::getUser();
$status = $this->getModel('status');
// @rule: Spam checks
if ($config->get('antispam_akismet_status')) {
//CFactory::load( 'libraries' , 'spamfilter' );
$filter = CSpamFilter::getFilter();
$filter->setAuthor($my->getDisplayName());
$filter->setMessage($message);
$filter->setEmail($my->email);
$filter->setURL(CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id));
$filter->setType('message');
$filter->setIP($_SERVER['REMOTE_ADDR']);
if ($filter->isSpam()) {
$objResponse->addAlert(JText::_('COM_COMMUNITY_STATUS_MARKED_SPAM'));
return $objResponse->sendResponse();
}
}
$status->update($my->id, $message);
//set user status for current session.
$today = JFactory::getDate();
$message2 = empty($message) ? ' ' : $message;
$my->set('_status', $message2);
$my->set('_posted_on', $today->toSql());
$profileid = $jinput->get->get('userid', 0, 'INT');
//JRequest::getVar('userid' , 0 , 'GET');
if (COwnerHelper::isMine($my->id, $profileid)) {
$objResponse->addScriptCall("joms.jQuery('#profile-status span#profile-status-message').html('" . addslashes($message) . "');");
}
//CFactory::load( 'helpers' , 'string' );
// $message = CStringHelper::escape( $message );
if (!empty($message)) {
$act = new stdClass();
$act->cmd = 'profile.status.update';
$act->actor = $my->id;
$act->target = $my->id;
//CFactory::load( 'helpers' , 'linkgenerator' );
// @rule: Autolink hyperlinks
$message = CLinkGeneratorHelper::replaceURL($message);
// @rule: Autolink to users profile when message contains @username
$message = CUserHelper::replaceAliasURL($message);
$privacyParams = $my->getParams();
$act->title = $message;
$act->content = '';
$act->app = 'profile';
$act->cid = $my->id;
$act->access = $privacyParams->get('privacyProfileView');
$act->comment_id = CActivities::COMMENT_SELF;
$act->comment_type = 'profile.status';
$act->like_id = CActivities::LIKE_SELF;
$act->like_type = 'profile.status';
//add user points
//CFactory::load( 'libraries' , 'userpoints' );
if (CUserPoints::assignPoint('profile.status.update')) {
//only assign act if user points is set to true
CActivityStream::add($act);
}
//now we need to reload the activities streams (since some report regarding update status from hello me we disabled update the stream, cuz hellome usually called out from jomsocial page)
$friendsModel = CFactory::getModel('friends');
$memberSince = CTimeHelper::getDate($my->registerDate);
$friendIds = $friendsModel->getFriendIds($my->id);
//include_once(JPATH_COMPONENT .'/libraries/activities.php');
$act = new CActivityStream();
$params = $my->getParams();
$limit = !empty($params) ? $params->get('activityLimit', '') : '';
//$html = $act->getHTML($my->id, $friendIds, $memberSince, $limit );
$status = $my->getStatus();
$status = str_replace(array("\r\n", "\n", "\r"), "", $status);
$status = addslashes($status);
// also update hellome module if available
$script = "joms.jQuery('.joms-js--mod-hellome-label').html('" . $status . "');";
$script .= "joms.jQuery('.joms-js--mod-hellome-loading').hide();";
$objResponse->addScriptCall($script);
}
return $objResponse->sendResponse();
}
示例7: _createPhotoUploadStream
private function _createPhotoUploadStream($album, $jsonObj)
{
$obj = json_decode($jsonObj);
$photoIds = array();
$batchcount = count($obj->files);
foreach ($obj->files as $file) {
$photoIds[] = $file->photoId;
}
$photoTable = JTable::getInstance('Photo', 'cTable');
$photoTable->load($photoIds[count($photoIds) - 1]);
$my = CFactory::getUser();
$handler = $this->_getHandler($album);
// Generate activity stream
$act = new stdClass();
$act->cmd = 'photo.upload';
$act->actor = $my->id;
$act->access = $album->permissions;
$act->target = 0;
$act->title = '';
// Empty title, auto-generated by stream
$act->content = '';
// Gegenerated automatically by stream. No need to add anything
$act->app = 'photos';
$act->cid = $album->id;
$act->location = $album->location;
// Store group info
// I hate to load group here, but unfortunately, album does
// not store group permission setting
$group = JTable::getInstance('Group', 'CTable');
$group->load($album->groupid);
$act->groupid = $album->groupid;
$act->group_access = $group->approvals;
// Allow comment on the album
$act->comment_type = 'photos';
$act->comment_id = $photoTable->id;
// Allow like on the album
$act->like_type = 'photo';
$act->like_id = $photoTable->id;
$params = new CParameter('');
$params->set('multiUrl', $handler->getAlbumURI($album->id, false));
$params->set('photoid', $photoTable->id);
$params->set('action', 'upload');
$params->set('photo_url', $photoTable->getThumbURI());
$params->set('style', COMMUNITY_STREAM_STYLE);
// Get the upload count per session
$session = JFactory::getSession();
$uploadSessionCount = $session->get('album-' . $album->id . '-upload', 0);
$params->set('count', $uploadSessionCount);
$params->set('batchcount', $batchcount);
$params->set('photosId', implode(',', $photoIds));
// Add activity logging
CActivityStream::add($act, $params->toString());
}
示例8: ajaxStreamAdd
/**
* Called by status box to add new stream data
*
* @param type $message
* @param type $attachment
* @return type
*/
public function ajaxStreamAdd($message, $attachment, $streamFilter = FALSE)
{
$streamHTML = '';
// $attachment pending filter
$cache = CFactory::getFastCache();
$cache->clean(array('activities'));
$my = CFactory::getUser();
$userparams = $my->getParams();
if (!COwnerHelper::isRegisteredUser()) {
return $this->ajaxBlockUnregister();
}
//@rule: In case someone bypasses the status in the html, we enforce the character limit.
$config = CFactory::getConfig();
if (JString::strlen($message) > $config->get('statusmaxchar')) {
$message = JHTML::_('string.truncate', $message, $config->get('statusmaxchar'));
}
$message = JString::trim($message);
$objResponse = new JAXResponse();
$rawMessage = $message;
// @rule: Autolink hyperlinks
// @rule: Autolink to users profile when message contains @username
// $message = CUserHelper::replaceAliasURL($message); // the processing is done on display side
$emailMessage = CUserHelper::replaceAliasURL($rawMessage, true);
// @rule: Spam checks
if ($config->get('antispam_akismet_status')) {
$filter = CSpamFilter::getFilter();
$filter->setAuthor($my->getDisplayName());
$filter->setMessage($message);
$filter->setEmail($my->email);
$filter->setURL(CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id));
$filter->setType('message');
$filter->setIP($_SERVER['REMOTE_ADDR']);
if ($filter->isSpam()) {
$objResponse->addAlert(JText::_('COM_COMMUNITY_STATUS_MARKED_SPAM'));
return $objResponse->sendResponse();
}
}
$attachment = json_decode($attachment, true);
switch ($attachment['type']) {
case 'message':
//if (!empty($message)) {
switch ($attachment['element']) {
case 'profile':
//only update user status if share messgage is on his profile
if (COwnerHelper::isMine($my->id, $attachment['target'])) {
//save the message
$status = $this->getModel('status');
/* If no privacy in attachment than we apply default: Public */
if (!isset($attachment['privacy'])) {
$attachment['privacy'] = COMMUNITY_STATUS_PRIVACY_PUBLIC;
}
$status->update($my->id, $rawMessage, $attachment['privacy']);
//set user status for current session.
$today = JFactory::getDate();
$message2 = empty($message) ? ' ' : $message;
$my->set('_status', $rawMessage);
$my->set('_posted_on', $today->toSql());
// Order of replacement
$order = array("\r\n", "\n", "\r");
$replace = '<br />';
// Processes \r\n's first so they aren't converted twice.
$messageDisplay = str_replace($order, $replace, $message);
$messageDisplay = CKses::kses($messageDisplay, CKses::allowed());
//update user status
$objResponse->addScriptCall("joms.jQuery('#profile-status span#profile-status-message').html('" . addslashes($messageDisplay) . "');");
}
//if actor posted something to target, the privacy should be under target's profile privacy settings
if (!COwnerHelper::isMine($my->id, $attachment['target']) && $attachment['target'] != '') {
$attachment['privacy'] = CFactory::getUser($attachment['target'])->getParams()->get('privacyProfileView');
}
//push to activity stream
$act = new stdClass();
$act->cmd = 'profile.status.update';
$act->actor = $my->id;
$act->target = $attachment['target'];
$act->title = $message;
$act->content = '';
$act->app = $attachment['element'];
$act->cid = $my->id;
$act->access = $attachment['privacy'];
$act->comment_id = CActivities::COMMENT_SELF;
$act->comment_type = 'profile.status';
$act->like_id = CActivities::LIKE_SELF;
$act->like_type = 'profile.status';
$activityParams = new CParameter('');
/* Save cords if exists */
if (isset($attachment['location'])) {
/* Save geo name */
$act->location = $attachment['location'][0];
$act->latitude = $attachment['location'][1];
$act->longitude = $attachment['location'][2];
}
$headMeta = new CParameter('');
//.........这里部分代码省略.........
示例9: ajaxAddApp
public function ajaxAddApp($name, $position)
{
// Check permissions
$my =& JFactory::getUser();
if ($my->id == 0) {
return $this->ajaxBlockUnregister();
}
$filter = JFilterInput::getInstance();
$name = $filter->clean($name, 'string');
$position = $filter->clean($position, 'string');
// Add application
$appModel = CFactory::getModel('apps');
$appModel->addApp($my->id, $name, $position);
// Activity stream
$act = new stdClass();
$act->cmd = 'application.add';
$act->actor = $my->id;
$act->target = 0;
$act->title = JText::_('COM_COMMUNITY_ACTIVITIES_APPLICATIONS_ADDED');
$act->content = '';
$act->app = $name;
$act->cid = $my->id;
CFactory::load('libraries', 'activities');
CActivityStream::add($act);
// User points
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('application.add');
// Get application
$id = $appModel->getUserApplicationId($name, $my->id);
$appInfo = $appModel->getAppInfo($name);
$params = new CParameter($appModel->getPluginParams($id, null));
$isCoreApp = $params->get('coreapp');
$app->id = $id;
$app->title = isset($appInfo->title) ? $appInfo->title : '';
$app->description = isset($appInfo->description) ? $appInfo->description : '';
$app->isCoreApp = $isCoreApp;
$app->name = $name;
if (JFile::exists(CPluginHelper::getPluginPath('community', $name) . DS . $name . DS . 'favicon.png')) {
$app->favicon['16'] = rtrim(JURI::root(), '/') . CPluginHelper::getPluginURI('community', $name) . '/' . $name . '/favicon.png';
} else {
$app->favicon['16'] = rtrim(JURI::root(), '/') . '/components/com_community/assets/app_favicon.png';
}
$tmpl = new CTemplate();
$tmpl->set('apps', array($app));
$tmpl->set('itemType', 'edit');
$html = $tmpl->fetch('application.item');
$objResponse = new JAXResponse();
$objResponse->addScriptCall('joms.apps.showSettingsWindow', $app->id, $app->name);
$objResponse->addScriptCall('joms.editLayout.addAppToLayout', $position, $html);
// $objResponse->addScriptCall('cWindowHide();');
return $objResponse->sendResponse();
}
示例10: ajaxApproveRequest
/**
* Ajax function to approve a friend request
**/
public function ajaxApproveRequest($requestId)
{
$filter = JFilterInput::getInstance();
$requestId = $filter->clean($requestId, 'int');
if (!COwnerHelper::isRegisteredUser()) {
return $this->ajaxBlockUnregister();
}
$objResponse = new JAXResponse();
$my = CFactory::getUser();
$friendsModel = CFactory::getModel('friends');
if ($friendsModel->isMyRequest($requestId, $my->id)) {
$connected = $friendsModel->approveRequest($requestId);
if ($connected) {
$act = new stdClass();
$act->cmd = 'friends.request.approve';
$act->actor = $connected[0];
$act->target = $connected[1];
$act->title = '';
//JText::_('COM_COMMUNITY_ACTIVITY_FRIENDS_NOW');
$act->content = '';
$act->app = 'friends.connect';
$act->cid = 0;
$friendId = $connected[0] == $my->id ? $connected[1] : $connected[0];
$friend = CFactory::getUser($friendId);
//generate the activity if enabled
$userPointModel = CFactory::getModel('Userpoints');
$point = $userPointModel->getPointData('friends.request.approve');
if ($point->published) {
CActivityStream::add($act);
//add user points - give points to both party
//CFactory::load( 'libraries' , 'userpoints' );
CUserPoints::assignPoint('friends.request.approve');
CUserPoints::assignPoint('friends.request.approve', $friendId);
}
// Add the friend count for the current user and the connected user
$friendsModel->addFriendCount($connected[0]);
$friendsModel->addFriendCount($connected[1]);
// Add notification
//CFactory::load( 'libraries' , 'notification' );
$params = new CParameter('');
$params->set('url', 'index.php?option=com_community&view=profile&userid=' . $my->id);
$params->set('friend', $my->getDisplayName());
$params->set('friend_url', 'index.php?option=com_community&view=profile&userid=' . $my->id);
CNotificationLibrary::add('friends_create_connection', $my->id, $friend->id, JText::sprintf('COM_COMMUNITY_FRIEND_REQUEST_APPROVED'), '', 'friends.approve', $params);
$objResponse->addScriptCall('joms.jQuery("#msg-pending-' . $requestId . '").html("' . addslashes(JText::sprintf('COM_COMMUNITY_FRIENDS_NOW', $friend->getDisplayName())) . '");');
$objResponse->addScriptCall('joms.notifications.updateNotifyCount();');
$objResponse->addScriptCall('joms.jQuery("#noti-pending-' . $requestId . '").fadeOut(1000, function() { joms.jQuery("#noti-pending-' . $requestId . '").remove();} );');
$objResponse->addScriptCall('update_counter("#jsMenuNotif > .notifcount", -1);');
$objResponse->addScriptCall('update_counter("#jsMenuFriend > .notifcount", -1);');
//trigger for onFriendApprove
require_once JPATH_ROOT . '/components/com_community/controllers/friends.php';
$eventObject = new stdClass();
$eventObject->profileOwnerId = $my->id;
$eventObject->friendId = $friendId;
CommunityFriendsController::triggerFriendEvents('onFriendApprove', $eventObject);
unset($eventObject);
}
} else {
$objResponse->addScriptCall('joms.jQuery("#error-pending-' . $requestId . '").html("' . JText::_('COM_COMMUNITY_FRIENDS_NOT_YOUR_REQUEST') . '");');
$objResponse->addScriptCall('joms.jQuery("#error-pending-' . $requestId . '").attr("class", "error");');
}
return $objResponse->sendResponse();
}
示例11: addJomSocialActivityComment
public static function addJomSocialActivityComment($comment, $blogTitle)
{
$jsCoreFile = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
$config = EasyBlogHelper::getConfig();
// We do not want to add activities if new blog activity is disabled.
if (!$config->get('integrations_jomsocial_comment_new_activity')) {
return false;
}
if (JFile::exists($jsCoreFile)) {
require_once $jsCoreFile;
$config = EasyBlogHelper::getConfig();
$command = 'easyblog.comment.add';
$maxTitleLength = $config->get('jomsocial_blog_title_length', 80);
if (JString::strlen($blogTitle) > $maxTitleLength) {
$blogTitle = JString::substr($blogTitle, 0, $maxTitleLength) . '...';
}
$blogLink = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $comment->post_id, false, true) . '#comment-' . $comment->id;
$content = '';
if ($config->get('integrations_jomsocial_submit_content')) {
$content = $comment->comment;
$content = EasyBlogCommentHelper::parseBBCode($content);
$content = nl2br($content);
$content = strip_tags($content);
$content = JString::substr($content, 0, $config->get('integrations_jomsocial_comments_length'));
}
$obj = new stdClass();
if (!$comment->created_by) {
$obj->title = JText::sprintf('COM_EASYBLOG_JS_ACTIVITY_GUEST_COMMENT_ADDED', $blogLink, $blogTitle);
} else {
$obj->title = JText::sprintf('COM_EASYBLOG_JS_ACTIVITY_COMMENT_ADDED', $blogLink, $blogTitle);
}
$obj->content = $config->get('integrations_jomsocial_submit_content') ? $content : '';
$obj->cmd = $command;
$obj->actor = $comment->created_by;
$obj->target = 0;
$obj->app = 'easyblog';
$obj->cid = $comment->id;
if ($config->get('integrations_jomsocial_activity_likes')) {
$obj->like_id = $comment->id;
$obj->like_type = 'com_easyblog.comments';
}
if ($config->get('integrations_jomsocial_activity_comments')) {
$obj->comment_id = $comment->id;
$obj->comment_type = 'com_easyblog.comments';
}
// add JomSocial activities
CFactory::load('libraries', 'activities');
CActivityStream::add($obj);
}
}
示例12: defined
<?php
/**
* Example script for adding an entry to JomSocial wall. In this example, it just adds ...
* '{actor} sent {target} a drink'
* ... to the wall, getting {actor} from logged in user, and {target} from a field on the form.
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die;
include_once JPATH_BASE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
$myuser =& JFactory::getUser();
$act = new stdClass();
$act->cmd = 'wall.write';
$act->actor = $myuser->get('id');
$act->target = $fabrikFormData['other_user_raw'];
$act->title = JText::_('{actor} sent {target} a drink');
$act->content = '';
$act->app = 'wall';
$act->cid = 0;
CFactory::load('libraries', 'activities');
CActivityStream::add($act);
示例13: refundDeal
function refundDeal($user_id, $point)
{
$api_AUP = JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'userpoints.php';
require_once $api_AUP;
$juser =& JFactory::getUser($userId);
if ($juser->id != 0) {
$aid = $juser->aid;
if (is_null($aid)) {
$aid = 0;
$acl =& JFactory::getACL();
$grp = $acl->getAroGroup($juser->id);
$group = 'USERS';
if ($acl->is_group_child_of($grp->name, $group)) {
$aid = 1;
// Fudge Authors, Editors, Publishers and Super Administrators into the special access group
if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) {
$aid = 2;
}
}
}
$user = CFactory::getUser($userId);
$points = $user->getKarmaPoint();
$point = $point / 2;
$user->_points = $points - $point;
$user->save();
$act = new stdClass();
$act->cmd = 'wall.write';
$act->actor = $user_id;
$act->target = 0;
$act->title = JText::_('{actor} just refund a Deal');
$act->content = '';
$act->app = 'wall';
$act->cid = 0;
CFactory::load('libraries', 'activities');
CActivityStream::add($act);
}
}
示例14: onAfterThankyou
public function onAfterThankyou($target, $actor, $message)
{
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('com_kunena.thread.thankyou', $target);
$username = KunenaFactory::getUser($actor)->username;
$act = new stdClass();
$act->cmd = 'wall.write';
$act->actor = JFactory::getUser()->id;
$act->target = $target;
$act->title = JText::_('{single}{actor}{/single}{multiple}{actors}{/multiple} ' . JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_THANKYOU_TITLE', $username));
$act->content = NULL;
$act->app = 'kunena.thankyou';
$act->cid = $target;
$act->access = $this->getAccess($message->getCategory());
// Comments and like support
$act->comment_id = $target;
$act->comment_type = 'kunena.thankyou';
$act->like_id = $target;
$act->like_type = 'kunena.thankyou';
// Do not add private activities
if ($act->access > 20) {
return;
}
CFactory::load('libraries', 'activities');
CActivityStream::add($act);
}
示例15: streamActivity
function streamActivity($action, $obj)
{
global $option;
$app =& JFactory::getApplication();
$cwConfig = $app->getUserState(SESSION_CONFIG);
$user =& JFactory::getUser();
$menu =& JSite::getMenu();
$mnuitems = $menu->getItems('link', 'index.php?option=' . $option . '&view=crosswords');
$itemid = isset($mnuitems[0]) ? '&Itemid=' . $mnuitems[0]->id : '';
if (strcasecmp($cwConfig[ACTIVITY_STREAM_TYPE], COMPONENT_JOMSOCIAL) == 0) {
$API = JPATH_SITE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'userpoints.php';
if (file_exists($API)) {
include_once $API;
$act = new stdClass();
$act->cmd = 'wall.write';
$act->actor = $user->id;
$act->target = 0;
// no target
$act->content = '';
$act->app = 'wall';
$act->cid = 0;
switch ($action) {
case 1:
// New question
$act->title = JText::_('{actor} ' . JText::_('TXT_SUBMITTED_CROSSWORD_QUESTION'));
break;
case 2:
// Solved crossword
$text = JText::_('TXT_SOLVED_CROSSWORD');
$link = JRoute::_('index.php?option=' . $option . '&view=crosswords&task=view&id=' . $obj->id . ':' . $obj->alias . $itemid);
$act->title = JText::_('{actor} ' . $text . ' <a href="' . $link . '">' . $obj->title . '</a>');
break;
}
CFactory::load('libraries', 'activities');
CActivityStream::add($act);
}
} else {
if (strcasecmp($cwConfig[ACTIVITY_STREAM_TYPE], 'touch') == 0) {
$API = JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'api.php';
if (file_exists($API)) {
require_once $API;
$capi = new JSCommunityApi();
if ($user->id) {
$link = JRoute::_('index.php?option=' . $option . '&view=crosswords&task=view&id=' . $obj->id . ":" . $obj->alias . $itemid);
$icon = JURI::base() . 'components/' . $option . '/assets/images/logo.png';
$text = '';
switch ($action) {
case 1:
// New question
$text = $user->{$cwConfig}[USER_NAME] . ' ' . JText::_('TXT_SUBMITTED_CROSSWORD_QUESTION');
break;
case 2:
// solved crossword
$text = $user->{$cwConfig}[USER_NAME] . ' ' . JText::_('TXT_SOLVED_CROSSWORD') . ' <a href="' . $link . '">' . $obj->title . '</a>';
break;
}
$capi->registerActivity(0, $text, $user->get('id'), $icon, 'user', null, $option, '', 'Crosswords');
}
}
}
}
}