ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
 

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

37 {
38 global $ilCtrl, $tpl, $lng;
39
40 $this->ctrl = $ilCtrl;
41 $this->tpl = $tpl;
42 $this->lng = $lng;
43
44 $this->lng->loadLanguageModule('mail');
45 $this->lng->loadLanguageModule('search');
46
47 $this->gui = $gui;
48 $this->ref_id = $ref_id;
49
50 $this->objMailMemberRoles = $objMailMemberRoles;
51 $this->mail_roles = $objMailMemberRoles->getMailRoles($ref_id);
52 }
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
$ref_id
Definition: sahs_server.php:39

References $gui, $ilCtrl, $lng, $objMailMemberRoles, $ref_id, and $tpl.

Member Function Documentation

◆ executeCommand()

ilMailMemberSearchGUI::executeCommand ( )
Returns
bool

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

58 {
59 $next_class = $this->ctrl->getNextClass($this);
60 $cmd = $this->ctrl->getCmd();
61
62 $this->ctrl->setReturn($this,'');
63
64 switch($next_class)
65 {
66 default:
67 switch($cmd)
68 {
69 case 'sendMailToSelectedUsers':
71 break;
72
73 case 'showSelectableUsers':
74 $this->showSelectableUsers();
75 break;
76
77 case 'nextMailForm':
78 $this->nextMailForm();
79 break;
80
81 case 'cancel':
83 break;
84
85 default:
86 if(isset($_GET['returned_from_mail']) && $_GET['returned_from_mail'] == '1')
87 {
89 }
90 $this->showSearchForm();
91 break;
92 }
93 break;
94 }
95 return true;
96 }
$_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 187 of file class.ilMailMemberSearchGUI.php.

188 {
189 global $ilAccess;
190
191 $context_array = array();
192 require_once 'Modules/Course/classes/class.ilCourseMailTemplateTutorContext.php';
193 if($ilAccess->checkAccess('write',"",$this->ref_id) )
194 {
196 'ref_id' => $this->ref_id,
197 'ts' => time());
198 }
199 return $context_array;
200 }
const CONTEXT_KEY
Session parameter for the context.

References ilMailFormCall\CONTEXT_KEY, and ilCourseMailTemplateTutorContext\ID.

◆ getMailRadioGroup()

ilMailMemberSearchGUI::getMailRadioGroup ( )
protected
Returns
ilRadioGroupInputGUI

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

324 {
325 $mail_roles = $this->getMailRoles();
326
327 $radio_grp = new ilRadioGroupInputGUI('', 'mail_member_type');
328 $radio_roles = new ilRadioOption($this->objMailMemberRoles->getRadioOptionTitle(), 'mail_member_roles');
329 foreach($mail_roles as $role)
330 {
331 $chk_role = new ilCheckboxInputGUI($role['form_option_title'], 'roles[]');
332 $chk_role->setValue($role['role_id']);
333 $chk_role->setInfo($role['mailbox']);
334 $radio_roles->addSubItem($chk_role);
335 }
336
337 $radio_sel_users = new ilRadioOption($this->lng->txt('mail_sel_users'), 'mail_sel_users');
338
339 $radio_grp->setValue('mail_member_roles');
340 $radio_grp->addOption($radio_roles);
341 $radio_grp->addOption($radio_sel_users);
342
343 return $radio_grp;
344 }
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 315 of file class.ilMailMemberSearchGUI.php.

316 {
317 return $this->mail_roles;
318 }

References $mail_roles.

Referenced by getMailRadioGroup().

+ Here is the caller graph for this function:

◆ getObjParticipants()

ilMailMemberSearchGUI::getObjParticipants ( )
protected
Returns
null

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

118 {
119 $stored_referer = ilSession::get('ilMailMemberSearchGUIReferer');
120 return (strlen($stored_referer) ? $stored_referer : false);
121 }
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 293 of file class.ilMailMemberSearchGUI.php.

294 {
295 $this->lng->loadLanguageModule('mail');
296
297 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
298 $form = new ilPropertyFormGUI();
299 $form->setTitle($this->lng->txt('mail_members'));
300
301 $form->setFormAction($this->ctrl->getFormAction($this, 'nextMailForm'));
302
303 $radio_grp = $this->getMailRadioGroup();
304
305 $form->addItem($radio_grp);
306 $form->addCommandButton('nextMailForm', $this->lng->txt('mail_members_search_continue'));
307 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
308
309 return $form;
310 }
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 134 of file class.ilMailMemberSearchGUI.php.

135 {
136 global $lng;
137
138 $form = $this->initMailToMembersForm();
139 if($form->checkInput())
140 {
141 if($form->getInput('mail_member_type') == 'mail_member_roles')
142 {
143 if(count($form->getInput('roles')) > 0)
144 {
145 $role_mail_boxes = array();
146 $roles = $form->getInput('roles');
147 foreach($roles as $role_id)
148 {
149 $mailbox = $this->objMailMemberRoles->getMailboxRoleAddress($role_id);
150 $role_mail_boxes[] = $mailbox;
151 }
152
153 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
154 $_SESSION['mail_roles'] = $role_mail_boxes;
155
157 $this, 'showSearchForm',
158 array('type' => 'role'),
159 array('type' => 'role',
160 'rcp_to' => implode(',', $role_mail_boxes),
161 'sig' => $this->gui->createMailSignature()),
162 $this->generateContextArray()
163 ));
164 }
165 else
166 {
167 $form->setValuesByPost();
168 ilUtil::sendFailure($lng->txt('no_checkbox'));
169 $this->showSearchForm();
170 return;
171 }
172 }
173 else
174 {
175 $this->showSelectableUsers();
176 return;
177 }
178 }
179
180 $form->setValuesByPost();
181 $this->showSearchForm();
182 }
$_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, $lng, 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 98 of file class.ilMailMemberSearchGUI.php.

99 {
100 $redirect_target = $this->getStoredReferer();
101 $this->unsetStoredReferer();
102 ilUtil::redirect($redirect_target);
103 }

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

224 {
225 if(!count($_POST['user_ids']))
226 {
227 ilUtil::sendFailure($this->lng->txt("no_checkbox"));
228 $this->showSelectableUsers();
229 return false;
230 }
231
232 $rcps = array();
233 foreach($_POST['user_ids'] as $usr_id)
234 {
235 $rcps[] = ilObjUser::_lookupLogin($usr_id);
236 }
237
238 if(!count(array_filter($rcps)))
239 {
240 ilUtil::sendFailure($this->lng->txt("no_checkbox"));
241 $this->showSelectableUsers();
242 return false;
243 }
244
245 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
247
249 $this, 'members',
250 array(),
251 array(
252 'type' => 'new',
253 'sig' => $this->gui->createMailSignature()
254 ),
255 $this->generateContextArray()
256 ));
257 return true;
258 }
static setRecipients(array $recipients)
static _lookupLogin($a_user_id)
lookup login
$_POST['username']
Definition: cron.php:12

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

286 {
287 $this->objParticipants = $objParticipants;
288 }

References $objParticipants.

◆ showSearchForm()

ilMailMemberSearchGUI::showSearchForm ( )
protected

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

264 {
265 global $tpl;
266
267 $this->storeReferer();
268 $tpl->getStandardTemplate();
269
270 $form = $this->initMailToMembersForm();
271 $tpl->setContent($form->getHTML());
272 }

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

206 {
207 global $tpl;
208
209 include_once './Services/Contact/classes/class.ilMailMemberSearchTableGUI.php';
210 include_once './Services/Contact/classes/class.ilMailMemberSearchDataProvider.php';
211
212 $tpl->getStandardTemplate();
213 $tbl = new ilMailMemberSearchTableGUI($this, 'showSelectableUsers');
215 $tbl->setData($provider->getData());
216
217 $tpl->setContent($tbl->getHTML());
218 }
Class ilMailMemberSearchDataProvider.
$tbl
Definition: example_048.php:81

References League\OAuth2\Client\Provider\$provider, $tbl, $tpl, 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 108 of file class.ilMailMemberSearchGUI.php.

109 {
110 $referer = ilSession::get('referer');
111 ilSession::set('ilMailMemberSearchGUIReferer', $referer);
112 }
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 126 of file class.ilMailMemberSearchGUI.php.

127 {
128 ilSession::set('ilMailMemberSearchGUIReferer','');
129 }

References ilSession\set().

Referenced by redirectToParentReferer().

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

Field Documentation

◆ $gui

ilMailMemberSearchGUI::$gui
protected

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

Referenced by __construct().

◆ $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().


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