本文整理汇总了PHP中CActivityStream::removeActor方法的典型用法代码示例。如果您正苦于以下问题:PHP CActivityStream::removeActor方法的具体用法?PHP CActivityStream::removeActor怎么用?PHP CActivityStream::removeActor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActivityStream
的用法示例。
在下文中一共展示了CActivityStream::removeActor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajaxUnlike
/**
* Unlike an item
* @param string $element Can either be core object (photos/videos) or a plugins (plugins,plugin_name)
* @param mixed $itemId Unique id to identify object item
*
*/
public function ajaxUnlike($element, $itemId)
{
$filter = JFilterInput::getInstance();
$itemId = $filter->clean($itemId, 'int');
$element = $filter->clean($element, 'string');
if (!COwnerHelper::isRegisteredUser()) {
return $this->ajaxBlockUnregister();
}
$my = CFactory::getUser();
$objResponse = new JAXResponse();
// Load libraries
$unlike = new CLike();
if (!$unlike->enabled($element)) {
} else {
$unlike->unlike($element, $itemId);
$likeCount = $unlike->getLikeCount($element, $itemId);
$html = $unlike->getHTML($element, $itemId, $my->id);
$objResponse->addScriptCall('__callback', $html);
}
$act = new stdClass();
$act->cmd = $element . '.like';
$act->actor = $my->id;
$act->target = 0;
$act->title = '';
$act->content = '';
$act->app = $element . '.like';
$act->cid = $itemId;
$params = new CParameter('');
switch ($element) {
case 'groups':
$act->groupid = $itemId;
break;
case 'events':
$act->eventid = $itemId;
break;
}
$params->set('action', $element . '.like');
// Remove logging
CActivityStream::removeActor($act, $params->toString());
$json = array('success' => true, 'likeCount' => $likeCount);
die(json_encode($json));
}
示例2: ajaxUpdateStatus
public function ajaxUpdateStatus($eventId, $status)
{
$filter = JFilterInput::getInstance();
$eventId = $filter->clean($eventId, 'int');
$status = $filter->clean($status, 'int');
$target = null;
if (!COwnerHelper::isRegisteredUser()) {
return $this->ajaxBlockUnregister();
}
$my = CFactory::getUser();
$json = array();
$memberId = $my->id;
$modal = $this->getModel('events');
$event = JTable::getInstance('Event', 'CTable');
$event->load($eventId);
//CFactory::load( 'helpers' , 'event' );
$handler = CEventHelper::getHandler($event);
if (!$handler->isAllowed()) {
$json['error'] = JText::_('COM_COMMUNITY_ACCESS_FORBIDDEN');
die(json_encode($json));
}
if ($event->ticket && ($status == COMMUNITY_EVENT_STATUS_ATTEND && $event->confirmedcount + 1 > $event->ticket)) {
$json['error'] = JText::_('COM_COMMUNITY_EVENTS_TICKET_FULL');
die(json_encode($json));
}
$eventMember = JTable::getInstance('EventMembers', 'CTable');
$keys = array('eventId' => $eventId, 'memberId' => $memberId);
$eventMember->load($keys);
if ($eventMember->permission != 1 && $eventMember->permission != 2) {
$eventMember->permission = 3;
}
$date = JFactory::getDate();
$eventMember->created = $date->toSql();
$eventMember->status = $status;
$eventMember->store();
$event->updateGuestStats();
$event->store();
// trigger on event join.
$this->triggerEvents('onEventJoin', $event);
//activities stream goes here.
$url = $handler->getFormattedLink('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id, false);
// We update the activity only if a user attend an event and the event was set to public event
if ($status == COMMUNITY_EVENT_STATUS_ATTEND && $handler->isPublic()) {
$command = 'events.attendence.attend';
$actor = $my->id;
$target = 0;
$content = '';
$cid = $event->id;
$app = 'events.attend';
$act = $handler->getActivity($command, $actor, $target, $content, $cid, $app);
$act->eventid = $event->id;
$params = new CParameter('');
$action_str = 'events.attendence.attend';
$params->set('eventid', $event->id);
$params->set('action', $action_str);
$params->set('event_url', $url);
// Add activity logging
CActivityStream::addActor($act, $params->toString());
}
if ($status == COMMUNITY_EVENT_STATUS_WONTATTEND) {
$command = 'events.attendence.attend';
$actor = $my->id;
$target = 0;
$content = '';
$cid = $event->id;
$app = 'events.attend';
$act = $handler->getActivity($command, $actor, $target, $content, $cid, $app);
$act->eventid = $event->id;
$params = new CParameter('');
$action_str = 'events.attendence.attend';
$params->set('eventid', $event->id);
$params->set('action', $action_str);
$params->set('event_url', $url);
CActivityStream::removeActor($act, $params->toString());
}
//trigger goes here.
$appsLib = CAppPlugins::getInstance();
$appsLib->loadApplications();
$params = array();
$params[] = $event;
$params[] = $my->id;
$params[] = $status;
if (!is_null($target)) {
$params[] = $target;
}
$this->cacheClean(array(COMMUNITY_CACHE_TAG_EVENTS, COMMUNITY_CACHE_TAG_ACTIVITIES));
$html = CEvents::getEventMemberHTML($event->id);
if ($status == COMMUNITY_EVENT_STATUS_ATTEND) {
$RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_ATTENDING_EVENT_MESSAGE');
} else {
if ($status == COMMUNITY_EVENT_STATUS_MAYBE) {
$RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_MAYBE_ATTENDING_EVENT_MESSAGE');
} else {
$RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_NOT_ATTENDING_EVENT_MESSAGE');
}
}
$json['success'] = true;
$json['html'] = $html;
if (isset($RSVPmessage)) {
$json['message'] = $RSVPmessage;
//.........这里部分代码省略.........