ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 }
$ref_id
Definition: sahs_server.php:39
global $DIC

References $DIC, $gui, $objMailMemberRoles, and $ref_id.

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 {
87 default:
88 switch($cmd)
89 {
90 case 'sendMailToSelectedUsers':
92 break;
93
94 case 'showSelectableUsers':
95 $this->showSelectableUsers();
96 break;
97
98 case 'nextMailForm':
99 $this->nextMailForm();
100 break;
101
102 case 'cancel':
104 break;
105
106 default:
107 if(isset($_GET['returned_from_mail']) && $_GET['returned_from_mail'] == '1')
108 {
110 }
111 $this->showSearchForm();
112 break;
113 }
114 break;
115 }
116 return true;
117 }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35

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

+ Here is the call graph for this function:

◆ generateContextArray()

ilMailMemberSearchGUI::generateContextArray ( )
protected
Returns
array

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

209 {
210 $context_array = array();
211 require_once 'Modules/Course/classes/class.ilCourseMailTemplateTutorContext.php';
212 if($this->access->checkAccess('write',"",$this->ref_id) )
213 {
214 $context_array = array(
216 'ref_id' => $this->ref_id,
217 'ts' => time()
218 );
219 }
220
221 return $context_array;
222 }
const CONTEXT_KEY
Session parameter for the context.

References ilMailFormCall\CONTEXT_KEY, and ilCourseMailTemplateTutorContext\ID.

◆ getMailRadioGroup()

ilMailMemberSearchGUI::getMailRadioGroup ( )
protected
Returns
ilRadioGroupInputGUI

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

342 {
343 $mail_roles = $this->getMailRoles();
344
345 $radio_grp = new ilRadioGroupInputGUI('', 'mail_member_type');
346
347 $radio_sel_users = new ilRadioOption($this->lng->txt('mail_sel_users'), 'mail_sel_users');
348
349 $radio_roles = new ilRadioOption($this->objMailMemberRoles->getRadioOptionTitle(), 'mail_member_roles');
350 foreach($mail_roles as $role)
351 {
352 $chk_role = new ilCheckboxInputGUI($role['form_option_title'], 'roles[]');
353 $chk_role->setValue($role['role_id']);
354 $chk_role->setInfo($role['mailbox']);
355 $radio_roles->addSubItem($chk_role);
356 }
357
358 $radio_grp->setValue('mail_member_roles');
359
360 $radio_grp->addOption($radio_sel_users);
361 $radio_grp->addOption($radio_roles);
362
363 return $radio_grp;
364 }
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 333 of file class.ilMailMemberSearchGUI.php.

334 {
335 return $this->mail_roles;
336 }

References $mail_roles.

Referenced by getMailRadioGroup().

+ Here is the caller graph for this function:

◆ getObjParticipants()

ilMailMemberSearchGUI::getObjParticipants ( )
protected
Returns
null

Definition at line 295 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 138 of file class.ilMailMemberSearchGUI.php.

139 {
140 $stored_referer = ilSession::get('ilMailMemberSearchGUIReferer');
141 return (strlen($stored_referer) ? $stored_referer : false);
142 }
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 311 of file class.ilMailMemberSearchGUI.php.

312 {
313 $this->lng->loadLanguageModule('mail');
314
315 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
316 $form = new ilPropertyFormGUI();
317 $form->setTitle($this->lng->txt('mail_members'));
318
319 $form->setFormAction($this->ctrl->getFormAction($this, 'nextMailForm'));
320
321 $radio_grp = $this->getMailRadioGroup();
322
323 $form->addItem($radio_grp);
324 $form->addCommandButton('nextMailForm', $this->lng->txt('mail_members_search_continue'));
325 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
326
327 return $form;
328 }
This class represents a property form user interface.

References 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 155 of file class.ilMailMemberSearchGUI.php.

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

References $_SESSION, 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 119 of file class.ilMailMemberSearchGUI.php.

120 {
121 $redirect_target = $this->getStoredReferer();
122 $this->unsetStoredReferer();
123 ilUtil::redirect($redirect_target);
124 }

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 243 of file class.ilMailMemberSearchGUI.php.

244 {
245 if(!count($_POST['user_ids']))
246 {
247 ilUtil::sendFailure($this->lng->txt("no_checkbox"));
248 $this->showSelectableUsers();
249 return false;
250 }
251
252 $rcps = array();
253 foreach($_POST['user_ids'] as $usr_id)
254 {
255 $rcps[] = ilObjUser::_lookupLogin($usr_id);
256 }
257
258 if(!count(array_filter($rcps)))
259 {
260 ilUtil::sendFailure($this->lng->txt("no_checkbox"));
261 $this->showSelectableUsers();
262 return false;
263 }
264
265 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
267
269 $this, 'members',
270 array(),
271 array(
272 'type' => 'new',
273 'sig' => $this->gui->createMailSignature()
274 ),
275 $this->generateContextArray()
276 ));
277
278 return true;
279 }
$_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 303 of file class.ilMailMemberSearchGUI.php.

304 {
305 $this->objParticipants = $objParticipants;
306 }

References $objParticipants.

◆ showSearchForm()

ilMailMemberSearchGUI::showSearchForm ( )
protected

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

285 {
286 $this->storeReferer();
287
288 $form = $this->initMailToMembersForm();
289 $this->tpl->setContent($form->getHTML());
290 }

References 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 227 of file class.ilMailMemberSearchGUI.php.

228 {
229 include_once './Services/Contact/classes/class.ilMailMemberSearchTableGUI.php';
230 include_once './Services/Contact/classes/class.ilMailMemberSearchDataProvider.php';
231
232 $this->tpl->getStandardTemplate();
233 $tbl = new ilMailMemberSearchTableGUI($this, 'showSelectableUsers');
235 $tbl->setData($provider->getData());
236
237 $this->tpl->setContent($tbl->getHTML());
238 }
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 129 of file class.ilMailMemberSearchGUI.php.

130 {
131 $referer = ilSession::get('referer');
132 ilSession::set('ilMailMemberSearchGUIReferer', $referer);
133 }
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 147 of file class.ilMailMemberSearchGUI.php.

148 {
149 ilSession::set('ilMailMemberSearchGUIReferer','');
150 }

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: