ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLMMailNotification.php
Go to the documentation of this file.
1 <?php
2 
23 {
24  public const TYPE_USER_BLOCKED = 10;
25  protected int $question_id = 0;
26 
27  protected ilObjUser $user;
28 
29  public function __construct(
30  bool $a_is_personal_workspace = false
31  ) {
32  global $DIC;
33  parent::__construct($a_is_personal_workspace);
34  $this->user = $DIC->user();
35  }
36 
37  public function setQuestionId(int $a_val): void
38  {
39  $this->question_id = $a_val;
40  }
41 
42  public function getQuestionId(): int
43  {
44  return $this->question_id;
45  }
46 
47  public function send(): bool
48  {
50 
51  switch ($this->getType()) {
52  case self::TYPE_USER_BLOCKED:
53 
54  foreach ($this->getRecipients() as $rcp) {
55  $this->initLanguage($rcp);
56  $this->initMail();
57  $this->setSubject(
58  sprintf(
59  $this->getLanguageText('cont_user_blocked'),
60  $this->getObjectTitle(true)
61  )
62  );
63  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
64  $this->appendBody("\n\n");
65  $this->appendBody(
66  $this->getLanguageText('cont_user_blocked2')
67  );
68  $this->appendBody("\n");
69  $this->appendBody(
70  $this->getLanguageText('cont_user_blocked3') . " '" . $this->getLanguageText('objs_qst') . "' > '" . $this->getLanguageText('cont_blocked_users') . "'"
71  );
72  $this->appendBody("\n");
73  $this->appendBody(
74  $this->getLanguageText('obj_lm') . ": " . $this->getObjectTitle(true)
75  );
76  $this->appendBody("\n");
77  $this->appendBody(
78  $this->getLanguageText('user') . ": " . ilUserUtil::getNamePresentation($ilUser->getId(), false, false, "")
79  );
80  $this->appendBody("\n");
81 
82  $this->appendBody(
83  $this->getLanguageText('question') . ": " . assQuestion::_getTitle($this->getQuestionId())
84  );
85  $this->appendBody("\n");
86  $this->appendBody("\n\n");
87  $this->appendBody($this->getLanguageText('cont_lm_mail_permanent_link'));
88  $this->appendBody("\n");
89  $this->appendBody($this->createPermanentLink(array(), ""));
90  $this->getMail()->appendInstallationSignature(true);
91  $this->sendMail(array($rcp));
92  }
93  break;
94 
95  }
96  return true;
97  }
98 
99  protected function initLanguage(int $a_usr_id): void
100  {
101  parent::initLanguage($a_usr_id);
102  $this->getLanguage()->loadLanguageModule('content');
103  }
104 }
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:
sendMail(array $a_rcp, bool $a_parse_recipients=true)
__construct(bool $a_is_personal_workspace=false)
global $DIC
Definition: feed.php:28
Base class for course/group mail notifications.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getSalutation(int $a_usr_id, ?ilLanguage $a_language=null)
static _getTitle(int $a_q_id)
getLanguageText(string $a_keyword)
getObjectTitle(bool $a_shorten=false)
createPermanentLink(array $a_params=[], string $a_append='')
__construct(Container $dic, ilPlugin $plugin)
$ilUser
Definition: imgupload.php:34
setSubject(string $a_subject)