ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 }
$DIC
Definition: xapitoken.php:46

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 = [];
201
202 $type = ilObject::_lookupType($this->ref_id, true);
203 switch ($type) {
204 case 'crs':
205 if ($this->access->checkAccess('write', "", $this->ref_id)) {
206 $context_array = array(
208 'ref_id' => $this->ref_id,
209 'ts' => time()
210 );
211 }
212 break;
213
214 case 'sess':
215 if ($this->access->checkAccess('write', "", $this->ref_id)) {
216 $context_array = array(
218 'ref_id' => $this->ref_id,
219 'ts' => time()
220 );
221 }
222 break;
223 }
224 return $context_array;
225 }
const CONTEXT_KEY
Session parameter for the context.
static _lookupType($a_id, $a_reference=false)
lookup object type
$type

References $type, ilObject\_lookupType(), ilMailFormCall\CONTEXT_KEY, ilCourseMailTemplateTutorContext\ID, and ilSessionMailTemplateParticipantContext\ID.

+ Here is the call graph for this function:

◆ getMailRadioGroup()

ilMailMemberSearchGUI::getMailRadioGroup ( )
protected
Returns
ilRadioGroupInputGUI

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

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

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

References $mail_roles.

Referenced by getMailRadioGroup().

+ Here is the caller graph for this function:

◆ getObjParticipants()

ilMailMemberSearchGUI::getObjParticipants ( )
protected
Returns
null

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

313 {
314 $this->lng->loadLanguageModule('mail');
315
316 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
317 $form = new ilPropertyFormGUI();
318 $form->setTitle($this->lng->txt('mail_members'));
319
320 $form->setFormAction($this->ctrl->getFormAction($this, 'nextMailForm'));
321
322 $radio_grp = $this->getMailRadioGroup();
323
324 $form->addItem($radio_grp);
325 $form->addCommandButton('nextMailForm', $this->lng->txt('mail_members_search_continue'));
326 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
327
328 return $form;
329 }
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 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 (is_array($form->getInput('roles')) && 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, 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 246 of file class.ilMailMemberSearchGUI.php.

247 {
248 if (!isset($_POST['user_ids']) || !is_array($_POST['user_ids']) || 0 === count($_POST['user_ids'])) {
249 ilUtil::sendFailure($this->lng->txt("no_checkbox"));
250 $this->showSelectableUsers();
251 return false;
252 }
253
254 $rcps = array();
255 foreach ($_POST['user_ids'] as $usr_id) {
256 $rcps[] = ilObjUser::_lookupLogin($usr_id);
257 }
258
259 if (!count(array_filter($rcps))) {
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,
270 'members',
271 array(),
272 array(
273 'type' => 'new',
274 'sig' => $this->gui->createMailSignature()
275 ),
276 $this->generateContextArray()
277 ));
278
279 return true;
280 }
$_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 304 of file class.ilMailMemberSearchGUI.php.

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

References $objParticipants.

◆ showSearchForm()

ilMailMemberSearchGUI::showSearchForm ( )
protected

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

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

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

231 {
232 include_once './Services/Contact/classes/class.ilMailMemberSearchTableGUI.php';
233 include_once './Services/Contact/classes/class.ilMailMemberSearchDataProvider.php';
234
235 $this->tpl->loadStandardTemplate();
236 $tbl = new ilMailMemberSearchTableGUI($this, 'showSelectableUsers');
237 $provider = new ilMailMemberSearchDataProvider($this->getObjParticipants(), $this->ref_id);
238 $tbl->setData($provider->getData());
239
240 $this->tpl->setContent($tbl->getHTML());
241 }
Class ilMailMemberSearchDataProvider.

References 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: