ILIAS  release_7 Revision v7.30-3-g800a261c036
ilMailOptionsGUI Class Reference
+ Collaboration diagram for ilMailOptionsGUI:

Public Member Functions

 __construct (ilGlobalPageTemplate $tpl=null, ilCtrl $ctrl=null, ilLanguage $lng=null, ilObjUser $user=null, ServerRequestInterface $request=null, ilFormatMail $mail=null, ilMailbox $malBox=null, ilMailOptions $mail_options=null)
 ilMailOptionsGUI constructor. More...
 
 executeCommand ()
 
 setForm (ilMailOptionsFormGUI $form)
 

Protected Member Functions

 getForm ()
 
 saveOptions ()
 Called if the user pushes the submit button of the mail options form. More...
 
 showOptions (ilMailOptionsFormGUI $form=null)
 Called to display the mail options form. More...
 

Protected Attributes

 $request
 
 $form
 
 $mail_options
 

Private Attributes

 $tpl
 
 $ctrl
 
 $lng
 
 $settings
 
 $user
 
 $umail
 
 $mbox
 

Detailed Description

Author
Jens Conze
Version
$Id$

Definition at line 12 of file class.ilMailOptionsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailOptionsGUI::__construct ( ilGlobalPageTemplate  $tpl = null,
ilCtrl  $ctrl = null,
ilLanguage  $lng = null,
ilObjUser  $user = null,
ServerRequestInterface  $request = null,
ilFormatMail  $mail = null,
ilMailbox  $malBox = null,
ilMailOptions  $mail_options = null 
)

ilMailOptionsGUI constructor.

Parameters
ilGlobalPageTemplate | null$tpl
ilCtrl | null$ctrl
ilLanguage | null$lng
ilObjUser | null$user
ServerRequestInterface | null$request
ilFormatMail | null$mail
ilMailbox | null$malBox

Definition at line 53 of file class.ilMailOptionsGUI.php.

62 {
63 global $DIC;
64
65 $this->tpl = $tpl;
66 if (null === $this->tpl) {
67 $this->tpl = $DIC->ui()->mainTemplate();
68 }
69
70 $this->ctrl = $ctrl;
71 if (null === $this->ctrl) {
72 $this->ctrl = $DIC->ctrl();
73 }
74
75 $this->lng = $lng;
76 if (null === $this->lng) {
77 $this->lng = $DIC->language();
78 }
79
80 $this->user = $user;
81 if (null === $this->user) {
82 $this->user = $DIC->user();
83 }
84
85 $this->request = $request;
86 if (null === $this->request) {
87 $this->request = $DIC->http()->request();
88 }
89
90 $this->umail = $mail;
91 if (null === $this->umail) {
92 $this->umail = new ilFormatMail($this->user->getId());
93 }
94
95 $this->mbox = $malBox;
96 if (null === $this->mbox) {
97 $this->mbox = new ilMailbox($this->user->getId());
98 }
99 $this->mail_options = $mail_options ?? new ilMailOptions((int) $this->user->getId());
100
101 $this->lng->loadLanguageModule('mail');
102 $this->ctrl->saveParameter($this, 'mobj_id');
103 }
user()
Definition: user.php:4
Class UserMail this class handles user mails.
Class ilMailOptions this class handles user mails.
Mail Box class Base class for creating and handling mail boxes.
global $DIC
Definition: goto.php:24

References $ctrl, $DIC, $lng, $mail_options, $request, $tpl, $user, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilMailOptionsGUI::executeCommand ( )

Definition at line 105 of file class.ilMailOptionsGUI.php.

105 : void
106 {
107 if (!$this->mail_options->mayManageInvididualSettings()) {
108 $referrer = $this->request->getQueryParams()['referrer'] ?? '';
109 if (strtolower('ilPersonalSettingsGUI') === strtolower($referrer)) {
110 $this->ctrl->redirectByClass('ilPersonalSettingsGUI');
111 return;
112 }
113 $this->ctrl->redirectByClass('ilMailGUI');
114 return;
115 }
116
117 $nextClass = $this->ctrl->getNextClass($this);
118 switch ($nextClass) {
119 default:
120 if (!($cmd = $this->ctrl->getCmd())) {
121 $cmd = 'showOptions';
122 }
123
124 $this->$cmd();
125 break;
126 }
127 }

