ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMailOptionsGUI Class Reference
+ Collaboration diagram for ilMailOptionsGUI:

Public Member Functions

 __construct (\ilTemplate $tpl=null, \ilCtrl $ctrl=null, \ilSetting $setting=null, \ilLanguage $lng=null, \ilObjUser $user=null, \Psr\Http\Message\ServerRequestInterface $request=null, \ilFormatMail $mail=null, \ilMailbox $malBox=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 = null
 

Private Attributes

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

Detailed Description

Author
Jens Conze
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilMailOptionsGUI::__construct ( \ilTemplate  $tpl = null,
\ilCtrl  $ctrl = null,
\ilSetting  $setting = null,
\ilLanguage  $lng = null,
\ilObjUser  $user = null,
\Psr\Http\Message\ServerRequestInterface  $request = null,
\ilFormatMail  $mail = null,
\ilMailbox  $malBox = null 
)

ilMailOptionsGUI constructor.

Parameters
ilTemplate | null$tpl
ilCtrl | null$ctrl
ilSetting | null$setting
ilLanguage | null$lng
ilObjUser | null$user
\Psr\Http\Message\ServerRequestInterface | null$request
\ilFormatMail | null$mail
\ilMailBox | null$malBox

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

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

77  {
78  global $DIC;
79 
80  $this->tpl = $tpl;
81  if (null === $this->tpl) {
82  $this->tpl = $DIC->ui()->mainTemplate();
83  }
84 
85  $this->ctrl = $ctrl;
86  if (null === $this->ctrl) {
87  $this->ctrl = $DIC->ctrl();
88  }
89 
90  $this->settings = $setting;
91  if (null === $this->settings) {
92  $this->settings = $DIC->settings();
93  }
94 
95  $this->lng = $lng;
96  if (null === $this->lng) {
97  $this->lng = $DIC->language();
98  }
99 
100  $this->user = $user;
101  if (null === $this->user) {
102  $this->user = $DIC->user();
103  }
104 
105  $this->request = $request;
106  if (null === $this->request) {
107  $this->request = $DIC->http()->request();
108  }
109 
110  $this->umail = $mail;
111  if (null === $this->umail) {
112  $this->umail = new \ilFormatMail($this->user->getId());
113  }
114 
115  $this->mbox = $malBox;
116  if (null === $this->mbox) {
117  $this->mbox = new \ilMailbox($this->user->getId());
118  }
119 
120  $this->lng->loadLanguageModule('mail');
121  $this->ctrl->saveParameter($this, 'mobj_id');
122  }
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilMailOptionsGUI::executeCommand ( )

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

References settings().

125  {
126  if (!$this->settings->get('show_mail_settings')) {
127  $referrer = $this->request->getQueryParams()['referrer'] ?? '';
128  if (strtolower('ilPersonalSettingsGUI') === strtolower($referrer)) {
129  $this->ctrl->redirectByClass('ilPersonalSettingsGUI');
130  return;
131  }
132  $this->ctrl->redirectByClass('ilMailGUI');
133  return;
134  }
135 
136  $nextClass = $this->ctrl->getNextClass($this);
137  switch ($nextClass) {
138  default:
139  if (!($cmd = $this->ctrl->getCmd())) {
140  $cmd = 'showOptions';
141  }
142 
143  $this->$cmd();
144  break;
145  }
146  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ getForm()

ilMailOptionsGUI::getForm ( )
protected
Returns

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

References $form, and user().

Referenced by saveOptions(), and showOptions().

160  {
161  if (null !== $this->form) {
162  return $this->form;
163  }
164 
165  return new \ilMailOptionsFormGUI(
166  new \ilMailOptions($this->user->getId()),
167  $this,
168  'saveOptions'
169  );
170  }
Class ilMailOptions this class handles user mails.
user()
Definition: user.php:4
+ Here is the call graph for this function:
+ 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 176 of file class.ilMailOptionsGUI.php.

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

177  {
178  $this->tpl->setTitle($this->lng->txt('mail'));
179 
180  $form = $this->getForm();
181  if ($form->save()) {
182  ilUtil::sendSuccess($this->lng->txt('mail_options_saved'), true);
183  $this->ctrl->redirect($this, 'showOptions');
184  }
185 
186  $this->showOptions($form);
187  }
showOptions(\ilMailOptionsFormGUI $form=null)
Called to display the mail options form.
+ Here is the call graph for this function:

◆ setForm()

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

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

References $form.

152  {
153  $this->form = $form;
154  }

◆ showOptions()

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

Called to display the mail options form.

Parameters
$form|null

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

References $form, and getForm().

Referenced by saveOptions().

194  {
195  if (null === $form) {
196  $form = $this->getForm();
197  $form->populate();
198  } else {
199  $form->setValuesByPost();
200  }
201 
202  $this->tpl->setContent($form->getHTML());
203  $this->tpl->show();
204  }
+ 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 20 of file class.ilMailOptionsGUI.php.

Referenced by __construct().

◆ $form

ilMailOptionsGUI::$form = null
protected

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

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

◆ $lng

ilMailOptionsGUI::$lng
private

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

Referenced by __construct().

◆ $mbox

ilMailOptionsGUI::$mbox
private

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

◆ $request

ilMailOptionsGUI::$request
protected

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

Referenced by __construct().

◆ $settings

ilMailOptionsGUI::$settings
private

Definition at line 30 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 40 of file class.ilMailOptionsGUI.php.

◆ $user

ilMailOptionsGUI::$user
private

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

Referenced by __construct().


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