ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilLMMailNotification.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
12{
16 protected $user;
17
18
22 public function __construct($a_is_personal_workspace = false)
23 {
24 global $DIC;
25 parent::__construct($a_is_personal_workspace);
26
27 $this->user = $DIC->user();
28 }
29
31
37 public function setQuestionId($a_val)
38 {
39 $this->question_id = $a_val;
40 }
41
47 public function getQuestionId()
48 {
49 return $this->question_id;
50 }
51
56 public function send()
57 {
59
60 switch ($this->getType()) {
62
63 foreach ($this->getRecipients() as $rcp) {
64 $this->initLanguage($rcp);
65 $this->initMail();
66 $this->setSubject(
67 sprintf(
68 $this->getLanguageText('cont_user_blocked'),
69 $this->getObjectTitle(true)
70 )
71 );
72 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
73 $this->appendBody("\n\n");
74 $this->appendBody(
75 $this->getLanguageText('cont_user_blocked2')
76 );
77 $this->appendBody("\n");
78 $this->appendBody(
79 $this->getLanguageText('cont_user_blocked3') . " '" . $this->getLanguageText('objs_qst') . "' > '" . $this->getLanguageText('cont_blocked_users') . "'"
80 );
81 $this->appendBody("\n");
82 $this->appendBody(
83 $this->getLanguageText('obj_lm') . ": " . $this->getObjectTitle(true)
84 );
85 $this->appendBody("\n");
86 $this->appendBody(
87 $this->getLanguageText('user') . ": " . ilUserUtil::getNamePresentation($ilUser->getId(), false, false, "")
88 );
89 $this->appendBody("\n");
90
91 $this->appendBody(
92 $this->getLanguageText('question') . ": " . assQuestion::_getTitle($this->getQuestionId())
93 );
94 $this->appendBody("\n");
95 $this->appendBody("\n\n");
96 $this->appendBody($this->getLanguageText('cont_lm_mail_permanent_link'));
97 $this->appendBody("\n");
98 $this->appendBody($this->createPermanentLink(array(), ""));
99 $this->getMail()->appendInstallationSignature(true);
100 $this->sendMail(array($rcp));
101 }
102 break;
103
104 }
105 return true;
106 }
107
113 protected function initLanguage($a_usr_id)
114 {
115 parent::initLanguage($a_usr_id);
116 $this->getLanguage()->loadLanguageModule('content');
117 }
118}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
static _getTitle($a_q_id)
Returns the title of a question.
initLanguage($a_usr_id)
Init language.
__construct($a_is_personal_workspace=false)
Constructor.
setQuestionId($a_val)
Set question id.
Base class for course/group mail notifications.
appendBody($a_body)
Append body text.
getType()
Get notification type.
sendMail(array $a_rcp, $a_parse_recipients=true)
getRecipients()
get array of recipients
getObjectTitle($a_shorten=false)
createPermanentLink($a_params=array(), $a_append='')
static getSalutation($a_usr_id, ilLanguage $a_language=null)
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:
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc