ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMailMemberSearchGUI Class Reference

Class ilMailMemberSearchGUI. More...

+ Collaboration diagram for ilMailMemberSearchGUI:

Public Member Functions

 __construct ($gui, $ref_id, ilAbstractMailMemberRoles $objMailMemberRoles)
 ilMailMemberSearchGUI constructor. More...
 
 executeCommand ()
 
 storeReferer ()
 
 setObjParticipants ($objParticipants)
 

Protected Member Functions

 nextMailForm ()
 
 generateContextArray ()
 
 showSelectableUsers ()
 
 sendMailToSelectedUsers ()
 
 showSearchForm ()
 
 getObjParticipants ()
 
 initMailToMembersForm ()
 
 getMailRadioGroup ()
 

Protected Attributes

 $mail_roles
 
 $gui
 
 $objMailMemberRoles
 
 $objParticipants = null
 
 $ctrl
 
 $tpl
 
 $lng
 
 $access
 

Private Member Functions

 redirectToParentReferer ()
 
 getStoredReferer ()
 
 unsetStoredReferer ()
 
 getMailRoles ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMailMemberSearchGUI::__construct (   $gui,
  $ref_id,
ilAbstractMailMemberRoles  $objMailMemberRoles 
)

ilMailMemberSearchGUI constructor.

Parameters
ilObjGroupGUI | ilObjCourseGUI$gui
$ref_id
ilAbstractMailMemberRoles$objMailMemberRoles

Definition at line 56 of file class.ilMailMemberSearchGUI.php.

57 {
58 global $DIC;
59
60 $this->ctrl = $DIC['ilCtrl'];
61 $this->tpl = $DIC['tpl'];
62 $this->lng = $DIC['lng'];
63 $this->access = $DIC['ilAccess'];
64
65 $this->lng->loadLanguageModule('mail');
66 $this->lng->loadLanguageModule('search');
67
68 $this->gui = $gui;
69 $this->ref_id = $ref_id;
70
71 $this->objMailMemberRoles = $objMailMemberRoles;
72 $this->mail_roles = $objMailMemberRoles->getMailRoles($ref_id);
73 }
global $DIC
Definition: saml.php:7

References $DIC, $gui, and $objMailMemberRoles.

Member Function Documentation

◆ executeCommand()

ilMailMemberSearchGUI::executeCommand ( )
Returns
bool

Definition at line 78 of file class.ilMailMemberSearchGUI.php.

79 {
80 $next_class = $this->ctrl->getNextClass($this);
81 $cmd = $this->ctrl->getCmd();
82
83 $this->ctrl->setReturn($this, '');
84
85 switch ($next_class) {
86 default:
87 switch ($cmd) {
88 case 'sendMailToSelectedUsers':
90 break;
91
92 case 'showSelectableUsers':
93 $this->showSelectableUsers();
94 break;
95
96 case 'nextMailForm':
97 $this->nextMailForm();
98 break;
99
100 case 'cancel':
102 break;
103
104 default:
105 if (isset($_GET['returned_from_mail']) && $_GET['returned_from_mail'] == '1') {
107 }
108 $this->showSearchForm();
109 break;
110 }
111 break;
112 }
113 return true;
114 }
$_GET["client_id"]

References $_GET, nextMailForm(), redirectToParentReferer(), sendMailToSelectedUsers(), showSearchForm(), and showSelectableUsers().

+ Here is the call graph for this function:

◆ generateContextArray()

ilMailMemberSearchGUI::generateContextArray ( )
protected
Returns
array

Definition at line 198 of file class.ilMailMemberSearchGUI.php.

199 {
200 $context_array = array();
201 require_once 'Modules/Course/classes/class.ilCourseMailTemplateTutorContext.php';
202 if ($this->access->checkAccess('write', "", $this->ref_id)) {
203 $context_array = array(
205 'ref_id' => $this->ref_id,
206 'ts' => time()
207 );
208 }
209
210 return $context_array;
211 }
const CONTEXT_KEY
Session parameter for the context.

References ilMailFormCall\CONTEXT_KEY, and ilCourseMailTemplateTutorContext\ID.

◆ getMailRadioGroup()

ilMailMemberSearchGUI::getMailRadioGroup ( )
protected
Returns
ilRadioGroupInputGUI

Definition at line 328 of file class.ilMailMemberSearchGUI.php.

329 {
330 $mail_roles = $this->getMailRoles();
331
332 $radio_grp = new ilRadioGroupInputGUI('', 'mail_member_type');
333
334 $radio_sel_users = new ilRadioOption($this->lng->txt('mail_sel_users'), 'mail_sel_users');
335
336 $radio_roles = new ilRadioOption($this->objMailMemberRoles->getRadioOptionTitle(), 'mail_member_roles');
337 foreach ($mail_roles as $role) {
338 $chk_role = new ilCheckboxInputGUI($role['form_option_title'], 'roles[]');
339 $chk_role->setValue($role['role_id']);
340 $chk_role->setInfo($role['mailbox']);
341 $radio_roles->addSubItem($chk_role);
342 }
343
344 $radio_grp->setValue('mail_member_roles');
345
346 $radio_grp->addOption($radio_sel_users);
347 $radio_grp->addOption($radio_roles);
348
349 return $radio_grp;
350 }
This class represents a checkbox property in a property form.
This class represents a property in a property form.
This class represents an option in a radio group.

References $mail_roles, and getMailRoles().

Referenced by initMailToMembersForm().

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

◆ getMailRoles()

ilMailMemberSearchGUI::getMailRoles ( )
private
Returns
mixed

Definition at line 320 of file class.ilMailMemberSearchGUI.php.

321 {
322 return $this->mail_roles;
323 }

References $mail_roles.

Referenced by getMailRadioGroup().

+ Here is the caller graph for this function:

◆ getObjParticipants()

ilMailMemberSearchGUI::getObjParticipants ( )
protected
Returns
null

Definition at line 282 of file class.ilMailMemberSearchGUI.php.

References $objParticipants.

Referenced by showSelectableUsers().

+ Here is the caller graph for this function:

◆ getStoredReferer()

ilMailMemberSearchGUI::getStoredReferer ( )
private
Returns
bool || redirect target

Definition at line 135 of file class.ilMailMemberSearchGUI.php.

136 {
137 $stored_referer = ilSession::get('ilMailMemberSearchGUIReferer');
138 return (strlen($stored_referer) ? $stored_referer : false);
139 }
static get($a_var)
Get a value.

References ilSession\get().

Referenced by redirectToParentReferer().

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

◆ initMailToMembersForm()

ilMailMemberSearchGUI::initMailToMembersForm ( )
protected
Returns
ilPropertyFormGUI

Definition at line 298 of file class.ilMailMemberSearchGUI.php.

299 {
300 $this->lng->loadLanguageModule('mail');
301
302 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
303 $form = new ilPropertyFormGUI();
304 $form->setTitle($this->lng->txt('mail_members'));
305
306 $form->setFormAction($this->ctrl->getFormAction($this, 'nextMailForm'));
307
308 $radio_grp = $this->getMailRadioGroup();
309
310 $form->addItem($radio_grp);
311 $form->addCommandButton('nextMailForm', $this->lng->txt('mail_members_search_continue'));
312 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
313
314 return $form;
315 }
This class represents a property form user interface.
if(isset($_POST['submit'])) $form

References $form, and getMailRadioGroup().

Referenced by nextMailForm(), and showSearchForm().

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

◆ nextMailForm()

ilMailMemberSearchGUI::nextMailForm ( )
protected

Definition at line 152 of file class.ilMailMemberSearchGUI.php.

153 {
154 $form = $this->initMailToMembersForm();
155 if ($form->checkInput()) {
156 if ($form->getInput('mail_member_type') == 'mail_member_roles') {
157 if (count($form->getInput('roles')) > 0) {
158 $role_mail_boxes = array();
159 $roles = $form->getInput('roles');
160 foreach ($roles as $role_id) {
161 $mailbox = $this->objMailMemberRoles->getMailboxRoleAddress($role_id);
162 $role_mail_boxes[] = $mailbox;
163 }
164
165 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
166 $_SESSION['mail_roles'] = $role_mail_boxes;
167
169 $this,
170 'showSearchForm',
171 array('type' => 'role'),
172 array(
173 'type' => 'role',
174 'rcp_to' => implode(',', $role_mail_boxes),
175 'sig' => $this->gui->createMailSignature()
176 ),
177 $this->generateContextArray()
178 ));
179 } else {
180 $form->setValuesByPost();
181 ilUtil::sendFailure($this->lng->txt('no_checkbox'));
182 $this->showSearchForm();
183 return;
184 }
185 } else {
186 $this->showSelectableUsers();
187 return;
188 }
189 }
190
191 $form->setValuesByPost();
192 $this->showSearchForm();
193 }
$_SESSION["AccountId"]
static getRedirectTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), array $context_params=array())
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $_SESSION, $form, ilMailFormCall\getRedirectTarget(), initMailToMembersForm(), ilUtil\redirect(), ilUtil\sendFailure(), showSearchForm(), and showSelectableUsers().

Referenced by executeCommand().

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

◆ redirectToParentReferer()

ilMailMemberSearchGUI::redirectToParentReferer ( )
private

Definition at line 116 of file class.ilMailMemberSearchGUI.php.

117 {
118 $redirect_target = $this->getStoredReferer();
119 $this->unsetStoredReferer();
120 ilUtil::redirect($redirect_target);
121 }

References getStoredReferer(), ilUtil\redirect(), and unsetStoredReferer().

Referenced by executeCommand().

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

◆ sendMailToSelectedUsers()

ilMailMemberSearchGUI::sendMailToSelectedUsers ( )
protected
Returns
bool

Definition at line 232 of file class.ilMailMemberSearchGUI.php.

233 {
234 if (!count($_POST['user_ids'])) {
235 ilUtil::sendFailure($this->lng->txt("no_checkbox"));
236 $this->showSelectableUsers();
237 return false;
238 }
239
240 $rcps = array();
241 foreach ($_POST['user_ids'] as $usr_id) {
242 $rcps[] = ilObjUser::_lookupLogin($usr_id);
243 }
244
245 if (!count(array_filter($rcps))) {
246 ilUtil::sendFailure($this->lng->txt("no_checkbox"));
247 $this->showSelectableUsers();
248 return false;
249 }
250
251 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
253
255 $this,
256 'members',
257 array(),
258 array(
259 'type' => 'new',
260 'sig' => $this->gui->createMailSignature()
261 ),
262 $this->generateContextArray()
263 ));
264
265 return true;
266 }
$_POST["username"]
static setRecipients(array $recipients)
static _lookupLogin($a_user_id)
lookup login

References $_POST, ilObjUser\_lookupLogin(), ilMailFormCall\getRedirectTarget(), ilUtil\redirect(), ilUtil\sendFailure(), ilMailFormCall\setRecipients(), and showSelectableUsers().

Referenced by executeCommand().

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

◆ setObjParticipants()

ilMailMemberSearchGUI::setObjParticipants (   $objParticipants)
Parameters
null$objParticipantsilCourseParticipants || ilGroupParticipants

Definition at line 290 of file class.ilMailMemberSearchGUI.php.

291 {
292 $this->objParticipants = $objParticipants;
293 }

References $objParticipants.

◆ showSearchForm()

ilMailMemberSearchGUI::showSearchForm ( )
protected

Definition at line 271 of file class.ilMailMemberSearchGUI.php.

272 {
273 $this->storeReferer();
274
275 $form = $this->initMailToMembersForm();
276 $this->tpl->setContent($form->getHTML());
277 }

References $form, initMailToMembersForm(), and storeReferer().

Referenced by executeCommand(), and nextMailForm().

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

◆ showSelectableUsers()

ilMailMemberSearchGUI::showSelectableUsers ( )
protected

Definition at line 216 of file class.ilMailMemberSearchGUI.php.

217 {
218 include_once './Services/Contact/classes/class.ilMailMemberSearchTableGUI.php';
219 include_once './Services/Contact/classes/class.ilMailMemberSearchDataProvider.php';
220
221 $this->tpl->getStandardTemplate();
222 $tbl = new ilMailMemberSearchTableGUI($this);
224 $tbl->setData($provider->getData());
225
226 $this->tpl->setContent($tbl->getHTML());
227 }
Class ilMailMemberSearchDataProvider.
$tbl
Definition: example_048.php:81

References League\OAuth2\Client\Provider\$provider, $tbl, and getObjParticipants().

Referenced by executeCommand(), nextMailForm(), and sendMailToSelectedUsers().

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

◆ storeReferer()

ilMailMemberSearchGUI::storeReferer ( )

Definition at line 126 of file class.ilMailMemberSearchGUI.php.

127 {
128 $referer = ilSession::get('referer');
129 ilSession::set('ilMailMemberSearchGUIReferer', $referer);
130 }
static set($a_var, $a_val)
Set a value.

References ilSession\get(), and ilSession\set().

Referenced by showSearchForm().

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

◆ unsetStoredReferer()

ilMailMemberSearchGUI::unsetStoredReferer ( )
private

Definition at line 144 of file class.ilMailMemberSearchGUI.php.

145 {
146 ilSession::set('ilMailMemberSearchGUIReferer', '');
147 }

References ilSession\set().

Referenced by redirectToParentReferer().

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

Field Documentation

◆ $access

ilMailMemberSearchGUI::$access
protected

Definition at line 48 of file class.ilMailMemberSearchGUI.php.

◆ $ctrl

ilMailMemberSearchGUI::$ctrl
protected

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

◆ $gui

ilMailMemberSearchGUI::$gui
protected

Definition at line 19 of file class.ilMailMemberSearchGUI.php.

Referenced by __construct().

◆ $lng

ilMailMemberSearchGUI::$lng
protected

Definition at line 43 of file class.ilMailMemberSearchGUI.php.

◆ $mail_roles

ilMailMemberSearchGUI::$mail_roles
protected

Definition at line 14 of file class.ilMailMemberSearchGUI.php.

Referenced by getMailRadioGroup(), and getMailRoles().

◆ $objMailMemberRoles

ilMailMemberSearchGUI::$objMailMemberRoles
protected

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

Referenced by __construct().

◆ $objParticipants

ilMailMemberSearchGUI::$objParticipants = null
protected

Definition at line 28 of file class.ilMailMemberSearchGUI.php.

Referenced by getObjParticipants(), and setObjParticipants().

◆ $tpl

ilMailMemberSearchGUI::$tpl
protected

Definition at line 38 of file class.ilMailMemberSearchGUI.php.


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