ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilExerciseMailNotification.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
10{
14 protected $user;
15
19
23 public function __construct()
24 {
25 global $DIC;
26
27 $this->user = $DIC->user();
29 }
30
36 public function setAssignmentId($a_val)
37 {
38 $this->ass_id = $a_val;
39 }
40
46 public function getAssignmentId()
47 {
48 return $this->ass_id;
49 }
50
55 public function send()
56 {
58 // parent::send();
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('exc_msg_new_feedback_file_uploaded'),
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('exc_msg_new_feedback_file_uploaded2')
76 );
77 $this->appendBody("\n");
78 $this->appendBody(
79 $this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true)
80 );
81 $this->appendBody("\n");
82 $this->appendBody(
83 $this->getLanguageText('exc_assignment') . ": " .
85 );
86 $this->appendBody("\n\n");
87 $this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
88 $this->appendBody("\n");
89 $this->appendBody($this->createPermanentLink(array(), '_' . $this->getAssignmentId()) .
90 '#fb' . $this->getAssignmentId());
91 $this->getMail()->appendInstallationSignature(true);
92
93 $this->sendMail(array($rcp));
94 }
95 break;
96
98
99 foreach ($this->getRecipients() as $rcp) {
100 $this->initLanguage($rcp);
101 $this->initMail();
102 $this->setSubject(
103 sprintf(
104 $this->getLanguageText('exc_submission_notification_subject'),
105 $this->getObjectTitle(true)
106 )
107 );
108 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
109 $this->appendBody("\n\n");
110 $this->appendBody(
111 sprintf($this->getLanguageText('exc_submission_notification_body'), $this->getObjectTitle(true))
112 );
113 $this->appendBody("\n");
114 $this->appendBody(
115 $this->getLanguageText('exc_assignment') . ": " .
117 );
118 $this->appendBody("\n");
119 $this->appendBody(
120 $this->getLanguageText('user') . ": " .
121 $ilUser->getFullName()
122 );
123 $this->appendBody("\n\n");
124 $this->appendBody(sprintf(
125 $this->getLanguageText('exc_submission_notification_link'),
126 $this->createPermanentLink()
127 ));
128
130 $this->appendBody("\n\n");
131
132 //new files uploaded
133 $assignment = new ilExAssignment($this->getAssignmentId());
134 $submission = new ilExSubmission($assignment, $ilUser->getId());
135
136 // since mails are sent immediately after upload the files should always be new
137 //if($submission->lookupNewFiles($submission->getTutor()))
138 //{
139 $this->appendBody(sprintf(
140 $this->getLanguageText('exc_submission_downloads_notification_link'),
141 $this->createPermanentLink(array(), "_" . $this->getAssignmentId() . "_" . $ilUser->getId() . "_setdownload")
142 ));
143 //}
144 //else
145 //{
146 // $this->appendBody(sprintf($this->getLanguageText('exc_submission_downloads_notification_link'),
147 // $this->getLanguageText("exc_submission_no_new_files")));
148 //}
149 }
150
151 $this->appendBody("\n\n");
152 $this->appendBody(sprintf(
153 $this->getLanguageText('exc_submission_and_grades_notification_link'),
154 $this->createPermanentLink(array(), "_" . $this->getAssignmentId() . "_grades")
155 ));
156
157 $this->getMail()->appendInstallationSignature(true);
158
159 $this->sendMail(array($rcp));
160 }
161 break;
162
164
165 foreach ($this->getRecipients() as $rcp) {
166 $this->initLanguage($rcp);
167 $this->initMail();
168 $this->setSubject(
169 sprintf(
170 $this->getLanguageText('exc_msg_new_feedback_text_uploaded'),
171 $this->getObjectTitle(true)
172 )
173 );
174 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
175 $this->appendBody("\n\n");
176 $this->appendBody(
177 $this->getLanguageText('exc_msg_new_feedback_text_uploaded2')
178 );
179 $this->appendBody("\n");
180 $this->appendBody(
181 $this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true)
182 );
183 $this->appendBody("\n");
184 $this->appendBody(
185 $this->getLanguageText('exc_assignment') . ": " .
187 );
188 $this->appendBody("\n\n");
189 $this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
190 $this->appendBody("\n");
191 $this->appendBody($this->createPermanentLink(array(), '_' . $this->getAssignmentId()) .
192 '#fb' . $this->getAssignmentId());
193 $this->getMail()->appendInstallationSignature(true);
194
195 $this->sendMail(array($rcp));
196 }
197 break;
198 }
199 return true;
200 }
201
207 protected function initLanguage($a_usr_id)
208 {
209 parent::initLanguage($a_usr_id);
210 $this->getLanguage()->loadLanguageModule('exc');
211 }
212}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
Exercise assignment.
static lookupTitle($a_id)
Lookup title.
static lookupType($a_id)
Lookup type.
Exercise submission //TODO: This class has to much static methods related to delivered "files".
initLanguage($a_usr_id)
Add language module exc.
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)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46