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


PHP CActivityStream::addActor方法代码示例

本文整理汇总了PHP中CActivityStream::addActor方法的典型用法代码示例。如果您正苦于以下问题:PHP CActivityStream::addActor方法的具体用法?PHP CActivityStream::addActor怎么用?PHP CActivityStream::addActor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CActivityStream的用法示例。


在下文中一共展示了CActivityStream::addActor方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ajaxLike

 /**
  * Like an item. Update ajax count
  * @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 ajaxLike($element, $itemId)
 {
     $filter = JFilterInput::getInstance();
     $element = $filter->clean($element, 'string');
     $itemId = $filter->clean($itemId, 'int');
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $like = new CLike();
     if (!$like->enabled($element)) {
         // @todo: return proper ajax error
         return;
     }
     $my = CFactory::getUser();
     $objResponse = new JAXResponse();
     $like->addLike($element, $itemId);
     $likeCount = $like->getLikeCount($element, $itemId);
     $html = $like->getHTML($element, $itemId, $my->id);
     $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;
     if ($element == 'album') {
         $album = JTable::getInstance('Album', 'CTable');
         $album->load($itemId);
         if ($album->type == 'event') {
             $act->eventid = $album->eventid;
         }
     } elseif ($element == 'photo') {
         $photo = JTable::getInstance('Photo', 'CTable');
         $photo->load($itemId);
         $album = JTable::getInstance('Album', 'CTable');
         $album->load($photo->albumid);
         if ($album->type == 'event') {
             $act->eventid = $album->eventid;
         }
     } elseif ($element == 'videos') {
         $video = JTable::getInstance('Video', 'CTable');
         $video->load($itemId);
         $act->eventid = $video->eventid;
         $act->groupid = $video->groupid;
     }
     // load item-specific privacy settings, if available
     $table = JTable::getInstance($element, 'CTable');
     if (is_object($table)) {
         $table->load($itemId);
         if (isset($table->permissions)) {
             $act->access = $table->permissions;
         }
     }
     $params = new CParameter('');
     switch ($element) {
         case 'groups':
             $act->groupid = $itemId;
             //@since 4.1 when a group is liked, dump the data into photo stats
             $statsModel = CFactory::getModel('stats');
             $statsModel->addGroupStats($itemId, 'like');
             break;
         case 'events':
             $act->eventid = $itemId;
             //@since 4.1 when an event is liked, dump the data into event stats
             $statsModel = CFactory::getModel('stats');
             $statsModel->addEventStats($itemId, 'like');
             break;
     }
     $params->set('action', $element . '.like');
     // Add logging
     CActivityStream::addActor($act, $params->toString());
     $json = array('success' => true, 'likeCount' => $likeCount);
     die(json_encode($json));
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:81,代码来源:system.php

示例2: ajaxAdd

 /**
  * Add an application for the user
  *
  * @param    $name    string Application name / element
  */
 public function ajaxAdd($name)
 {
     // Check permissions
     $my = CFactory::getUser();
     $filter = JFilterInput::getInstance();
     $name = $filter->clean($name, 'string');
     if ($my->id == 0) {
         return $this->ajaxBlockUnregister();
     }
     $objResponse = new JAXResponse();
     $appModel = CFactory::getModel('apps');
     // Get List of added apps
     $apps = $appModel->getAvailableApps();
     $addedApps = array();
     for ($i = 0; $i < count($apps); $i++) {
         $app = $apps[$i];
         if ($appModel->isAppUsed($my->id, $app->name)) {
             $addedApps[] = $app;
         }
     }
     $appModel->addApp($my->id, $name);
     $theApp = $appModel->getAppInfo($name);
     $appId = $appModel->getUserApplicationId($name, $my->id);
     $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 = 'app.install.' . $name;
     $act->cid = 0;
     $params = new JRegistry('');
     $params->set('app', $name);
     CActivityStream::addActor($act, $params->toString());
     //CFactory::load( 'libraries' , 'userpoints' );
     CUserPoints::assignPoint('application.add');
     // Change cWindow title
     $objResponse->addAssign('cwin_logo', 'innerHTML', JText::_('COM_COMMUNITY_ADD_APPLICATION_TITLE'));
     $formAction = CRoute::_('index.php?option=com_community&view=friends&task=deleteSent', false);
     $action = '<form name="cancelRequest" action="" method="POST">';
     $action .= '<input type="button" class="input button" name="save" onclick="joms.apps.showSettingsWindow(\'' . $appId . '\',\'' . $name . '\');" value="' . JText::_('COM_COMMUNITY_VIDEOS_SETTINGS_BUTTON') . '" />&nbsp;';
     $action .= '<input type="button" class="input button" onclick="cWindowHide();return false;" name="cancel" value="' . JText::_('COM_COMMUNITY_BUTTON_CLOSE_BUTTON') . '" />';
     $action .= '</form>';
     $html = '<div class="ajax-notice-apps-added">' . JText::_('COM_COMMUNITY_APPS_AJAX_ADDED') . '</div>';
     $objResponse->addScriptCall('cWindowAddContent', $html, $action);
     $objResponse->addScriptCall("joms.jQuery('." . $name . " .added-button').remove();");
     $objResponse->addScriptCall("joms.jQuery('." . $name . "').append('<span class=\"added-ribbon\">" . JText::_('COM_COMMUNITY_APPS_LIST_ADDED') . "</span>');");
     return $objResponse->sendResponse();
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:55,代码来源:apps.php

示例3: joinApproved

 /**
  *
  */
 public static function joinApproved($groupId, $userid)
 {
     $group = JTable::getInstance('Group', 'CTable');
     $member = JTable::getInstance('GroupMembers', 'CTable');
     $group->load($groupId);
     $act = new stdClass();
     $act->cmd = 'group.join';
     $act->actor = $userid;
     $act->target = 0;
     $act->title = '';
     //JText::sprintf('COM_COMMUNITY_GROUPS_GROUP_JOIN' , '{group_url}' , $group->name );
     $act->content = '';
     $act->app = 'groups.join';
     $act->cid = $group->id;
     $act->groupid = $group->id;
     $params = new CParameter('');
     $params->set('group_url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
     $params->set('action', 'group.join');
     // Add logging
     if (CUserPoints::assignPoint('group.join')) {
         CActivityStream::addActor($act, $params->toString());
     }
     // Store the group and update stats
     $group->updateStats();
     $group->store();
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:29,代码来源:groups.php

示例4: ajaxGroupJoinRequest

 /**
  * Ajax function to accept Private Group Request
  *
  **/
 public function ajaxGroupJoinRequest($memberId, $groupId)
 {
     $filter = JFilterInput::getInstance();
     $groupId = $filter->clean($groupId, 'int');
     $memberId = $filter->clean($memberId, 'int');
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $objResponse = new JAXResponse();
     $my = CFactory::getUser();
     $model = $this->getModel('groups');
     //CFactory::load( 'helpers' , 'owner' );
     if (!$model->isAdmin($my->id, $groupId) && !COwnerHelper::isCommunityAdmin()) {
         $objResponse->addScriptCall(JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'));
     } else {
         //Load Necessary Table
         $member = JTable::getInstance('GroupMembers', 'CTable');
         $group = JTable::getInstance('Group', 'CTable');
         // Load the group and the members table
         $group->load($groupId);
         $keys = array('groupId' => $groupId, 'memberId' => $memberId);
         $member->load($keys);
         // Only approve members that is really not approved yet.
         if ($member->approved) {
             $objResponse->addScriptCall('joms.jQuery("#error-request-' . $group->id . '").html("' . JText::_('COM_COMMUNITY_EVENTS_NOT_INVITED_NOTIFICATION') . '");');
             $objResponse->addScriptCall('joms.jQuery("#error-request-' . $group->id . '").attr("class", "error");');
         } else {
             $member->approve();
             $user = CFactory::getUser($memberId);
             $user->updateGroupList(true);
             // Add notification
             //CFactory::load( 'libraries' , 'notification' );
             $params = new CParameter('');
             $params->set('url', CRoute::getExternalURL('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id));
             $params->set('group', $group->name);
             $params->set('group_url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
             CNotificationLibrary::add('groups_member_approved', $group->ownerid, $user->id, JText::sprintf('COM_COMMUNITY_GROUP_MEMBER_APPROVED_EMAIL_SUBJECT'), '', 'groups.memberapproved', $params);
             $act = new stdClass();
             $act->cmd = 'group.join';
             $act->actor = $memberId;
             $act->target = 0;
             $act->title = '';
             //JText::sprintf('COM_COMMUNITY_GROUPS_ACTIVITIES_MEMBER_JOIN_GROUP' , '{group_url}' , $group->name );
             $act->content = '';
             $act->app = 'groups.join';
             $act->cid = $group->id;
             $params = new CParameter('');
             $params->set('action', 'group.join');
             $params->set('group_url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
             // Add activity logging
             if (CUserPoints::assignPoint('group.join', $memberId)) {
                 CActivityStream::addActor($act, $params->toString());
             }
             //trigger for onGroupJoinApproved
             $this->triggerEvents('onGroupJoinApproved', $group, $memberId);
             $this->triggerEvents('onGroupJoin', $group, $memberId);
             // UPdate group stats();
             $group->updateStats();
             $group->store();
             $url = CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
             $objResponse->addScriptCall('joms.jQuery("#msg-request-' . $memberId . '").html("' . addslashes(JText::sprintf('COM_COMMUNITY_EVENTS_ACCEPTED', $group->name, $url)) . '");');
             $objResponse->addScriptCall('joms.notifications.updateNotifyCount();');
             $objResponse->addScriptCall('joms.jQuery("#noti-request-group-' . $memberId . '").fadeOut(1000, function() { joms.jQuery("#noti-request-group-' . $memberId . '").remove();} );');
             $objResponse->addScriptCall('aspan = joms.jQuery(".cMenu-Icon b"); aspan.html(parseInt(aspan.html())-1);');
         }
     }
     return $objResponse->sendResponse();
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:72,代码来源:notification.php

示例5: 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

示例6: ajaxLike

 /**
  * Like an item. Update ajax count
  * @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 ajaxLike($element, $itemId)
 {
     $filter = JFilterInput::getInstance();
     $element = $filter->clean($element, 'string');
     $itemId = $filter->clean($itemId, 'int');
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $like = new CLike();
     if (!$like->enabled($element)) {
         // @todo: return proper ajax error
         return;
     }
     $my = CFactory::getUser();
     $objResponse = new JAXResponse();
     $like->addLike($element, $itemId);
     $likeCount = $like->getLikeCount($element, $itemId);
     $html = $like->getHTML($element, $itemId, $my->id);
     $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;
     // load item-specific privacy settings, if available
     $table = JTable::getInstance($element, 'CTable');
     if (is_object($table)) {
         $table->load($itemId);
         if (isset($table->permissions)) {
             $act->access = $table->permissions;
         }
     }
     $params = new CParameter('');
     switch ($element) {
         case 'groups':
             $act->groupid = $itemId;
             break;
         case 'events':
             $act->eventid = $itemId;
             break;
     }
     $params->set('action', $element . '.like');
     // Add logging
     CActivityStream::addActor($act, $params->toString());
     $json = array('success' => true, 'likeCount' => $likeCount);
     die(json_encode($json));
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:55,代码来源:system.php


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