コード例 #1
0
ファイル: groups.php プロジェクト: knigherrant/decopatio
 /**
  * Notify site admins that a group is created and it is pending moderation.
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function notifyAdminsModeration(SocialGroup $group)
 {
     // Push arguments to template variables so users can use these arguments
     $params = array('title' => $group->getName(), 'creatorName' => $group->getCreator()->getName(), 'categoryTitle' => $group->getCategory()->get('title'), 'avatar' => $group->getAvatar(SOCIAL_AVATAR_LARGE), 'permalink' => JURI::root() . 'administrator/index.php?option=com_easysocial&view=groups&layout=pending', 'reject' => FRoute::controller('groups', array('external' => true, 'task' => 'rejectGroup', 'id' => $group->id, 'key' => $group->key)), 'approve' => FRoute::controller('groups', array('external' => true, 'task' => 'approveGroup', 'id' => $group->id, 'key' => $group->key)), 'alerts' => false);
     // Set the e-mail title
     $title = JText::sprintf('COM_EASYSOCIAL_EMAILS_GROUP_CREATED_MODERATOR_EMAIL_TITLE', $group->getName());
     // Get a list of super admins on the site.
     $usersModel = FD::model('Users');
     $admins = $usersModel->getSiteAdmins();
     foreach ($admins as $admin) {
         // Ensure that the user is a site admin or the Receive System email is turned off
         if (!$admin->isSiteAdmin() || !$admin->sendEmail) {
             continue;
         }
         // Immediately send out emails
         $mailer = FD::mailer();
         // Set the admin's name.
         $params['adminName'] = $admin->getName();
         // Get the email template.
         $mailTemplate = $mailer->getTemplate();
         // Set recipient
         $mailTemplate->setRecipient($admin->getName(), $admin->email);
         // Set title
         $mailTemplate->setTitle($title);
         // Set the template
         $mailTemplate->setTemplate('site/group/moderate', $params);
         // Set the priority. We need it to be sent out immediately since this is user registrations.
         $mailTemplate->setPriority(SOCIAL_MAILER_PRIORITY_IMMEDIATE);
         // Try to send out email to the admin now.
         $state = $mailer->create($mailTemplate);
     }
     return true;
 }
コード例 #2
0
ファイル: group.php プロジェクト: knigherrant/decopatio
 /**
  * Notify admins of the group
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function notifyGroupAdmins($action, $data = array())
 {
     $model = FD::model('Groups');
     $targets = $model->getMembers($this->id, array('admin' => true));
     if ($action == 'request') {
         $actor = FD::user($data['userId']);
         $params = new stdClass();
         $params->userName = $actor->getName();
         $params->userLink = $actor->getPermalink(false, true);
         $params->userAvatar = $actor->getAvatar(SOCIAL_AVATAR_LARGE);
         $params->groupName = $this->getName();
         $params->groupAvatar = $this->getAvatar();
         $params->groupLink = $this->getPermalink(false, true);
         $params->approve = FRoute::controller('groups', array('external' => true, 'task' => 'approve', 'userId' => $actor->id, 'id' => $this->id, 'key' => $this->key));
         $params->reject = FRoute::controller('groups', array('external' => true, 'task' => 'reject', 'userId' => $actor->id, 'id' => $this->id, 'key' => $this->key));
         $params->group = $this->getName();
         // Send notification e-mail to the target
         $options = new stdClass();
         $options->title = 'COM_EASYSOCIAL_EMAILS_USER_REQUESTED_TO_JOIN_GROUP_SUBJECT';
         $options->template = 'site/group/moderate.member';
         $options->params = $params;
         // Set the system alerts
         $system = new stdClass();
         $system->uid = $this->id;
         $system->actor_id = $actor->id;
         $system->target_id = $this->id;
         $system->context_type = 'groups';
         $system->type = SOCIAL_TYPE_GROUP;
         $system->url = $this->getPermalink(false, true, 'item', false);
         FD::notify('groups.requested', $targets, $options, $system);
     }
 }
コード例 #3
0
 /**
  * Notify users and administrator when they create an account on the site.
  *
  * @since	1.0
  * @access	public
  * @param	SocialUser			The user object.
  * @param	SocialTableProfile	The profile type.
  * @return	bool				True if success, false otherwise.
  * @author	Mark Lee <*****@*****.**>
  */
 public function notifyAdmins($data, SocialUser $user, SocialTableProfile $profile, $oauth = false)
 {
     // Get the application data.
     $jConfig = FD::jConfig();
     // Generate a key for the admin's actions.
     $key = md5($user->password . $user->email . $user->name . $user->username);
     $config = FD::config();
     if ($config->get('registrations.emailasusername')) {
         $data['username'] = $user->email;
     }
     // Push arguments to template variables so users can use these arguments
     $params = array('site' => $jConfig->getValue('sitename'), 'username' => $data['username'], 'password' => $data['password'], 'firstName' => !empty($data['first_name']) ? $data['first_name'] : '', 'middleName' => !empty($data['middle_name']) ? $data['middle_name'] : '', 'lastName' => !empty($data['last_name']) ? $data['last_name'] : '', 'name' => $user->getName(), 'avatar' => $user->getAvatar(SOCIAL_AVATAR_LARGE), 'profileLink' => $user->getPermalink(true, true), 'email' => $user->email, 'activation' => FRoute::controller('registration', array('external' => true, 'task' => 'activate', 'activation' => $user->activation)), 'reject' => FRoute::controller('registration', array('external' => true, 'task' => 'rejectUser', 'id' => $user->id, 'key' => $key)), 'approve' => FRoute::controller('registration', array('external' => true, 'task' => 'approveUser', 'id' => $user->id, 'key' => $key)), 'manageAlerts' => false, 'profileType' => $profile->get('title'));
     // Get the email title.
     $title = $profile->getModeratorEmailTitle($user->username);
     // Get the email format.
     $format = $profile->getEmailFormat();
     // Get a list of super admins on the site.
     $usersModel = FD::model('Users');
     $admins = $usersModel->getSiteAdmins();
     foreach ($admins as $admin) {
         if (!$admin->sendEmail) {
             continue;
         }
         // Immediately send out emails
         $mailer = FD::mailer();
         // Set the admin's name.
         $params['adminName'] = $admin->getName();
         // Get the email template.
         $mailTemplate = $mailer->getTemplate();
         // Set recipient
         $mailTemplate->setRecipient($admin->getName(), $admin->email);
         // Set title
         $mailTemplate->setTitle($title);
         // Set the template
         $template = $profile->getModeratorEmailTemplate('', $oauth);
         $mailTemplate->setTemplate($template, $params, $format);
         // Set the priority. We need it to be sent out immediately since this is user registrations.
         $mailTemplate->setPriority(SOCIAL_MAILER_PRIORITY_IMMEDIATE);
         // Try to send out email to the admin now.
         $state = $mailer->create($mailTemplate);
     }
     return true;
 }
