ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDataCollectionMailNotification Class Reference
+ Inheritance diagram for ilDataCollectionMailNotification:
+ Collaboration diagram for ilDataCollectionMailNotification:

Public Member Functions

 addRecipient (int $a_rcp)
 
 getActor ()
 
 setActor (int $actor)
 
 getRecord ()
 
 setRecord (ilDclBaseRecordModel $record)
 
 send ()
 
- Public Member Functions inherited from ilMailNotification
 __construct (protected bool $is_in_wsp=false)
 
 setType (int $a_type)
 
 getType ()
 
 setSender (int $a_usr_id)
 
 getSender ()
 
 setRecipients (array $a_rcp)
 
 getRecipients ()
 
 setAttachments (array $a_att)
 
 getAttachments ()
 
 setLangModules (array $a_modules)
 
 getUserLanguage (int $a_usr_id)
 
 setRefId (int $a_id)
 
 getRefId ()
 
 getObjId ()
 
 setObjId (int $a_obj_id)
 
 getObjType ()
 
 setAdditionalInformation (array $a_info)
 
 getAdditionalInformation ()
 
 sendMail (array $a_rcp, bool $a_parse_recipients=true)
 
 getBlockBorder ()
 

Protected Member Functions

 appendBody (string $a_body)
 
- Protected Member Functions inherited from ilMailNotification
 setSubject (string $a_subject)
 
 getSubject ()
 
 setBody (string $a_body)
 
 appendBody (string $a_body)
 
 getBody ()
 
 initLanguage (int $a_usr_id)
 
 initLanguageByIso2Code (string $a_code='')
 
 setLanguage (ilLanguage $a_language)
 
 getLanguage ()
 
 getLanguageText (string $a_keyword)
 
 getObjectTitle (bool $a_shorten=false)
 
 initMail ()
 
 getMail ()
 
 createPermanentLink (array $a_params=[], string $a_append='')
 
 userToString (int $a_usr_id)
 
 isRefIdAccessible (int $a_user_id, int $a_ref_id, string $a_permission='read')
 

Private Member Functions

 getAction (ilLanguage $lng)
 

Private Attributes

int $actor
 
ilDclBaseRecordModel $record
 

Additional Inherited Members

- Data Fields inherited from ilMailNotification
final const int SUBJECT_TITLE_LENGTH = 60
 
- Protected Attributes inherited from ilMailNotification
int $type
 
int $sender
 
ilMail $mail = null
 
string $subject = ''
 
string $body = ''
 
array $attachments = []
 
ilLanguage $language
 
array $lang_modules = []
 
array $recipients = []
 
int $ref_id
 
int $obj_id = 0
 
string $obj_type = ''
 
array $additional_info = []
 
ilWorkspaceTree $wsp_tree
 
ilWorkspaceAccessHandler $wsp_access_handler
 

Detailed Description

Definition at line 21 of file class.ilDataCollectionMailNotification.php.

Member Function Documentation

◆ addRecipient()

ilDataCollectionMailNotification::addRecipient ( int  $a_rcp)

Definition at line 26 of file class.ilDataCollectionMailNotification.php.

26 : void
27 {
28 $this->recipients[] = $a_rcp;
29 }

◆ appendBody()

ilDataCollectionMailNotification::appendBody ( string  $a_body)
protected

Reimplemented from ilMailNotification.

Definition at line 116 of file class.ilDataCollectionMailNotification.php.

116 : string
117 {
118 return parent::appendBody($a_body . "\n\n");
119 }

Referenced by send().

+ Here is the caller graph for this function:

◆ getAction()

ilDataCollectionMailNotification::getAction ( ilLanguage  $lng)
private

Definition at line 102 of file class.ilDataCollectionMailNotification.php.

102 : string
103 {
104 switch ($this->getType()) {
105 case ilDclNotificationType::RECORD_CREATE->value:
106 return $lng->txt('dcl_change_notification_dcl_new_record');
107 case ilDclNotificationType::RECORD_UPDATE->value:
108 return $lng->txt('dcl_change_notification_dcl_update_record');
110 return $lng->txt('dcl_change_notification_dcl_delete_record');
111 default:
112 return '';
113 }
114 }
global $lng
Definition: privfeed.php:31

