ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLMMailNotification.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Services/Mail/classes/class.ilMailNotification.php';
5 
13 {
17  protected $user;
18 
19 
23  public function __construct($a_is_personal_workspace = false)
24  {
25  global $DIC;
26  parent::__construct($a_is_personal_workspace);
27 
28  $this->user = $DIC->user();
29  }
30 
31  const TYPE_USER_BLOCKED = 10;
32 
38  public function setQuestionId($a_val)
39  {
40  $this->question_id = $a_val;
41  }
42 
48  public function getQuestionId()
49  {
50  return $this->question_id;
51  }
52 
57  public function send()
58  {
60 
61  switch ($this->getType()) {
62  case self::TYPE_USER_BLOCKED:
63 
64  foreach ($this->getRecipients() as $rcp) {
65  $this->initLanguage($rcp);
66  $this->initMail();
67  $this->setSubject(
68  sprintf(
69  $this->getLanguageText('cont_user_blocked'),
70  $this->getObjectTitle(true)
71  )
72  );
73  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
74  $this->appendBody("\n\n");
75  $this->appendBody(
76  $this->getLanguageText('cont_user_blocked2')
77  );
78  $this->appendBody("\n");
79  $this->appendBody(
80  $this->getLanguageText('cont_user_blocked3') . " '" . $this->getLanguageText('objs_qst') . "' > '" . $this->getLanguageText('cont_blocked_users') . "'"
81  );
82  $this->appendBody("\n");
83  $this->appendBody(
84  $this->getLanguageText('obj_lm') . ": " . $this->getObjectTitle(true)
85  );
86  $this->appendBody("\n");
87  include_once("./Services/User/classes/class.ilUserUtil.php");
88  $this->appendBody(
89  $this->getLanguageText('user') . ": " . ilUserUtil::getNamePresentation($ilUser->getId(), false, false, "")
90  );
91  $this->appendBody("\n");
92 
93  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
94  $this->appendBody(
95  $this->getLanguageText('question') . ": " . assQuestion::_getTitle($this->getQuestionId())
96  );
97  $this->appendBody("\n");
98  $this->appendBody("\n\n");
99  $this->appendBody($this->getLanguageText('cont_lm_mail_permanent_link'));
100  $this->appendBody("\n");
101  $this->appendBody($this->createPermanentLink(array(), ""));
102  $this->getMail()->appendInstallationSignature(true);
103  $this->sendMail(array($rcp), array('system'));
104  }
105  break;
106 
107  }
108  return true;
109  }
110 
116  protected function initLanguage($a_usr_id)
117  {
118  parent::initLanguage($a_usr_id);
119  $this->getLanguage()->loadLanguageModule('content');
120  }
121 }
getType()
Get notification type.
setQuestionId($a_val)
Set question id.
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
Base class for course/group mail notifications.
__construct($a_is_personal_workspace=false)
Constructor.
getObjectTitle($a_shorten=false)
$ilUser
Definition: imgupload.php:18
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
Create styles array
The data for the language used.
sendMail(array $a_rcp, $a_type, $a_parse_recipients=true)
getRecipients()
get array of recipients
createPermanentLink($a_params=array(), $a_append='')
initLanguage($a_usr_id)
Init language.
appendBody($a_body)
Append body text.
static _getTitle($a_q_id)
Returns the title of a question.
static getSalutation($a_usr_id, ilLanguage $a_language=null)