◆ getForm()

ilMailOptionsGUI::getForm ( )
protected
Returns
ilMailOptionsFormGUI

Definition at line 140 of file class.ilMailOptionsGUI.php.

141 {
142 if (null !== $this->form) {
143 return $this->form;
144 }
145
146 return new ilMailOptionsFormGUI(
147 $this->mail_options,
148 $this,
149 'saveOptions'
150 );
151 }
Class ilMailOptionsFormGUI.

References $form.

Referenced by saveOptions(), and showOptions().

+ Here is the caller graph for this function:

◆ saveOptions()

ilMailOptionsGUI::saveOptions ( )
protected

Called if the user pushes the submit button of the mail options form.

Passes the post data to the mail options model instance to store them.

Definition at line 157 of file class.ilMailOptionsGUI.php.

157 : void
158 {
159 $this->tpl->setTitle($this->lng->txt('mail'));
160
161 $form = $this->getForm();
162 if ($form->save()) {
163 ilUtil::sendSuccess($this->lng->txt('mail_options_saved'), true);
164 $this->ctrl->redirect($this, 'showOptions');
165 }
166
167 $this->showOptions($form);
168 }
showOptions(ilMailOptionsFormGUI $form=null)
Called to display the mail options form.

References $form, getForm(), and showOptions().

+ Here is the call graph for this function:

◆ setForm()

ilMailOptionsGUI::setForm ( ilMailOptionsFormGUI  $form)
Parameters
ilMailOptionsFormGUI$form

Definition at line 132 of file class.ilMailOptionsGUI.php.

132 : void
133 {
134 $this->form = $form;
135 }

References $form.

◆ showOptions()

ilMailOptionsGUI::showOptions ( ilMailOptionsFormGUI  $form = null)
protected

Called to display the mail options form.

Parameters
$formilMailOptionsFormGUI|null

Definition at line 174 of file class.ilMailOptionsGUI.php.

174 : void
175 {
176 if (null === $form) {
177 $form = $this->getForm();
178 $form->populate();
179 } else {
180 $form->setValuesByPost();
181 }
182
183 $this->tpl->setContent($form->getHTML());
184 $this->tpl->printToStdout();
185 }

References $form, and getForm().

Referenced by saveOptions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilMailOptionsGUI::$ctrl
private

Definition at line 18 of file class.ilMailOptionsGUI.php.

Referenced by __construct().

◆ $form

ilMailOptionsGUI::$form
protected

Definition at line 39 of file class.ilMailOptionsGUI.php.

Referenced by getForm(), saveOptions(), setForm(), and showOptions().

◆ $lng

ilMailOptionsGUI::$lng
private

Definition at line 21 of file class.ilMailOptionsGUI.php.

Referenced by __construct().

◆ $mail_options

ilMailOptionsGUI::$mail_options
protected

Definition at line 41 of file class.ilMailOptionsGUI.php.

Referenced by __construct().

◆ $mbox

ilMailOptionsGUI::$mbox
private

Definition at line 33 of file class.ilMailOptionsGUI.php.

◆ $request

ilMailOptionsGUI::$request
protected

Definition at line 36 of file class.ilMailOptionsGUI.php.

Referenced by __construct().

◆ $settings

ilMailOptionsGUI::$settings
private

Definition at line 24 of file class.ilMailOptionsGUI.php.

◆ $tpl

ilMailOptionsGUI::$tpl
private

Definition at line 15 of file class.ilMailOptionsGUI.php.

Referenced by __construct().

◆ $umail

ilMailOptionsGUI::$umail
private

Definition at line 30 of file class.ilMailOptionsGUI.php.

◆ $user

ilMailOptionsGUI::$user
private

Definition at line 27 of file class.ilMailOptionsGUI.php.

Referenced by __construct().


The documentation for this class was generated from the following file: