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


PHP CParameter::set方法代码示例

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


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

示例1: onGroupJoin

 public function onGroupJoin($group, $userId)
 {
     //@rule: Clear existing invites fromt he invitation table once the user joined the group
     $groupInvite =& JTable::getInstance('GroupInvite', 'CTable');
     if ($groupInvite->load($group->id, $userId)) {
         $groupInvite->delete();
     }
     $member =& JTable::getInstance('GroupMembers', 'CTable');
     $member->load($userId, $group->id);
     $groupModel = CFactory::getModel('groups');
     $admins = $groupModel->getAdmins($group->id, null);
     $params = $group->getParams();
     //@rule: Send notification when necessary
     if ($params->get('joinrequestnotification') || $params->get('newmembernotification')) {
         $user = CFactory::getUser($userId);
         $subject = JText::sprintf('COM_COMMUNITY_GROUPS_EMAIL_NEW_MEMBER_JOINED_SUBJECT', $user->getDisplayName(), $group->name);
         if (!$member->approved) {
             $subject = JText::sprintf('COM_COMMUNITY_NEW_MEMBER_REQUESTED_TO_JOIN_GROUP_EMAIL_SUBJECT', $user->getDisplayName(), $group->name);
         }
         // Add notification
         CFactory::load('libraries', 'notification');
         $params = new CParameter('');
         $params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
         $params->set('group', $group->name);
         $params->set('user', $user->getDisplayName());
         $params->set('approved', $member->approved);
         foreach ($admins as $admin) {
             CNotificationLibrary::add('etype_groups_member_join', $user->id, $admin->id, $subject, '', 'groups.memberjoin', $params);
         }
     }
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:31,代码来源:groups.trigger.php

示例2: ajaxTogglePublish

 public function ajaxTogglePublish($id, $type, $eventName = false)
 {
     // Send email notification to owner when a group is published.
     $config = CFactory::getConfig();
     $event = JTable::getInstance('Event', 'CTable');
     $event->load($id);
     // Added published = 2 for new created event under moderation.
     if ($type == 'published' && $event->published == 2) {
         $lang = JFactory::getLanguage();
         $lang->load('com_community', JPATH_ROOT);
         $my = CFactory::getUser();
         // Add notification
         //CFactory::load('libraries', 'notification');
         //CFactory::load('helpers', 'event');
         if ($event->type == CEventHelper::GROUP_TYPE && $event->contentid != 0) {
             $url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id . '&groupid=' . $event->contentid;
         } else {
             $url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id;
         }
         //Send notification email to owner
         $params = new CParameter('');
         $params->set('url', 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
         $params->set('event', $event->title);
         $params->set('event_url', 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
         CNotificationLibrary::add('events_notify_creator', $my->id, $event->creator, JText::_('COM_COMMUNITY_EVENTS_PUBLISHED_MAIL_SUBJECT'), '', 'events.notifycreator', $params);
         //CFactory::load('libraries', 'events');
         // Add activity stream for new created event.
         $event->published = 1;
         // by pass published checking.
         CEvents::addEventStream($event);
         // send notification email to group's member for new created event.
         CEvents::addGroupNotification($event);
     }
     return parent::ajaxTogglePublish($id, $type, 'events');
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:35,代码来源:events.php

示例3: sendCommentNotification

 public static function sendCommentNotification(CTableWall $wall, $message)
 {
     CFactory::load('libraries', 'notification');
     $my = CFactory::getUser();
     $targetUser = CFactory::getUser($wall->post_by);
     $url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $wall->contentid;
     $params = $targetUser->getParams();
     $params = new CParameter('');
     $params->set('url', $url);
     $params->set('message', $message);
     CNotificationLibrary::add('etype_events_submit_wall_comment', $my->id, $targetUser->id, JText::sprintf('PLG_WALLS_WALL_COMMENT_EMAIL_SUBJECT', $my->getDisplayName()), '', 'events.wallcomment', $params);
     return true;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:13,代码来源:events.php

示例4: ajaxEmailPage

 public function ajaxEmailPage($uri, $emails, $message = '')
 {
     $filter = JFilterInput::getInstance();
     $uri = $filter->clean($uri, 'string');
     $emails = $filter->clean($emails, 'string');
     $message = $filter->clean($message, 'string');
     $message = stripslashes($message);
     $mainframe =& JFactory::getApplication();
     $bookmarks = CFactory::getBookmarks($uri);
     $mailqModel = CFactory::getModel('mailq');
     $config = CFactory::getConfig();
     $response = new JAXResponse();
     if (empty($emails)) {
         $content = '<div>' . JText::_('COM_COMMUNITY_SHARE_INVALID_EMAIL') . '</div>';
         $actions = '<input type="button" class="button" onclick="joms.bookmarks.show(\'' . $uri . '\');" value="' . JText::_('COM_COMMUNITY_GO_BACK_BUTTON') . '"/>';
     } else {
         $emails = explode(',', $emails);
         $errors = array();
         // Add notification
         CFactory::load('libraries', 'notification');
         foreach ($emails as $email) {
             $email = JString::trim($email);
             CFactory::load('helpers', 'validate');
             if (!empty($email) && CValidateHelper::email($email)) {
                 $params = new CParameter('');
                 $params->set('uri', $uri);
                 $params->set('message', $message);
                 CNotificationLibrary::add('etype_system_bookmarks_email', '', $email, JText::sprintf('COM_COMMUNITY_SHARE_EMAIL_SUBJECT', $config->get('sitename')), '', 'bookmarks', $params);
             } else {
                 // If there is errors with email, inform the user.
                 $errors[] = $email;
             }
         }
         if ($errors) {
             $content = '<div>' . JText::_('COM_COMMUNITY_EMAILS_ARE_INVALID') . '</div>';
             foreach ($errors as $error) {
                 $content .= '<div style="font-weight:700;color: red;">' . $error . '</span>';
             }
             $actions = '<input type="button" class="button" onclick="joms.bookmarks.show(\'' . $uri . '\');" value="' . JText::_('COM_COMMUNITY_GO_BACK_BUTTON') . '"/>';
         } else {
             $content = '<div>' . JText::_('COM_COMMUNITY_EMAIL_SENT_TO_RECIPIENTS') . '</div>';
             $actions = '<input type="button" class="button" onclick="cWindowHide();" value="' . JText::_('COM_COMMUNITY_DONE_BUTTON') . '"/>';
         }
     }
     $response->addAssign('cwin_logo', 'innerHTML', JText::_('COM_COMMUNITY_SHARE_THIS'));
     $response->addScriptCall('cWindowAddContent', $content, $actions);
     return $response->sendResponse();
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:48,代码来源:bookmarks.php

示例5: sendCommentNotification

 public static function sendCommentNotification(CTableWall $wall, $message)
 {
     //CFactory::load( 'libraries' , 'notification' );
     $my = CFactory::getUser();
     $targetUser = CFactory::getUser($wall->post_by);
     $url = 'index.php?option=com_community&view=profile&userid=' . $wall->contentid;
     $userParams = $targetUser->getParams();
     $params = new CParameter('');
     $params->set('url', $url);
     $params->set('message', $message);
     if ($my->id != $targetUser->id && $userParams->get('notifyWallComment')) {
         CNotificationLibrary::add('profile_submit_wall_comment', $my->id, $targetUser->id, JText::sprintf('PLG_WALLS_WALL_COMMENT_EMAIL_SUBJECT', $my->getDisplayName()), '', 'profile.wallcomment', $params);
         return true;
     }
     return false;
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:16,代码来源:profile.php

示例6: ajaxEmailPage

 public function ajaxEmailPage($uri, $emails, $message = '')
 {
     $filter = JFilterInput::getInstance();
     $uri = $filter->clean($uri, 'string');
     $emails = $filter->clean($emails, 'string');
     $message = $filter->clean($message, 'string');
     $message = stripslashes($message);
     $mainframe = JFactory::getApplication();
     $bookmarks = CFactory::getBookmarks($uri);
     $mailqModel = CFactory::getModel('mailq');
     $config = CFactory::getConfig();
     $response = new JAXResponse();
     $json = array();
     if (empty($emails)) {
         $json['error'] = JText::_('COM_COMMUNITY_SHARE_INVALID_EMAIL');
     } else {
         $emails = explode(',', $emails);
         $errors = array();
         // Add notification
         //CFactory::load( 'libraries' , 'notification' );
         foreach ($emails as $email) {
             $email = JString::trim($email);
             if (!empty($email) && CValidateHelper::email($email)) {
                 $params = new CParameter('');
                 $params->set('uri', $uri);
                 $params->set('message', $message);
                 CNotificationLibrary::add('system_bookmarks_email', '', $email, JText::sprintf('COM_COMMUNITY_SHARE_EMAIL_SUBJECT', $config->get('sitename')), '', 'bookmarks', $params);
             } else {
                 // If there is errors with email, inform the user.
                 $errors[] = $email;
             }
         }
         if ($errors) {
             $content = '<div>' . JText::_('COM_COMMUNITY_EMAILS_ARE_INVALID') . '</div>';
             foreach ($errors as $error) {
                 $content .= '<div style="font-weight:bold; color:red;">' . $error . '</div>';
             }
             $json['error'] = $content;
         } else {
             $content = JText::_('COM_COMMUNITY_EMAIL_SENT_TO_RECIPIENTS');
             $json['message'] = $content;
         }
     }
     die(json_encode($json));
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:45,代码来源:bookmarks.php

示例7: ajaxTogglePublish

 public function ajaxTogglePublish($id, $type)
 {
     // Send email notification to owner when a group is published.
     $config =& CFactory::getConfig();
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($id);
     if ($type == 'published' && $group->published == 0 && $config->get('moderategroupcreation')) {
         $lang =& JFactory::getLanguage();
         $lang->load('com_community', JPATH_ROOT);
         $my =& CFactory::getUser();
         // Add notification
         CFactory::load('libraries', 'notification');
         //Send notification email to owner
         $params = new CParameter('');
         $params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
         $params->set('groupName', $group->name);
         CNotificationLibrary::add('etype_groups_notify_creator', $my->id, $group->ownerid, JText::sprintf('COM_COMMUNITY_GROUPS_PUBLISHED_MAIL_SUBJECT', $group->name), '', 'groups.notifycreator', $params);
     }
     return parent::ajaxTogglePublish($id, $type, 'groups');
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:20,代码来源:groups.php

示例8: onEventCreate

 public function onEventCreate($event)
 {
     $config = CFactory::getConfig();
     // Send an email notification to the site admin's when there is a new group created
     if ($config->get('event_moderation')) {
         $userModel = CFactory::getModel('User');
         $my = CFactory::getUser();
         $admins = $userModel->getSuperAdmins();
         // Add notification
         CFactory::load('libraries', 'notification');
         //Send notification email to administrators
         foreach ($admins as $row) {
             if ($row->sendEmail) {
                 $params = new CParameter('');
                 $params->set('url', JURI::root() . 'administrator/index.php?option=com_community&view=events');
                 $params->set('title', $event->title);
                 CNotificationLibrary::add('etype_events_notify_admin', $my->id, $row->id, JText::sprintf('COM_COMMUNITY_EVENTS_MODERATION_NOTICE', $event->title), '', 'events.notifyadmin', $params);
             }
         }
     }
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:21,代码来源:events.trigger.php

示例9: onEventCreate

 public function onEventCreate($event)
 {
     $config = CFactory::getConfig();
     // Send an email notification to the site admin's when there is a new group created
     if ($config->get('event_moderation')) {
         $userModel = CFactory::getModel('User');
         $my = CFactory::getUser();
         $admins = $userModel->getSuperAdmins();
         //Send notification email to administrators
         foreach ($admins as $row) {
             if ($event->type == CEventHelper::GROUP_TYPE && $event->contentid != 0) {
                 $event_url = 'index.php?option=com_community&view=events&task=viewevent&groupid=' . $event->contentid . '&eventid=' . $event->id;
             } else {
                 $event_url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id;
             }
             $params = new CParameter('');
             $params->set('url', JURI::root() . 'administrator/index.php?option=com_community&view=events');
             $params->set('title', $event->title);
             $params->set('event', $event->title);
             $params->set('event_url', JURI::root() . 'administrator/index.php?option=com_community&view=events');
             CNotificationLibrary::add('events_notify_admin', $my->id, $row->id, JText::sprintf('COM_COMMUNITY_EVENT_CREATION_MODERATION_EMAIL_SUBJECT'), '', 'events.notifyadmin', $params);
         }
     }
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:24,代码来源:events.trigger.php

示例10: request

 public function request($target, $friends = array())
 {
     // remove duplicate id
     $friends = array_unique($friends);
     $model = CFactory::getModel('friends');
     $targetUser = CFactory::getUser($target);
     $my = JFactory::getUser();
     $params = new CParameter('');
     $params->set('url', 'index.php?option=com_community&view=profile&userid=' . $targetUser->id);
     if ($target == 0 || empty($friends)) {
         return false;
     }
     foreach ($friends as $friendId) {
         $connection = count($model->getFriendConnection($target, $friendId));
         // If stanger id is not in connection and stranger id in not myId, do add
         if ($connection == 0 && $friendId != $my->id) {
             $model->addFriend($friendId, $target);
             CNotificationLibrary::add('friends_request_connection', $targetUser->id, $friendId, JText::sprintf('COM_COMMUNITY_FRIEND_ADD_REQUEST', $targetUser->getDisplayName()), '', 'friends/request-sent', $params);
         }
     }
     return true;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:22,代码来源:friends.php

示例11: _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());
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:53,代码来源:photos.php

示例12: ajaxAddPredefined

 /**
  * AJAX method to add predefined activity
  * */
 public function ajaxAddPredefined($key, $message = '', $privacy = 0)
 {
     $objResponse = new JAXResponse();
     $my = CFactory::getUser();
     $filter = JFilterInput::getInstance();
     $key = $filter->clean($key, 'string');
     $message = $filter->clean($message, 'string');
     $privacy = $filter->clean($privacy, 'int');
     if (!COwnerHelper::isCommunityAdmin() || empty($message)) {
         return;
     }
     // Predefined system custom activity.
     $system = array('system.registered', 'system.populargroup', 'system.totalphotos', 'system.popularprofiles', 'system.popularphotos', 'system.popularvideos');
     $act = new stdClass();
     $act->actor = 0;
     //$my->id; System message should not capture actor. Otherwise the stream filter will be inaccurate
     $act->target = 0;
     $act->app = 'system';
     $act->access = !$privacy ? 0 : $privacy;
     $params = new CParameter('');
     if (in_array($key, $system)) {
         switch ($key) {
             case 'system.registered':
                 // $usersModel   = CFactory::getModel( 'user' );
                 // $now          = new JDate();
                 // $date         = CTimeHelper::getDate();
                 // $title        = JText::sprintf('COM_COMMUNITY_TOTAL_USERS_REGISTERED_THIS_MONTH_ACTIVITY_TITLE', $usersModel->getTotalRegisteredByMonth($now->format('Y-m')) , $date->_monthToString($now->format('m')));
                 $act->app = 'system.members.registered';
                 $act->cmd = 'system.registered';
                 $act->title = '';
                 $act->content = '';
                 $params->set('action', 'registered_users');
                 break;
             case 'system.populargroup':
                 // $groupsModel = CFactory::getModel('groups');
                 // $activeGroup = $groupsModel->getMostActiveGroup();
                 // $title       = JText::sprintf('COM_COMMUNITY_MOST_POPULAR_GROUP_ACTIVITY_TITLE', $activeGroup->name);
                 // $act->cmd    = 'groups.popular';
                 // $act->cid    = $activeGroup->id;
                 // $act->title  = $title;
                 $act->app = 'system.groups.popular';
                 $params->set('action', 'top_groups');
                 // $params->set('group_url', CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid='.$activeGroup->id));
                 break;
             case 'system.totalphotos':
                 // $photosModel = CFactory::getModel( 'photos' );
                 // $total       = $photosModel->getTotalSitePhotos();
                 $act->app = 'system.photos.total';
                 $act->cmd = 'photos.total';
                 $act->title = '';
                 //JText::sprintf('COM_COMMUNITY_TOTAL_PHOTOS_ACTIVITY_TITLE', $total);
                 $params->set('action', 'total_photos');
                 // $params->set('photos_url', CRoute::_('index.php?option=com_community&view=photos'));
                 break;
             case 'system.popularprofiles':
                 $act->app = 'system.members.popular';
                 $act->cmd = 'members.popular';
                 $act->title = '';
                 //JText::sprintf('COM_COMMUNITY_ACTIVITIES_TOP_PROFILES', 5);
                 $params->set('action', 'top_users');
                 // $params->set('count', 5);
                 break;
             case 'system.popularphotos':
                 $act->app = 'system.photos.popular';
                 $act->cmd = 'photos.popular';
                 $act->title = '';
                 //JText::sprintf('COM_COMMUNITY_ACTIVITIES_TOP_PHOTOS', 5);
                 $params->set('action', 'top_photos');
                 // $params->set('count', 5);
                 break;
             case 'system.popularvideos':
                 $act->app = 'system.videos.popular';
                 $act->cmd = 'videos.popular';
                 $act->title = '';
                 //JText::sprintf( 'COM_COMMUNITY_ACTIVITIES_TOP_VIDEOS', 5 );
                 $params->set('action', 'top_videos');
                 // $params->set('count', 5);
                 break;
         }
     } else {
         // For additional custom activities, we only take the content passed by them.
         if (!empty($message)) {
             $message = CStringHelper::escape($message);
             $app = explode('.', $key);
             $app = isset($app[0]) ? $app[0] : 'system';
             $act->app = 'system.message';
             $act->title = $message;
             $params->set('action', 'message');
         }
     }
     $this->cacheClean(array(COMMUNITY_CACHE_TAG_ACTIVITIES));
     // Allow comments on all these
     $act->comment_id = CActivities::COMMENT_SELF;
     $act->comment_type = $key;
     // Allow like for all admin activities
     $act->like_id = CActivities::LIKE_SELF;
     $act->like_type = $key;
//.........这里部分代码省略.........
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:101,代码来源:activities.php

示例13: addShare

 /**
  * Function to share status
  * @param [Int] $activityId [description]
  * @param [JSON] $attachment [description]
  */
 public static function addShare($activityId, $attachment)
 {
     $my = CFactory::getUser();
     $params = new CParameter('');
     $attachment = json_decode($attachment);
     $act = new stdClass();
     $act->cmd = 'profile.status.share';
     $act->actor = $my->id;
     $act->target = $my->id;
     $act->title = $attachment->msg;
     $act->content = '';
     $act->app = 'profile.status.share';
     $act->verb = 'share';
     $act->cid = $my->id;
     $act->comment_id = CActivities::COMMENT_SELF;
     $act->comment_type = 'profile.status.share';
     $act->like_id = CActivities::LIKE_SELF;
     $act->like_type = 'profile.status.share';
     $act->access = $attachment->privacy;
     $params->set('activityId', $activityId);
     $act->params = $params->toString();
     return self::add($act);
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:28,代码来源:activities.php

示例14: parseTaggedUserNotification

 /**
  * @param $message
  * @param $actor
  * @param $object
  * @param array $info
  * @return bool
  */
 static function parseTaggedUserNotification($message, $actor, $object = null, $info = array())
 {
     $pattern = '/@\\[\\[(\\d+):([a-z]+):([^\\]]+)\\]\\]/';
     preg_match_all($pattern, $message, $matches);
     if (isset($matches[1]) && count($matches[1]) > 0) {
         //lets count total recipients and blast notifications
         $taggedIds = array();
         foreach ($matches[1] as $uid) {
             $taggedIds[] = CFactory::getUser($uid)->get('id') != 0 ? $uid : null;
         }
         if ($info['type'] == 'discussion-comment') {
             //link to lead the user to the discussion
             $url = CRoute::emailLink('index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $info['group_id'] . '&topicid=' . $info['discussion_id'] . '#activity-stream-container');
             $params = new CParameter();
             $params->set('url', $url);
             $params->set('content', $message);
             $params->set('discussion', '<a href="' . $url . '">' . JText::_('COM_COMMUNITY_DISCUSSION') . '</a>');
             $emailSubject = JText::sprintf('COM_COMMUNITY_DISCUSSION_USER_TAGGED_EMAIL_SUBJECT');
             $emailContent = JText::sprintf('COM_COMMUNITY_USER_TAGGED_COMMENT_EMAIL_CONTENT', $url);
             $notificationMessage = JText::_('COM_COMMUNITY_NOTIFICATION_DISCUSSION_USER_TAGGED');
         } else {
             if ($info['type'] == 'album-comment') {
                 //link to lead the user to the album
                 $url = CRoute::emailLink('index.php?option=com_community&view=photos&task=album&userid=' . $info['album_creator_id'] . '&albumid=' . $info['album_id'] . '#activity-stream-container');
                 $params = new CParameter();
                 $params->set('url', $url);
                 $params->set('content', $message);
                 $params->set('album', '<a href="' . $url . '">' . JText::_('COM_COMMUNITY_SINGULAR_ALBUM') . '</a>');
                 $emailSubject = JText::sprintf('COM_COMMUNITY_ALBUM_USER_TAGGED_EMAIL_SUBJECT');
                 $emailContent = JText::sprintf('COM_COMMUNITY_USER_TAGGED_COMMENT_EMAIL_CONTENT', $url);
                 $notificationMessage = JText::_('COM_COMMUNITY_NOTIFICATION_ALBUM_USER_TAGGED');
             } else {
                 if ($info['type'] == 'video-comment') {
                     //link to lead the user to the video
                     $url = CRoute::emailLink('index.php?option=com_community&view=videos&task=video&userid=' . $actor->id . '&videoid=' . $info['video_id'] . '#activity-stream-container');
                     $params = new CParameter();
                     $params->set('url', $url);
                     $params->set('content', $message);
                     $params->set('video', '<a href="' . $url . '">' . JText::_('COM_COMMUNITY_SINGULAR_PHOTO') . '</a>');
                     $emailSubject = JText::sprintf('COM_COMMUNITY_VIDEO_USER_TAGGED_EMAIL_SUBJECT');
                     $emailContent = JText::sprintf('COM_COMMUNITY_USER_TAGGED_COMMENT_EMAIL_CONTENT', $url);
                     $notificationMessage = JText::_('COM_COMMUNITY_NOTIFICATION_VIDEO_USER_TAGGED');
                 } else {
                     if ($info['type'] == 'image-comment') {
                         //link to lead the user to the picture
                         $url = CRoute::emailLink('index.php?option=com_community&view=photos&task=photo&userid=' . $actor->id . '&albumid=' . $info['album_id'] . '&photoid=' . $info['image_id'] . '#activity-stream-container');
                         $params = new CParameter();
                         $params->set('url', $url);
                         $params->set('content', $message);
                         $params->set('photo', '<a href="' . $url . '">' . JText::_('COM_COMMUNITY_SINGULAR_PHOTO') . '</a>');
                         $emailSubject = JText::sprintf('COM_COMMUNITY_PHOTO_USER_TAGGED_EMAIL_SUBJECT');
                         $emailContent = JText::sprintf('COM_COMMUNITY_USER_TAGGED_COMMENT_EMAIL_CONTENT', $url);
                         $notificationMessage = JText::_('COM_COMMUNITY_NOTIFICATION_PHOTO_USER_TAGGED');
                     } else {
                         if ($info['type'] == 'post-comment' && $object != null) {
                             //default notification, and object is activity
                             //set parameter to be replaced in the template
                             $url = CRoute::emailLink('index.php?option=com_community&view=profile&userid=' . $object->actor . '&actid=' . $object->id . '#activity-stream-container');
                             $params = new CParameter();
                             $params->set('url', $url);
                             $params->set('content', $message);
                             $params->set('post', '<a href="' . $url . '">' . JText::_('COM_COMMUNITY_SINGULAR_POST') . '</a>');
                             $emailSubject = JText::sprintf('COM_COMMUNITY_PROFILE_USER_TAGGED_EMAIL_SUBJECT');
                             $emailContent = JText::sprintf('COM_COMMUNITY_PROFILE_USER_TAGGED_COMMENT_EMAIL_CONTENT', $url);
                             $notificationMessage = JText::_('COM_COMMUNITY_NOTIFICATION_USER_TAGGED');
                         } else {
                             return false;
                         }
                     }
                 }
             }
         }
         //add to notifications
         CNotificationLibrary::add('users_tagged', $actor->id, $taggedIds, $emailSubject, $emailContent, '', $params, true, '', $notificationMessage);
         return true;
     }
     return false;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:85,代码来源:user.php

示例15: ajaxSaveWall

        /**
         * Ajax function to save a new wall entry
         * 	 
         * @param message	A message that is submitted by the user
         * @param uniqueId	The unique id for this group
         * 
         **/
        function ajaxSaveWall($response, $message, $uniqueId, $cache_id = "")
        {
            $my = CFactory::getUser();
            $user = CFactory::getUser($uniqueId);
            $config = CFactory::getConfig();
            JPlugin::loadLanguage('plg_walls', JPATH_ADMINISTRATOR);
            // Load libraries
            CFactory::load('models', 'photos');
            CFactory::load('libraries', 'wall');
            CFactory::load('helpers', 'url');
            CFactory::load('libraries', 'activities');
            $message = JString::trim($message);
            $message = strip_tags($message);
            if (empty($message)) {
                $response->addAlert(JText::_('PLG_WALLS_PLEASE_ADD_MESSAGE'));
            } else {
                $maxchar = $this->params->get('charlimit', 0);
                if (!empty($maxchar)) {
                    $msglength = strlen($message);
                    if ($msglength > $maxchar) {
                        $message = substr($message, 0, $maxchar);
                    }
                }
                // @rule: Spam checks
                if ($config->get('antispam_akismet_walls')) {
                    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=' . $user->id));
                    $filter->setType('message');
                    $filter->setIP($_SERVER['REMOTE_ADDR']);
                    if ($filter->isSpam()) {
                        $response->addAlert(JText::_('COM_COMMUNITY_WALLS_MARKED_SPAM'));
                        return $response->sendResponse();
                    }
                }
                $wall = CWallLibrary::saveWall($uniqueId, $message, 'user', $my, $my->id == $user->id, 'profile,profile');
                CFactory::load('libraries', 'activities');
                CFactory::load('helpers', 'videos');
                $matches = cGetVideoLinkMatches($message);
                $activityParams = '';
                // We only want the first result of the video to be in the activity
                if ($matches) {
                    $videoLink = $matches[0];
                    CFactory::load('libraries', 'videos');
                    $videoLib = new CVideoLibrary();
                    $provider = $videoLib->getProvider($videoLink);
                    $activityParams .= 'videolink=' . $videoLink . "\r\n";
                    if ($provider->isValid()) {
                        $activityParams .= 'url=' . $provider->getThumbnail();
                    }
                }
                $act = new stdClass();
                $act->cmd = 'profile.wall.create';
                $act->actor = $my->id;
                $act->target = $uniqueId;
                $act->title = JText::_('COM_COMMUNITY_ACTIVITIES_WALL_POST_PROFILE');
                $act->content = '';
                $act->app = 'walls';
                $act->cid = $wall->id;
                // Allow comments on all these
                $act->comment_id = CActivities::COMMENT_SELF;
                $act->comment_type = 'walls';
                CActivityStream::add($act, $activityParams);
                // @rule: Send notification to the profile user.
                if ($my->id != $user->id) {
                    CFactory::load('libraries', 'notification');
                    $params = new CParameter('');
                    $params->set('url', 'index.php?option=com_community&view=profile&userid=' . $user->id);
                    $params->set('message', $message);
                    CNotificationLibrary::add('etype_profile_submit_wall', $my->id, $user->id, JText::sprintf('PLG_WALLS_NOTIFY_EMAIL_SUBJECT', $my->getDisplayName()), '', 'profile.wall', $params);
                }
                //add user points
                CFactory::load('libraries', 'userpoints');
                CUserPoints::assignPoint('profile.wall.create');
                $response->addScriptCall('joms.walls.insert', $wall->content);
                $response->addScriptCall('if(joms.jQuery(".content-nopost").length){
											joms.jQuery("#wall-empty-container").remove();
										}');
                $cache =& JFactory::getCache('plgCommunityWalls');
                $cache->remove($cache_id);
                $cache =& JFactory::getCache('plgCommunityWalls_fullview');
                $cache->remove($cache_id);
            }
            return $response;
        }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:95,代码来源:walls.php


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