19 declare(strict_types=1);
32 $this->recipients[] = $a_rcp;
55 public function send(): void
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);
64 foreach ($views as $view) {
65 foreach ($view->getVisibleFields() as $field) {
66 $visible_ids[] = $field->getId();
69 $visible_ids = array_unique($visible_ids);
71 $lng->loadLanguageModule(
'dcl');
74 $this->
setSubject(sprintf(
$lng->txt(
'dcl_change_notification_subject'), $title));
80 if ($visible_ids !== []) {
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();
91 $message .= $field->getTitle() .
': ' . $value .
"\n";
94 $message .=
"------------------------------------";
99 $this->
appendBody(
$lng->txt(
'dcl_change_notification_link') .
": $link");
100 $this->
getMail()->appendInstallationSignature(
true);
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');
121 return parent::appendBody($a_body .
"\n\n");
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...
sendMail(array $a_rcp, bool $a_parse_recipients=true)
setRecord(ilDclBaseRecordModel $record)
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)
ilDclBaseRecordModel $record
setSubject(string $a_subject)
appendBody(string $a_body)
getAction(ilLanguage $lng)