ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilMailOptionsGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once "Services/Mail/classes/class.ilMailbox.php";
5require_once "Services/Mail/classes/class.ilFormatMail.php";
6require_once 'Services/Mail/classes/class.ilMailOptions.php';
7require_once 'Services/Mail/classes/class.ilMailOptionsFormGUI.php';
8
16{
20 private $tpl;
21
25 private $ctrl;
26
30 private $lng;
31
35 private $settings;
36
40 private $user;
41
45 private $umail;
46
50 private $mbox;
51
55 public function __construct()
56 {
57 global $DIC;
58
59 $this->tpl = $DIC->ui()->mainTemplate();
60 $this->ctrl = $DIC->ctrl();
61 $this->settings = $DIC->settings();
62 $this->lng = $DIC->language();
63 $this->user = $DIC->user();
64
65 $this->lng->loadLanguageModule('mail');
66
67 $this->ctrl->saveParameter($this, 'mobj_id');
68
69 $this->umail = new ilFormatMail($this->user->getId());
70 $this->mbox = new ilMailBox($this->user->getId());
71 }
72
73 public function executeCommand()
74 {
75 $nextClass = $this->ctrl->getNextClass($this);
76 switch ($nextClass) {
77 default:
78 if (!($cmd = $this->ctrl->getCmd())) {
79 $cmd = 'showOptions';
80 }
81
82 $this->$cmd();
83 break;
84 }
85 }
86
90 protected function getForm()
91 {
92 return new ilMailOptionsFormGUI(
93 new ilMailOptions($this->user->getId()),
94 $this,
95 'saveOptions'
96 );
97 }
98
103 public function saveOptions()
104 {
105 $this->tpl->setTitle($this->lng->txt('mail'));
106
107 $form = $this->getForm();
108 if ($form->save()) {
109 ilUtil::sendSuccess($this->lng->txt('mail_options_saved'));
110 }
111
112 $this->showOptions($form);
113 }
114
119 public function showOptions(ilMailOptionsFormGUI $form = null)
120 {
121 if (null === $form) {
122 $form = $this->getForm();
123 $form->populate();
124 } else {
125 $form->setValuesByPost();
126 }
127
128 $this->tpl->setContent($form->getHTML());
129 $this->tpl->show();
130 }
131}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
Class UserMail this class handles user mails.
Class ilMailOptionsFormGUI.
showOptions(ilMailOptionsFormGUI $form=null)
Called to display the mail options form.
saveOptions()
Called if the user pushes the submit button of the mail options form.
__construct()
ilMailOptionsGUI constructor.
Class ilMailOptions this class handles user mails.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2