References $lng, ilMailNotification\getType(), and RECORD_DELETE.

Referenced by send().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActor()

ilDataCollectionMailNotification::getActor ( )

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

References $actor.

◆ getRecord()

ilDataCollectionMailNotification::getRecord ( )

◆ send()

ilDataCollectionMailNotification::send ( )

Definition at line 51 of file class.ilDataCollectionMailNotification.php.

51 : void
52 {
53 $title = ilObject::_lookupTitle($this->getObjId());
55 $table = $this->record->getTable()->getTitle();
56 $link = ilLink::_getLink($this->getRefId());
57 foreach ($this->recipients as $user_id) {
58 $views = $this->record->getTable()->getVisibleTableViews($user_id);
59 $visible_ids = [];
60 foreach ($views as $view) {
61 foreach ($view->getVisibleFields() as $field) {
62 $visible_ids[] = $field->getId();
63 }
64 }
65 $visible_ids = array_unique($visible_ids);
67 $lng->loadLanguageModule('dcl');
68
69 $this->initMail();
70 $this->setSubject(sprintf($lng->txt('dcl_change_notification_subject'), $title));
71
72 $this->setBody('');
73 $this->appendBody(ilMail::getSalutation($user_id, $lng));
74 $this->appendBody($this->getAction($lng));
75 $this->appendBody($lng->txt('obj_dcl') . ": $title");
76 $this->appendBody($lng->txt('dcl_table') . ": $table");
77 if ($visible_ids !== []) {
78 $message = $lng->txt('dcl_record') . ":\n";
79 $message .= "------------------------------------\n";
80 foreach ($this->record->getTable()->getFields() as $field) {
81 if (in_array($field->getId(), $visible_ids)) {
82 $value = '-undefined-';
83 if ($field->isStandardField()) {
84 $value = $this->record->getStandardFieldPlainText($field->getId());
85 } elseif ($record_field = $this->record->getRecordField((int) $field->getId())) {
86 $value = $record_field->getPlainText();
87 }
88 $message .= $field->getTitle() . ': ' . $value . "\n";
89 }
90 }
91 $message .= "------------------------------------";
92 $this->appendBody($message);
93 }
94
95 $this->appendBody($lng->txt('dcl_changed_by') . ": $actor");
96 $this->appendBody($lng->txt('dcl_change_notification_link') . ": $link");
97 $this->getMail()->appendInstallationSignature(true);
98 $this->sendMail([$user_id]);
99 }
100 }
static _getLanguageOfUser(int $a_usr_id)
Get language object of user.
sendMail(array $a_rcp, bool $a_parse_recipients=true)
setSubject(string $a_subject)
static getSalutation(int $a_usr_id, ?ilLanguage $a_language=null)
static _lookupTitle(int $obj_id)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
$message
Definition: xapiexit.php:31

References $lng, $message, $user_id, ilLanguageFactory\_getLanguageOfUser(), ilObject\_lookupTitle(), appendBody(), getAction(), ilMailNotification\getMail(), ilUserUtil\getNamePresentation(), ilMailNotification\getObjId(), ilMailNotification\getRefId(), ilMail\getSalutation(), ilMailNotification\initMail(), ilMailNotification\sendMail(), ilMailNotification\setBody(), and ilMailNotification\setSubject().

+ Here is the call graph for this function:

◆ setActor()

ilDataCollectionMailNotification::setActor ( int  $actor)

Definition at line 36 of file class.ilDataCollectionMailNotification.php.

36 : void
37 {
38 $this->actor = $actor;
39 }

References $actor.

◆ setRecord()

ilDataCollectionMailNotification::setRecord ( ilDclBaseRecordModel  $record)

Definition at line 46 of file class.ilDataCollectionMailNotification.php.

46 : void
47 {
48 $this->record = $record;
49 }

References $record.

Field Documentation

◆ $actor

int ilDataCollectionMailNotification::$actor
private

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

Referenced by getActor(), and setActor().

◆ $record

ilDclBaseRecordModel ilDataCollectionMailNotification::$record
private

Definition at line 24 of file class.ilDataCollectionMailNotification.php.

Referenced by getRecord(), and setRecord().


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