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

References $gui, $ilCtrl, $lng, $objMailMemberRoles, $ref_id, $tpl, and ilAbstractMailMemberRoles\getMailRoles().

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
$ref_id
Definition: sahs_server.php:39
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilMailMemberSearchGUI::executeCommand ( )
Returns
bool

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

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

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':
70  $this->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':
82  $this->redirectToParentReferer();
83  break;
84 
85  default:
86  if(isset($_GET['returned_from_mail']) && $_GET['returned_from_mail'] == '1')
87  {
88  $this->redirectToParentReferer();
89  }
90  $this->showSearchForm();
91  break;
92  }
93  break;
94  }
95  return true;
96  }
$_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 187 of file class.ilMailMemberSearchGUI.php.

References ilMailFormCall\CONTEXT_KEY, and ilCourseMailTemplateTutorContext\ID.

Referenced by nextMailForm(), and sendMailToSelectedUsers().

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

◆ getMailRadioGroup()

ilMailMemberSearchGUI::getMailRadioGroup ( )
protected
Returns
ilRadioGroupInputGUI

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

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

Referenced by initMailToMembersForm().

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 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.
setValue($a_value)
Set Value.
+ 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.

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.

References ilSession\get().

Referenced by redirectToParentReferer().

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

References getMailRadioGroup().

Referenced by nextMailForm(), and showSearchForm().

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

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

Referenced by executeCommand().

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 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())
global $lng
Definition: privfeed.php:40
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 98 of file class.ilMailMemberSearchGUI.php.

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

Referenced by executeCommand().

99  {
100  $redirect_target = $this->getStoredReferer();
101  $this->unsetStoredReferer();
102  ilUtil::redirect($redirect_target);
103  }
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 223 of file class.ilMailMemberSearchGUI.php.

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

Referenced by executeCommand().

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 _lookupLogin($a_user_id)
lookup login
$_POST['username']
Definition: cron.php:12
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
+ 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.

References $objParticipants.

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

286  {
287  $this->objParticipants = $objParticipants;
288  }
+ Here is the caller graph for this function:

◆ showSearchForm()

ilMailMemberSearchGUI::showSearchForm ( )
protected

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

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

Referenced by executeCommand(), and nextMailForm().

264  {
265  global $tpl;
266 
267  $this->storeReferer();
268  $tpl->getStandardTemplate();
269 
270  $form = $this->initMailToMembersForm();
271  $tpl->setContent($form->getHTML());
272  }
global $tpl
Definition: ilias.php:8
+ 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.

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

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

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

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

Referenced by showSearchForm().

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

References ilSession\set().

Referenced by redirectToParentReferer().

127  {
128  ilSession::set('ilMailMemberSearchGUIReferer','');
129  }
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

◆ $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: