ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilIndividualAssessmentPrimitiveInternalNotificator.php
Go to the documentation of this file.
1<?php
2require_once 'Services/Mail/classes/class.ilMailNotification.php';
3require_once 'Modules/IndividualAssessment/interfaces/Notification/interface.ilIndividualAssessmentNotificator.php';
9{
10 const OCCASION_FAILED = 0;
12
13 protected $occasion;
14 protected $reciever;
15
16 public function __construct()
17 {
18 parent::__construct();
19 $this->setLangModules(array('iass'));
20 }
21
26 {
27 $clone = clone $this;
28 $clone->reciever = $member;
29 $clone->ref_id = $member->assessment()->getRefId();
30 return $clone;
31 }
32
36 public function withOccasionFailed()
37 {
38 $clone = clone $this;
39 $clone->occasion = self::OCCASION_FAILED;
40 return $clone;
41 }
42
46 public function withOccasionCompleted()
47 {
48 $clone = clone $this;
49 $clone->occasion = self::OCCASION_COMPLETED;
50 return $clone;
51 }
52
56 public function send()
57 {
58 if (!$this->reciever instanceof ilIndividualAssessmentMember || !in_array($this->occasion, array(self::OCCASION_COMPLETED,self::OCCASION_FAILED))) {
59 throw new ilIndividualAssessmentException('can\'t notify');
60 }
61 $this->initLanguage($this->reciever->id());
62 $this->initMail();
63 $subject = $this->occasion === self::OCCASION_COMPLETED
64 ? $this->getLanguageText('iass_subj_notification_completed')
65 : $this->getLanguageText('iass_subj_notification_failed');
66 $message = $this->occasion === self::OCCASION_COMPLETED
67 ? $this->getLanguageText('iass_mess_notification_completed')
68 : $this->getLanguageText('iass_mess_notification_failed');
69 $assessment_title = $this->reciever->assessment()->getTitle();
70 $this->setSubject(
71 sprintf($subject, $assessment_title)
72 );
73 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
74 $this->appendBody("\n\n");
75 $this->appendBody(sprintf($message, $assessment_title));
76 $this->appendBody("\n\n");
77 $this->appendBody($this->reciever->record());
78 $this->appendBody("\n\n");
79 $this->appendBody($this->createPermanentLink());
80 $this->getMail()->appendInstallationSignature(true);
81 $this->sendMail(array($this->reciever->id()), array('system'));
82 }
83}
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
Edit the record of a user, set LP.
assessment()
Get the ilObjIndividualAssessment corresponding to this membership.
withReciever(ilIndividualAssessmentMember $member)
Define the member, that should recieve the message.ilIndividualAssessmentNotificator $this
withOccasionFailed()
Set message mode to failed.ilIndividualAssessmentNotificator $this
withOccasionCompleted()
Set message mode to completed.ilIndividualAssessmentNotificator $this
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.
setLangModules(array $a_modules)
Set lang modules.
createPermanentLink($a_params=array(), $a_append='')
static getSalutation($a_usr_id, ilLanguage $a_language=null)
Basic method collection should be implemented by a notificator used by Individual assessment.
catch(Exception $e) $message