19declare(strict_types=1);
28 $this->recipients[] = $a_rcp;
51 public function send(): void
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);
60 foreach ($views as $view) {
61 foreach ($view->getVisibleFields() as $field) {
62 $visible_ids[] = $field->getId();
65 $visible_ids = array_unique($visible_ids);
67 $lng->loadLanguageModule(
'dcl');
70 $this->
setSubject(sprintf(
$lng->txt(
'dcl_change_notification_subject'), $title));
77 if ($visible_ids !== []) {
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();
88 $message .= $field->getTitle() .
': ' . $value .
"\n";
91 $message .=
"------------------------------------";
96 $this->
appendBody(
$lng->txt(
'dcl_change_notification_link') .
": $link");
97 $this->
getMail()->appendInstallationSignature(
true);
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');
118 return parent::appendBody($a_body .
"\n\n");
ilDclBaseRecordModel $record
appendBody(string $a_body)
getAction(ilLanguage $lng)
setRecord(ilDclBaseRecordModel $record)
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: