ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 (ilParticipants $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, 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  }
global $DIC
Definition: goto.php:24
+ 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, nextMailForm(), redirectToParentReferer(), sendMailToSelectedUsers(), showSearchForm(), and showSelectableUsers().

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

◆ generateContextArray()

ilMailMemberSearchGUI::generateContextArray ( )
protected
Returns
array

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

References $type, ilContainer\_lookupContainerSetting(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilMailFormCall\CONTEXT_KEY, ilObjectServiceSettingsGUI\EXTERNAL_MAIL_PREFIX, ilCourseMailTemplateTutorContext\ID, ilSessionMailTemplateParticipantContext\ID, and ilMail\PROP_CONTEXT_SUBJECT_PREFIX.

Referenced by nextMailForm(), and sendMailToSelectedUsers().

189  : array
190  {
191  $contextParameters = [];
192 
193  $type = ilObject::_lookupType($this->ref_id, true);
194  switch ($type) {
195  case 'grp':
196  case 'crs':
197  if ($this->access->checkAccess('write', '', $this->ref_id)) {
198  $contextParameters = [
199  'ref_id' => $this->ref_id,
200  'ts' => time(),
202  ilObject::_lookupObjId($this->ref_id),
204  ''
205  )
206  ];
207 
208  if ('crs' === $type) {
210  }
211  }
212  break;
213 
214  case 'sess':
215  if ($this->access->checkAccess('write', '', $this->ref_id)) {
216  $contextParameters = [
218  'ref_id' => $this->ref_id,
219  'ts' => time()
220  ];
221  }
222  break;
223  }
224 
225  return $contextParameters;
226  }
$type
const PROP_CONTEXT_SUBJECT_PREFIX
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
const CONTEXT_KEY
Session parameter for the context.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMailRadioGroup()

ilMailMemberSearchGUI::getMailRadioGroup ( )
protected
Returns
ilRadioGroupInputGUI

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

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

Referenced by initMailToMembersForm().

333  {
334  $mail_roles = $this->getMailRoles();
335 
336  $radio_grp = new ilRadioGroupInputGUI($this->lng->txt('mail_sel_label'), 'mail_member_type');
337 
338  $radio_sel_users = new ilRadioOption($this->lng->txt('mail_sel_users'), 'mail_sel_users');
339 
340  $radio_roles = new ilRadioOption($this->objMailMemberRoles->getRadioOptionTitle(), 'mail_member_roles');
341  foreach ($mail_roles as $role) {
342  $chk_role = new ilCheckboxInputGUI($role['form_option_title'], 'roles[]');
343 
344  if (array_key_exists('default_checked', $role) && $role['default_checked']) {
345  $chk_role->setChecked(true);
346  }
347  $chk_role->setValue($role['role_id']);
348  $chk_role->setInfo($role['mailbox']);
349  $radio_roles->addSubItem($chk_role);
350  }
351 
352  $radio_grp->setValue('mail_member_roles');
353 
354  $radio_grp->addOption($radio_sel_users);
355  $radio_grp->addOption($radio_roles);
356 
357  return $radio_grp;
358  }
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 324 of file class.ilMailMemberSearchGUI.php.

References $mail_roles.

Referenced by getMailRadioGroup().

+ Here is the caller graph for this function:

◆ getObjParticipants()

ilMailMemberSearchGUI::getObjParticipants ( )
protected
Returns
ilParticipants

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

References $objParticipants.

Referenced by showSelectableUsers().

+ Here is the caller graph for this function:

◆ getStoredReferer()

ilMailMemberSearchGUI::getStoredReferer ( )
private
Returns
string

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

References ilSession\get().

Referenced by redirectToParentReferer().

134  : string
135  {
136  return (string) ilSession::get('ilMailMemberSearchGUIReferer');
137  }
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 303 of file class.ilMailMemberSearchGUI.php.

References getMailRadioGroup().

Referenced by nextMailForm(), and showSearchForm().

304  {
305  $this->lng->loadLanguageModule('mail');
306 
307  $form = new ilPropertyFormGUI();
308  $form->setTitle($this->lng->txt('mail_members'));
309 
310  $form->setFormAction($this->ctrl->getFormAction($this, 'nextMailForm'));
311 
312  $radio_grp = $this->getMailRadioGroup();
313 
314  $form->addItem($radio_grp);
315  $form->addCommandButton('nextMailForm', $this->lng->txt('mail_members_search_continue'));
316  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
317 
318  return $form;
319  }
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 144 of file class.ilMailMemberSearchGUI.php.

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

Referenced by executeCommand().

