ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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 ()
 

Data Fields

const TYPE_RECORD_CREATE = 1
 
const TYPE_RECORD_UPDATE = 2
 
const TYPE_RECORD_DELETE = 3
 
- Data Fields inherited from ilMailNotification
final const int SUBJECT_TITLE_LENGTH = 60
 

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

- 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 30 of file class.ilDataCollectionMailNotification.php.

30  : void
31  {
32  $this->recipients[] = $a_rcp;
33  }

◆ appendBody()

ilDataCollectionMailNotification::appendBody ( string  $a_body)
protected

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

Referenced by send().

119  : string
120  {
121  return parent::appendBody($a_body . "\n\n");
122  }
+ Here is the caller graph for this function:

◆ getAction()

ilDataCollectionMailNotification::getAction ( ilLanguage  $lng)
private

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

References ilMailNotification\getType(), and ilLanguage\txt().

Referenced by send().

105  : string
106  {
107  switch ($this->getType()) {
108  case self::TYPE_RECORD_CREATE:
109  return $lng->txt('dcl_change_notification_dcl_new_record');
110  case self::TYPE_RECORD_UPDATE:
111  return $lng->txt('dcl_change_notification_dcl_update_record');
112  case self::TYPE_RECORD_DELETE:
113  return $lng->txt('dcl_change_notification_dcl_delete_record');
114  default:
115  return '';
116  }
117  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActor()

ilDataCollectionMailNotification::getActor ( )

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

References $actor.

◆ getRecord()

ilDataCollectionMailNotification::getRecord ( )

◆ send()

ilDataCollectionMailNotification::send ( )

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

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().

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

◆ setActor()

ilDataCollectionMailNotification::setActor ( int  $actor)

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

References $actor.

40  : void
41  {
42  $this->actor = $actor;
43  }

◆ setRecord()

ilDataCollectionMailNotification::setRecord ( ilDclBaseRecordModel  $record)

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

References $record.

50  : void
51  {
52  $this->record = $record;
53  }

Field Documentation

◆ $actor

int ilDataCollectionMailNotification::$actor
private

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

Referenced by getActor(), and setActor().

◆ $record

ilDclBaseRecordModel ilDataCollectionMailNotification::$record
private

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

Referenced by getRecord(), and setRecord().

◆ TYPE_RECORD_CREATE

const ilDataCollectionMailNotification::TYPE_RECORD_CREATE = 1

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

Referenced by ilDclRecordEditGUI\save().

◆ TYPE_RECORD_DELETE

const ilDataCollectionMailNotification::TYPE_RECORD_DELETE = 3

◆ TYPE_RECORD_UPDATE

const ilDataCollectionMailNotification::TYPE_RECORD_UPDATE = 2

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