ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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(), array('system')
34 );
35 }
36
37 private function buildSubject()
38 {
40
41 $this->setSubject( sprintf($this->getLanguageText('tst_notify_manscoring_done_body_msg_subject'), $info['test_title']) );
42 }
43
44 private function buildBody()
45 {
46 // Salutation
47
48 $this->setBody(
50 );
51 $this->appendBody("\n\n");
52
53 // Message (What has happened?)
54
55 $this->appendBody( $this->getLanguageText('tst_notify_manscoring_done_body_msg_topic') );
56 $this->appendBody("\n\n");
57
59
60 $this->appendBody( $this->getLanguageText('obj_tst').': '.$info['test_title'] );
61 $this->appendBody("\n");
62 $this->appendBody( $this->getLanguageText('pass').': '.$info['test_pass'] );
63 $this->appendBody("\n\n");
64
65 foreach($info['questions_gui_list'] as $questionId => $questionGui)
66 {
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 TODO 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 {
108 $feedback = preg_replace('/<br(.*\/)>/m', "\n", $feedback);
109 $feedback = strip_tags($feedback);
110 }
111
112 return $feedback;
113 }
114}
115
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, $a_language=null)
Get salutation.
$info
Definition: example_052.php:80