144  : void
145  {
146  $form = $this->initMailToMembersForm();
147  if ($form->checkInput()) {
148  if ($form->getInput('mail_member_type') === 'mail_member_roles') {
149  if (is_array($form->getInput('roles')) && count($form->getInput('roles')) > 0) {
150  $role_mail_boxes = [];
151  $roles = $form->getInput('roles');
152  foreach ($roles as $role_id) {
153  $mailbox = $this->objMailMemberRoles->getMailboxRoleAddress($role_id);
154  $role_mail_boxes[] = $mailbox;
155  }
156 
157  $_SESSION['mail_roles'] = $role_mail_boxes;
158 
159  $this->ctrl->redirectToURL(ilMailFormCall::getRedirectTarget(
160  $this,
161  'showSearchForm',
162  ['type' => 'role'],
163  [
164  'type' => 'role',
165  'rcp_to' => implode(',', $role_mail_boxes),
166  'sig' => $this->gui->createMailSignature()
167  ],
168  $this->generateContextArray()
169  ));
170  } else {
171  $form->setValuesByPost();
172  ilUtil::sendFailure($this->lng->txt('no_checkbox'));
173  $this->showSearchForm();
174  return;
175  }
176  } else {
177  $this->showSelectableUsers();
178  return;
179  }
180  }
181 
182  $form->setValuesByPost();
183  $this->showSearchForm();
184  }
$_SESSION["AccountId"]
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getRedirectTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectToParentReferer()

ilMailMemberSearchGUI::redirectToParentReferer ( )
private

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

References $url, getStoredReferer(), and unsetStoredReferer().

Referenced by executeCommand().

118  : void
119  {
120  $url = $this->getStoredReferer();
121  $this->unsetStoredReferer();
122  $this->ctrl->redirectToURL($url);
123  }
$url
+ 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 241 of file class.ilMailMemberSearchGUI.php.

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

Referenced by executeCommand().

241  : bool
242  {
243  if (!isset($_POST['user_ids']) || !is_array($_POST['user_ids']) || 0 === count($_POST['user_ids'])) {
244  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
245  $this->showSelectableUsers();
246  return false;
247  }
248 
249  $rcps = [];
250  foreach ($_POST['user_ids'] as $usr_id) {
251  $rcps[] = ilObjUser::_lookupLogin($usr_id);
252  }
253 
254  if (!count(array_filter($rcps))) {
255  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
256  $this->showSelectableUsers();
257  return false;
258  }
259 
261 
262  $this->ctrl->redirectToURL(ilMailFormCall::getRedirectTarget(
263  $this,
264  'members',
265  [],
266  [
267  'type' => 'new',
268  'sig' => $this->gui->createMailSignature(),
269  ],
270  $this->generateContextArray()
271  ));
272 
273  return true;
274  }
static _lookupLogin($a_user_id)
lookup login
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static setRecipients(array $recipients, string $type='to')
static getRedirectTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setObjParticipants()

ilMailMemberSearchGUI::setObjParticipants ( ilParticipants  $objParticipants)
Parameters
$objParticipantsilParticipants

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

References $objParticipants.

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

295  : void
296  {
297  $this->objParticipants = $objParticipants;
298  }
+ Here is the caller graph for this function:

◆ showSearchForm()

ilMailMemberSearchGUI::showSearchForm ( )
protected

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

References initMailToMembersForm(), and storeReferer().

Referenced by executeCommand(), and nextMailForm().

276  : void
277  {
278  $this->storeReferer();
279 
280  $form = $this->initMailToMembersForm();
281  $this->tpl->setContent($form->getHTML());
282  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSelectableUsers()

ilMailMemberSearchGUI::showSelectableUsers ( )
protected

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

References getObjParticipants().

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

228  : void
229  {
230  $this->tpl->loadStandardTemplate();
231  $tbl = new ilMailMemberSearchTableGUI($this, 'showSelectableUsers');
232  $provider = new ilMailMemberSearchDataProvider($this->getObjParticipants(), $this->ref_id);
233  $tbl->setData($provider->getData());
234 
235  $this->tpl->setContent($tbl->getHTML());
236  }
Class ilMailMemberSearchDataProvider.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ storeReferer()

ilMailMemberSearchGUI::storeReferer ( )

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

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

Referenced by showSearchForm().

125  : void
126  {
127  $referer = ilSession::get('referer');
128  ilSession::set('ilMailMemberSearchGUIReferer', $referer);
129  }
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 139 of file class.ilMailMemberSearchGUI.php.

References ilSession\set().

Referenced by redirectToParentReferer().

139  : void
140  {
141  ilSession::set('ilMailMemberSearchGUIReferer', '');
142  }
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: