ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMailOptionsGUI Class Reference
+ Collaboration diagram for ilMailOptionsGUI:

Public Member Functions

 __construct (ilGlobalPageTemplate $tpl=null, ilCtrl $ctrl=null, ilSetting $setting=null, ilLanguage $lng=null, ilObjUser $user=null, 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
 

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,
ilSetting  $setting = null,
ilLanguage  $lng = null,
ilObjUser  $user = null,
ServerRequestInterface  $request = null,
ilFormatMail  $mail = null,
ilMailbox  $malBox = null 
)

ilMailOptionsGUI constructor.

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

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

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

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

Member Function Documentation

◆ executeCommand()

ilMailOptionsGUI::executeCommand ( )

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

References settings().

108  : void
109  {
110  if (!$this->settings->get('show_mail_settings')) {
111  $referrer = $this->request->getQueryParams()['referrer'] ?? '';
112  if (strtolower('ilPersonalSettingsGUI') === strtolower($referrer)) {
113  $this->ctrl->redirectByClass('ilPersonalSettingsGUI');
114  return;
115  }
116  $this->ctrl->redirectByClass('ilMailGUI');
117  return;
118  }
119 
120  $nextClass = $this->ctrl->getNextClass($this);
121  switch ($nextClass) {
122  default:
123  if (!($cmd = $this->ctrl->getCmd())) {
124  $cmd = 'showOptions';
125  }
126 
127  $this->$cmd();
128  break;
129  }
130  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ getForm()

ilMailOptionsGUI::getForm ( )
protected
Returns
ilMailOptionsFormGUI

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

References $form, and user().

Referenced by saveOptions(), and showOptions().

144  {
145  if (null !== $this->form) {
146  return $this->form;
147  }
148 
149  return new ilMailOptionsFormGUI(
150  new ilMailOptions((int) $this->user->getId()),
151  $this,
152  'saveOptions'
153  );
154  }
Class ilMailOptions this class handles user mails.
user()
Definition: user.php:4
Class ilMailOptionsFormGUI.
+ 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 160 of file class.ilMailOptionsGUI.php.

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

160  : void
161  {
162  $this->tpl->setTitle($this->lng->txt('mail'));
163 
164  $form = $this->getForm();
165  if ($form->save()) {
166  ilUtil::sendSuccess($this->lng->txt('mail_options_saved'), true);
167  $this->ctrl->redirect($this, 'showOptions');
168  }
169 
170  $this->showOptions($form);
171  }
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 135 of file class.ilMailOptionsGUI.php.

References $form.

135  : void
136  {
137  $this->form = $form;
138  }

◆ showOptions()

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

Called to display the mail options form.

Parameters
$formilMailOptionsFormGUI|null

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

References $form, and getForm().

Referenced by saveOptions().

177  : void
178  {
179  if (null === $form) {
180  $form = $this->getForm();
181  $form->populate();
182  } else {
183  $form->setValuesByPost();
184  }
185 
186  $this->tpl->setContent($form->getHTML());
187  $this->tpl->printToStdout();
188  }
setValuesByPost()
Set form values from POST values.
+ 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().

◆ $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: