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.

References $DIC, $gui, $objMailMemberRoles, $ref_id, and ilAbstractMailMemberRoles\getMailRoles().

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
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilMailMemberSearchGUI::executeCommand ( )
Returns
bool

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

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

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':
91  $this->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':
103  $this->redirectToParentReferer();
104  break;
105 
106  default:
107  if(isset($_GET['returned_from_mail']) && $_GET['returned_from_mail'] == '1')
108  {
109  $this->redirectToParentReferer();
110  }
111  $this->showSearchForm();
112  break;
113  }
114  break;
115  }
116  return true;
117  }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
+ Here is the call graph for this function:

◆ generateContextArray()

ilMailMemberSearchGUI::generateContextArray ( )
protected
Returns
array

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

References array, ilMailFormCall\CONTEXT_KEY, ilCourseMailTemplateTutorContext\ID, and time.

Referenced by nextMailForm(), and sendMailToSelectedUsers().

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  }
Create styles array
The data for the language used.
const CONTEXT_KEY
Session parameter for the context.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the caller graph for this function:

◆ getMailRadioGroup()

ilMailMemberSearchGUI::getMailRadioGroup ( )
protected
Returns
ilRadioGroupInputGUI

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

References $mail_roles, ilRadioOption\addSubItem(), and getMailRoles().

Referenced by initMailToMembersForm().

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 an option in a radio group.
This class represents a checkbox property in a property form.
This class represents a property in a property form.
addSubItem($a_item)
Add Subitem.
+ 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.

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.

References ilSession\get().

Referenced by redirectToParentReferer().

139  {
140  $stored_referer = ilSession::get('ilMailMemberSearchGUIReferer');
141  return (strlen($stored_referer) ? $stored_referer : false);
142  }
static get($a_var)
Get a value.
+ 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.

References getMailRadioGroup().

Referenced by nextMailForm(), and showSearchForm().

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.
+ 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.

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

Referenced by executeCommand().

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"]
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
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
+ 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.

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

Referenced by executeCommand().

120  {
121  $redirect_target = $this->getStoredReferer();
122  $this->unsetStoredReferer();
123  ilUtil::redirect($redirect_target);
124  }
static redirect($a_script)
http redirect to other script
+ 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.

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

Referenced by executeCommand().

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  }
static _lookupLogin($a_user_id)
lookup login
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getRedirectTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), array $context_params=array())
static setRecipients(array $recipients)
static redirect($a_script)
http redirect to other script
$_POST["username"]
+ 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.

References $objParticipants.

Referenced by ilObjGroupGUI\executeCommand(), and ilObjCourseGUI\executeCommand().

304  {
305  $this->objParticipants = $objParticipants;
306  }
+ Here is the caller graph for this function:

◆ showSearchForm()

ilMailMemberSearchGUI::showSearchForm ( )
protected

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

References initMailToMembersForm(), and storeReferer().

Referenced by executeCommand(), and nextMailForm().

285  {
286  $this->storeReferer();
287 
288  $form = $this->initMailToMembersForm();
289  $this->tpl->setContent($form->getHTML());
290  }
+ 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.

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

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

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  }
$tbl
Definition: example_048.php:81
Class ilMailMemberSearchDataProvider.
+ 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.

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

Referenced by showSearchForm().

130  {
131  $referer = ilSession::get('referer');
132  ilSession::set('ilMailMemberSearchGUIReferer', $referer);
133  }
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
+ 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.

References ilSession\set().

Referenced by redirectToParentReferer().

148  {
149  ilSession::set('ilMailMemberSearchGUIReferer','');
150  }
static set($a_var, $a_val)
Set a value.
+ 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: