ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 \ILIAS\TestQuestionPool\Questions\PublicInterface $questioninfo;
26  protected int $question_id = 0;
27 
28  protected ilObjUser $user;
29 
30  public function __construct(
31  bool $a_is_personal_workspace = false
32  ) {
33  global $DIC;
34  parent::__construct($a_is_personal_workspace);
35  $this->user = $DIC->user();
36  $this->questioninfo = $DIC->testQuestion();
37  }
38 
39  public function setQuestionId(int $a_val): void
40  {
41  $this->question_id = $a_val;
42  }
43 
44  public function getQuestionId(): int
45  {
46  return $this->question_id;
47  }
48 
49  public function send(): bool
50  {
51  $ilUser = $this->user;
52 
53  switch ($this->getType()) {
54  case self::TYPE_USER_BLOCKED:
55 
56  foreach ($this->getRecipients() as $rcp) {
57  $this->initLanguage($rcp);
58  $this->initMail();
59  $this->setSubject(
60  sprintf(
61  $this->getLanguageText('cont_user_blocked'),
62  $this->getObjectTitle(true)
63  )
64  );
65  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
66  $this->appendBody("\n\n");
67  $this->appendBody(
68  $this->getLanguageText('cont_user_blocked2')
69  );
70  $this->appendBody("\n");
71  $this->appendBody(
72  $this->getLanguageText('cont_user_blocked3') . " '" . $this->getLanguageText('objs_qst') . "' > '" . $this->getLanguageText('cont_blocked_users') . "'"
73  );
74  $this->appendBody("\n");
75  $this->appendBody(
76  $this->getLanguageText('obj_lm') . ": " . $this->getObjectTitle(true)
77  );
78  $this->appendBody("\n");
79  $this->appendBody(
80  $this->getLanguageText('user') . ": " . ilUserUtil::getNamePresentation($ilUser->getId(), false, false, "")
81  );
82  $this->appendBody("\n");
83 
84  $this->appendBody(
85  $this->getLanguageText('question') . ": " . $this->questioninfo->getGeneralQuestionProperties($this->getQuestionId())->getTitle()
86  );
87  $this->appendBody("\n");
88  $this->appendBody("\n\n");
89  $this->appendBody($this->getLanguageText('cont_lm_mail_permanent_link'));
90  $this->appendBody("\n");
91  $this->appendBody($this->createPermanentLink(array(), ""));
92  $this->getMail()->appendInstallationSignature(true);
93  $this->sendMail(array($rcp));
94  }
95  break;
96  }
97  return true;
98  }
99 
100  protected function initLanguage(int $a_usr_id): void
101  {
102  parent::initLanguage($a_usr_id);
103  $this->getLanguage()->loadLanguageModule('content');
104  }
105 }
sendMail(array $a_rcp, bool $a_parse_recipients=true)
ILIAS TestQuestionPool Questions PublicInterface $questioninfo
__construct(bool $a_is_personal_workspace=false)
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:
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)
global $DIC
Definition: shib_login.php:22
getLanguageText(string $a_keyword)
getObjectTitle(bool $a_shorten=false)
createPermanentLink(array $a_params=[], string $a_append='')
__construct(Container $dic, ilPlugin $plugin)
setSubject(string $a_subject)