当前位置: 首页>>代码示例>>PHP>>正文


PHP CActivityStream::removeActor方法代码示例

本文整理汇总了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));
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:48,代码来源:system.php

示例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;
//.........这里部分代码省略.........
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:101,代码来源:events.php


注:本文中的CActivityStream::removeActor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。