コード例 #4
0
ファイル: events.php プロジェクト: ppantilla/bbninja
 /**
  * Notifies administrator when a new event is created.
  *
  * @since   1.3
  * @access  public
  * @param   string
  * @return
  */
 public function notifyAdmins($event)
 {
     $params = array('title' => $event->getName(), 'creatorName' => $event->getCreator()->getName(), 'creatorLink' => $event->getCreator()->getPermalink(false, true), 'categoryTitle' => $event->getCategory()->get('title'), 'avatar' => $event->getAvatar(SOCIAL_AVATAR_LARGE), 'permalink' => $event->getPermalink(true, true), 'alerts' => false);
     $title = JText::sprintf('COM_EASYSOCIAL_EMAILS_MODERATE_EVENT_CREATED_TITLE', $event->getName());
     $template = 'site/event/created';
     if ($event->state === SOCIAL_CLUSTER_PENDING) {
         $params['reject'] = FRoute::controller('events', array('external' => true, 'task' => 'rejectEvent', 'id' => $event->id, 'key' => $event->key));
         $params['approve'] = FRoute::controller('events', array('external' => true, 'task' => 'approveEvent', 'id' => $event->id, 'key' => $event->key));
         $template = 'site/event/moderate';
     }
     $admins = FD::model('Users')->getSiteAdmins();
     foreach ($admins as $admin) {
         if (!$admin->sendEmail) {
             continue;
         }
         $mailer = FD::mailer();
         $params['adminName'] = $admin->getName();
         // Get the email template.
         $mailTemplate = $mailer->getTemplate();
         // Set recipient
         $mailTemplate->setRecipient($admin->getName(), $admin->email);
         // Set title
         $mailTemplate->setTitle($title);
         // Set the template
         $mailTemplate->setTemplate($template, $params);
         // Set the priority. We need it to be sent out immediately since this is user registrations.
         $mailTemplate->setPriority(SOCIAL_MAILER_PRIORITY_IMMEDIATE);
         // Try to send out email to the admin now.
         $state = $mailer->create($mailTemplate);
     }
 }