1<?php
2/* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once './Services/Mail/classes/class.ilMimeMailNotification.php';
5include_once './Services/Mail/classes/class.ilMimeMail.php';
6
7/**
8 * Class ilCronDeleteInactiveUserReminderMailNotification
9 * @author Guido Vollbach <gvollbach@databay.de>
10 * @version $Id$
11 * @package Services/User
12 */
13class ilCronDeleteInactiveUserReminderMailNotification extends ilMimeMailNotification
14{
15    /**
16     * Constructor
17     */
18    public function __construct()
19    {
20        parent::__construct();
21    }
22
23    /**
24     * @param string $a_code
25     */
26    protected function initLanguageByIso2Code($a_code = '')
27    {
28        parent::initLanguageByIso2Code($a_code);
29        $this->getLanguage()->loadLanguageModule('user');
30    }
31
32    public function send()
33    {
34        global $DIC;
35
36        $lng = $DIC['lng'];
37
38        $additional_information = $this->getAdditionalInformation();
39
40        $old_val = ilDatePresentation::useRelativeDates();
41        ilDatePresentation::setUseRelativeDates(false);
42
43        foreach ($this->getRecipients() as $rcp) {
44            try {
45                $this->handleCurrentRecipient($rcp);
46            } catch (ilMailException $e) {
47                continue;
48            }
49
50            $this->initMimeMail();
51            $this->initLanguageByIso2Code();
52
53            ilDatePresentation::setLanguage($this->getLanguage());
54            $date_for_deletion = ilDatePresentation::formatDate(new ilDate($additional_information["date"], IL_CAL_UNIX));
55
56            $this->setSubject($this->getLanguage()->txt('del_mail_subject'));
57            $body = sprintf($this->getLanguage()->txt("del_mail_body"), $rcp->fullname, "\n\n", $additional_information["www"], $date_for_deletion);
58            $this->appendBody($body);
59            $this->appendBody(ilMail::_getInstallationSignature());
60            $this->sendMimeMail($this->getCurrentRecipient());
61        }
62
63        ilDatePresentation::setUseRelativeDates($old_val);
64        ilDatePresentation::setLanguage($lng);
65    }
66}
67