ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilTestManScoringParticipantNotification.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Mail/classes/class.ilMailNotification.php';
5
6
8{
9 private $userId = null;
10 private $questionGuiList = null;
11 private $notificationData = null;
12
13 public function __construct($userId, $testRefId)
14 {
15 parent::__construct();
16
17 $this->setRecipient($userId);
18 $this->setRefId($testRefId);
19
20 $this->initLanguage($this->getRecipient());
21 $this->getLanguage()->loadLanguageModule('assessment');
22
23 $this->initMail()->enableSoap(false);
24 }
25
26 public function send()
27 {
28 $this->buildSubject();
29
30 $this->buildBody();
31
32 $this->sendMail(
33 $this->getRecipients(),
34 array('system')
35 );
36 }
37
38 private function buildSubject()
39 {
41
42 $this->setSubject(sprintf($this->getLanguageText('tst_notify_manscoring_done_body_msg_subject'), $info['test_title']));
43 }
44
45 private function buildBody()
46 {
47 // Salutation
48
49 $this->setBody(
51 );
52 $this->appendBody("\n\n");
53
54 // Message (What has happened?)
55
56 $this->appendBody($this->getLanguageText('tst_notify_manscoring_done_body_msg_topic'));
57 $this->appendBody("\n\n");
58
60
61 $this->appendBody($this->getLanguageText('obj_tst') . ': ' . $info['test_title']);
62 $this->appendBody("\n");
63 $this->appendBody($this->getLanguageText('pass') . ': ' . $info['test_pass']);
64 $this->appendBody("\n\n");
65
66 foreach ($info['questions_gui_list'] as $questionId => $questionGui) {
67 $points = $info['questions_scoring_data'][$questionId]['points'];
68 $feedback = $info['questions_scoring_data'][$questionId]['feedback'];
69
70 $feedback = $this->convertFeedbackForMail($feedback);
71
72 $this->appendBody($this->getLanguageText('tst_question') . ': ' . $questionGui->object->getTitle());
73 $this->appendBody("\n");
74 $this->appendBody($this->getLanguageText('tst_reached_points') . ': ' . $points);
75 $this->appendBody("\n");
76 $this->appendBody($this->getLanguageText('set_manual_feedback') . ":\n" . $feedback);
77 $this->appendBody("\n\n");
78 }
79
80 // Task (What do I have to do?
81
82 /* NOTHING REQUIRED FOR PARTICIPANT */
83
84 // Explanation (Why do I receive the following message?)
85
86 $this->appendBody("\n");
87 $this->appendBody($this->getLanguageText('tst_notify_manscoring_done_body_msg_reason'));
88
89 // Signature
90
91 $this->getMail()->appendInstallationSignature(true);
92 }
93
94 private function setRecipient($userId)
95 {
96 $this->setRecipients(array($userId));
97 }
98
99 private function getRecipient()
100 {
101 return current($this->getRecipients());
102 }
103
104 private function convertFeedbackForMail($feedback)
105 {
106 if (strip_tags($feedback) != $feedback) {
107 $feedback = preg_replace('/<br(.*\/)>/m', "\n", $feedback);
108 $feedback = strip_tags($feedback);
109 }
110
111 return $feedback;
112 }
113}
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
Base class for course/group mail notifications.
appendBody($a_body)
Append body text.
sendMail(array $a_rcp, $a_type, $a_parse_recipients=true)
initLanguage($a_usr_id)
Init language.
getRecipients()
get array of recipients
static getSalutation($a_usr_id, ilLanguage $a_language=null)
$info
Definition: index.php:5