ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilBuddySystemNotification Class Reference

Class ilBuddyList. More...

+ Collaboration diagram for ilBuddySystemNotification:

Public Member Functions

 __construct (ilObjUser $ilObjUser)
 
 getRecipientIds ()
 
 setRecipientIds (array $recipient_ids)
 
 send ()
 

Protected Attributes

 $sender
 
 $recipient_ids = array()
 

Detailed Description

Class ilBuddyList.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

Definition at line 8 of file class.ilBuddySystemNotification.php.

Constructor & Destructor Documentation

◆ __construct()

ilBuddySystemNotification::__construct ( ilObjUser  $ilObjUser)
Parameters
ilObjUser$ilObjUser

Definition at line 23 of file class.ilBuddySystemNotification.php.

24  {
25  $this->sender = $ilObjUser;
26  }

Member Function Documentation

◆ getRecipientIds()

ilBuddySystemNotification::getRecipientIds ( )
Returns
array

Definition at line 31 of file class.ilBuddySystemNotification.php.

References $recipient_ids.

Referenced by send().

+ Here is the caller graph for this function:

◆ send()

ilBuddySystemNotification::send ( )

Definition at line 47 of file class.ilBuddySystemNotification.php.

References ilLanguageFactory\_getLanguage(), ilLink\_getStaticLink(), array, ilNotificationConfig\DEFAULT_TTS, ilUserUtil\getNamePresentation(), getRecipientIds(), and ilNotificationConfig\TTL_LONG.

48  {
49  require_once 'Services/Mail/classes/class.ilMail.php';
50  foreach($this->getRecipientIds() as $usr_id)
51  {
52  $user = new ilObjUser((int)$usr_id);
53 
54  require_once 'Services/Language/classes/class.ilLanguageFactory.php';
55  require_once 'Services/User/classes/class.ilUserUtil.php';
56  require_once 'Services/Link/classes/class.ilLink.php';
57 
58  $rcp_lng = ilLanguageFactory::_getLanguage($user->getLanguage());
59  $rcp_lng->loadLanguageModule('buddysystem');
60 
61  require_once 'Services/Notifications/classes/class.ilNotificationConfig.php';
62  $notification = new ilNotificationConfig('buddysystem_request');
63  $notification->setTitleVar('buddy_notification_contact_request', array(), 'buddysystem');
64 
65  $bodyParams = array(
66  'SALUTATION' => ilMail::getSalutation($user->getId(), $rcp_lng),
67  'BR' => nl2br("\n"),
68  'APPROVE_REQUEST' => '<a href="' . ilLink::_getStaticLink($this->sender->getId(), 'usr', true, '_contact_approved') . '">' . $rcp_lng->txt('buddy_notification_contact_request_link_osd') . '</a>',
69  'IGNORE_REQUEST' => '<a href="' . ilLink::_getStaticLink($this->sender->getId(), 'usr', true, '_contact_ignored') . '">' . $rcp_lng->txt('buddy_notification_contact_request_ignore_osd') . '</a>',
70  'REQUESTING_USER' => ilUserUtil::getNamePresentation($this->sender->getId())
71  );
72  $notification->setShortDescriptionVar('buddy_notification_contact_request_short', $bodyParams, 'buddysystem');
73 
74  $bodyParams = array(
75  'SALUTATION' => ilMail::getSalutation($user->getId(), $rcp_lng),
76  'BR' => "\n",
77  'APPROVE_REQUEST' => ilLink::_getStaticLink($this->sender->getId(), 'usr', true, '_contact_approved'),
78  'APPROVE_REQUEST_TXT' => $rcp_lng->txt('buddy_notification_contact_request_link'),
79  'IGNORE_REQUEST' => ilLink::_getStaticLink($this->sender->getId(), 'usr', true, '_contact_ignored'),
80  'IGNORE_REQUEST_TXT' => $rcp_lng->txt('buddy_notification_contact_request_ignore'),
81  'REQUESTING_USER' => ilUserUtil::getNamePresentation($this->sender->getId())
82  );
83  $notification->setLongDescriptionVar('buddy_notification_contact_request_long', $bodyParams, 'buddysystem');
84 
85  $notification->setAutoDisable(false);
86  $notification->setValidForSeconds(ilNotificationConfig::TTL_LONG);
87  $notification->setVisibleForSeconds(ilNotificationConfig::DEFAULT_TTS);
88  $notification->setIconPath('templates/default/images/icon_usr.svg');
89  $notification->setHandlerParam('mail.sender', ANONYMOUS_USER_ID);
90  $notification->notifyByUsers(array($user->getId()));
91  }
92  }
Describes a notification and provides methods for publishing this notification.
static _getLanguage($a_lang_key='')
Get langauge object.
static getNamePresentation($a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false)
Default behaviour is:
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ setRecipientIds()

ilBuddySystemNotification::setRecipientIds ( array  $recipient_ids)
Parameters
array$recipient_ids

Definition at line 39 of file class.ilBuddySystemNotification.php.

References $recipient_ids.

Referenced by ilContactAppEventListener\handleEvent().

40  {
41  $this->recipient_ids = $recipient_ids;
42  }
+ Here is the caller graph for this function:

Field Documentation

◆ $recipient_ids

ilBuddySystemNotification::$recipient_ids = array()
protected

Definition at line 18 of file class.ilBuddySystemNotification.php.

Referenced by getRecipientIds(), and setRecipientIds().

◆ $sender

ilBuddySystemNotification::$sender
protected

Definition at line 13 of file class.ilBuddySystemNotification.php.


The documentation for this class was generated from the following file: