ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
4include_once './Services/Mail/classes/class.ilMailNotification.php';
5
13{
17 protected $user;
18
22
26 public function __construct()
27 {
28 global $DIC;
29
30 $this->user = $DIC->user();
31 parent::__construct();
32 }
33
39 public function setAssignmentId($a_val)
40 {
41 $this->ass_id = $a_val;
42 }
43
49 public function getAssignmentId()
50 {
51 return $this->ass_id;
52 }
53
58 public function send()
59 {
61 // parent::send();
62
63 include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
64
65 switch ($this->getType()) {
67
68 foreach ($this->getRecipients() as $rcp) {
69 $this->initLanguage($rcp);
70 $this->initMail();
71 $this->setSubject(
72 sprintf(
73 $this->getLanguageText('exc_msg_new_feedback_file_uploaded'),
74 $this->getObjectTitle(true)
75 )
76 );
77 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
78 $this->appendBody("\n\n");
79 $this->appendBody(
80 $this->getLanguageText('exc_msg_new_feedback_file_uploaded2')
81 );
82 $this->appendBody("\n");
83 $this->appendBody(
84 $this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true)
85 );
86 $this->appendBody("\n");
87 $this->appendBody(
88 $this->getLanguageText('exc_assignment') . ": " .
90 );
91 $this->appendBody("\n\n");
92 $this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
93 $this->appendBody("\n");
94 $this->appendBody($this->createPermanentLink(array(), '_' . $this->getAssignmentId()) .
95 '#fb' . $this->getAssignmentId());
96 $this->getMail()->appendInstallationSignature(true);
97
98 $this->sendMail(array($rcp), array('system'));
99 }
100 break;
101
103
104 foreach ($this->getRecipients() as $rcp) {
105 $this->initLanguage($rcp);
106 $this->initMail();
107 $this->setSubject(
108 sprintf(
109 $this->getLanguageText('exc_submission_notification_subject'),
110 $this->getObjectTitle(true)
111 )
112 );
113 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
114 $this->appendBody("\n\n");
115 $this->appendBody(
116 sprintf($this->getLanguageText('exc_submission_notification_body'), $this->getObjectTitle(true))
117 );
118 $this->appendBody("\n");
119 $this->appendBody(
120 $this->getLanguageText('exc_assignment') . ": " .
122 );
123 $this->appendBody("\n");
124 $this->appendBody(
125 $this->getLanguageText('user') . ": " .
126 $ilUser->getFullName()
127 );
128 $this->appendBody("\n\n");
129 $this->appendBody(sprintf(
130 $this->getLanguageText('exc_submission_notification_link'),
131 $this->createPermanentLink()
132 ));
133
135 $this->appendBody("\n\n");
136
137 //new files uploaded
138 $assignment = new ilExAssignment($this->getAssignmentId());
139 $submission = new ilExSubmission($assignment, $ilUser->getId());
140
141 // since mails are sent immediately after upload the files should always be new
142 //if($submission->lookupNewFiles($submission->getTutor()))
143 //{
144 $this->appendBody(sprintf(
145 $this->getLanguageText('exc_submission_downloads_notification_link'),
146 $this->createPermanentLink(array(), "_" . $this->getAssignmentId() . "_" . $ilUser->getId() . "_setdownload")
147 ));
148 //}
149 //else
150 //{
151 // $this->appendBody(sprintf($this->getLanguageText('exc_submission_downloads_notification_link'),
152 // $this->getLanguageText("exc_submission_no_new_files")));
153 //}
154 }
155
156 $this->appendBody("\n\n");
157 $this->appendBody(sprintf(
158 $this->getLanguageText('exc_submission_and_grades_notification_link'),
159 $this->createPermanentLink(array(), "_" . $this->getAssignmentId() . "_grades")
160 ));
161
162 $this->getMail()->appendInstallationSignature(true);
163
164 $this->sendMail(array($rcp), array('system'));
165 }
166 break;
167
169
170 foreach ($this->getRecipients() as $rcp) {
171 $this->initLanguage($rcp);
172 $this->initMail();
173 $this->setSubject(
174 sprintf(
175 $this->getLanguageText('exc_msg_new_feedback_text_uploaded'),
176 $this->getObjectTitle(true)
177 )
178 );
179 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
180 $this->appendBody("\n\n");
181 $this->appendBody(
182 $this->getLanguageText('exc_msg_new_feedback_text_uploaded2')
183 );
184 $this->appendBody("\n");
185 $this->appendBody(
186 $this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true)
187 );
188 $this->appendBody("\n");
189 $this->appendBody(
190 $this->getLanguageText('exc_assignment') . ": " .
192 );
193 $this->appendBody("\n\n");
194 $this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
195 $this->appendBody("\n");
196 $this->appendBody($this->createPermanentLink(array(), '_' . $this->getAssignmentId()) .
197 '#fb' . $this->getAssignmentId());
198 $this->getMail()->appendInstallationSignature(true);
199
200 $this->sendMail(array($rcp), array('system'));
201 }
202 break;
203 }
204 return true;
205 }
206
212 protected function initLanguage($a_usr_id)
213 {
214 parent::initLanguage($a_usr_id);
215 $this->getLanguage()->loadLanguageModule('exc');
216 }
217}
sprintf('%.4f', $callTime)
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.
initLanguage($a_usr_id)
Add language module exc.
Base class for course/group mail notifications.
appendBody($a_body)
Append body text.
sendMail(array $a_rcp, $a_type, $a_parse_recipients=true)
getType()
Get notification type.
getRecipients()
get array of recipients
getObjectTitle($a_shorten=false)
createPermanentLink($a_params=array(), $a_append='')
static getSalutation($a_usr_id, ilLanguage $a_language=null)
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18