ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMailingListsGUI Class Reference
+ Collaboration diagram for ilMailingListsGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 confirmDelete ()
 
 performDelete ()
 
 mailToList ()
 
 showMailingLists ()
 
 cancel ()
 Cancel action. More...
 
 saveForm ()
 
 showForm ()
 
 showMembersList ()
 
 confirmDeleteMembers ()
 
 performDeleteMembers ()
 
 saveAssignmentForm ()
 
 showAssignmentForm (ilPropertyFormGUI $form=null)
 

Protected Attributes

 $tpl = null
 
 $ctrl = null
 
 $lng = null
 
 $user
 
 $error
 
 $toolbar
 
 $tabs
 
 $rbacsystem
 

Private Member Functions

 initForm ($a_type='create')
 
 setValuesByObject ()
 
 setDefaultValues ()
 

Private Attributes

 $umail = null
 
 $mlists = null
 
 $form_gui = null
 

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 15 of file class.ilMailingListsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailingListsGUI::__construct ( )

Definition at line 61 of file class.ilMailingListsGUI.php.

References $_GET, $DIC, and user().

62  {
63  global $DIC;
64 
65  $this->tpl = $DIC['tpl'];
66  $this->ctrl = $DIC['ilCtrl'];
67  $this->lng = $DIC['lng'];
68  $this->rbacsystem = $DIC['rbacsystem'];
69  $this->user = $DIC['ilUser'];
70  $this->error = $DIC['ilErr'];
71  $this->toolbar = $DIC['ilToolbar'];
72  $this->tabs = $DIC['ilTabs'];
73 
74  $this->umail = new ilFormatMail($this->user->getId());
75  $this->mlists = new ilMailingLists($this->user);
76  $this->mlists->setCurrentMailingList($_GET['ml_id']);
77 
78  $this->ctrl->saveParameter($this, 'mobj_id');
79  $this->ctrl->saveParameter($this, 'ref');
80  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
user()
Definition: user.php:4
Class UserMail this class handles user mails.
+ Here is the call graph for this function:

Member Function Documentation

◆ cancel()

ilMailingListsGUI::cancel ( )

Cancel action.

Definition at line 290 of file class.ilMailingListsGUI.php.

References $_GET, and showMailingLists().

291  {
292  if (isset($_GET['ref']) && $_GET['ref'] == 'mail') {
293  $this->ctrl->returnToParent($this);
294  } else {
295  $this->showMailingLists();
296  }
297  }
$_GET["client_id"]
+ Here is the call graph for this function:

◆ confirmDelete()

ilMailingListsGUI::confirmDelete ( )

Definition at line 105 of file class.ilMailingListsGUI.php.

References $_GET, $_POST, array, ilUtil\sendInfo(), and showMailingLists().

106  {
107  $ml_ids = ((int) $_GET['ml_id']) ? array($_GET['ml_id']) : $_POST['ml_id'];
108  if (!$ml_ids) {
109  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
110  $this->showMailingLists();
111  return true;
112  }
113 
114  include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
115  $c_gui = new ilConfirmationGUI();
116 
117  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDelete'));
118  $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
119  $c_gui->setCancel($this->lng->txt('cancel'), 'showMailingLists');
120  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDelete');
121 
122  $entries = $this->mlists->getSelected($ml_ids);
123  foreach ($entries as $entry) {
124  $c_gui->addItem('ml_id[]', $entry->getId(), $entry->getTitle());
125  }
126 
127  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
128  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_list.html', 'Services/Contact');
129  $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
130 
131  $this->tpl->show();
132 
133  return true;
134  }
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Create styles array
The data for the language used.
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmDeleteMembers()

ilMailingListsGUI::confirmDeleteMembers ( )

Definition at line 458 of file class.ilMailingListsGUI.php.

References $_POST, $names, array, ilUserUtil\getNamePresentation(), ilUtil\sendInfo(), and showMembersList().

459  {
460  if (!isset($_POST['a_id'])) {
461  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
462  $this->showMembersList();
463  return true;
464  }
465 
466  include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
467  $c_gui = new ilConfirmationGUI();
468  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
469  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteMembers'));
470  $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
471  $c_gui->setCancel($this->lng->txt('cancel'), 'showMembersList');
472  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteMembers');
473 
474  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
475 
476  $usr_ids = array();
477  foreach ($assigned_entries as $entry) {
478  $usr_ids[] = $entry['usr_id'];
479  }
480 
481  require_once 'Services/User/classes/class.ilUserUtil.php';
482  $names = ilUserUtil::getNamePresentation($usr_ids, false, false, '', false, false, false);
483 
484  foreach ($assigned_entries as $entry) {
485  if (in_array($entry['a_id'], $_POST['a_id'])) {
486  $c_gui->addItem('a_id[]', $entry['a_id'], $names[$entry['usr_id']]);
487  }
488  }
489 
490  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
491  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members.html', 'Services/Contact');
492  $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
493 
494  $this->tpl->show();
495  return true;
496  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
Create styles array
The data for the language used.
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ executeCommand()

ilMailingListsGUI::executeCommand ( )

Definition at line 82 of file class.ilMailingListsGUI.php.

References ilBuddySystem\getInstance(), and ilBuddyList\getInstanceByGlobalUser().

83  {
84  require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
85  if (
86  !ilBuddySystem::getInstance()->isEnabled() ||
87  0 === count(ilBuddyList::getInstanceByGlobalUser()->getLinkedRelations())
88  ) {
89  $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
90  }
91 
92  $forward_class = $this->ctrl->getNextClass($this);
93  switch ($forward_class) {
94  default:
95  if (!($cmd = $this->ctrl->getCmd())) {
96  $cmd = 'showMailingLists';
97  }
98 
99  $this->$cmd();
100  break;
101  }
102  return true;
103  }
static getInstanceByGlobalUser()
+ Here is the call graph for this function:

◆ initForm()

ilMailingListsGUI::initForm (   $a_type = 'create')
private

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

References ilTextAreaInputGUI\setCols(), and ilFormPropertyGUI\setRequired().

Referenced by saveForm(), and showForm().

342  {
343  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
344  $this->form_gui = new ilPropertyFormGUI();
345 
346  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
347  $this->form_gui->setTitle($this->lng->txt('mail_mailing_list'));
348 
349  $titleGui = new ilTextInputGUI($this->lng->txt('title'), 'title');
350  $titleGui->setRequired(true);
351  $this->form_gui->addItem($titleGui);
352 
353  $descriptionGui = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
354  $descriptionGui->setCols(40);
355  $descriptionGui->setRows(8);
356  $this->form_gui->addItem($descriptionGui);
357 
358  $this->form_gui->addCommandButton('saveForm', $this->lng->txt('save'));
359  $this->form_gui->addCommandButton('showMailingLists', $this->lng->txt('cancel'));
360  }
This class represents a property form user interface.
This class represents a text property in a property form.
This class represents a text area property in a property form.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mailToList()

ilMailingListsGUI::mailToList ( )

Definition at line 159 of file class.ilMailingListsGUI.php.

References $_GET, $_POST, $id, array, ilUtil\redirect(), ilUtil\sendFailure(), ilUtil\sendInfo(), showMailingLists(), and user().

160  {
161  // check if current user may send mails
162  include_once "Services/Mail/classes/class.ilMail.php";
163  $mail = new ilMail($this->user->getId());
164  $mailing_allowed = $this->rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
165 
166  if (!$mailing_allowed) {
167  ilUtil::sendFailure($this->lng->txt('no_permission'));
168  return true;
169  }
170 
171  $ml_ids = ((int) $_GET['ml_id']) ? array($_GET['ml_id']) : $_POST['ml_id'];
172  if (!$ml_ids) {
173  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
174  $this->showMailingLists();
175  return true;
176  }
177 
178  $mail_data = $this->umail->getSavedData();
179  if (!is_array($mail_data)) {
180  $this->umail->savePostData($this->user->getId(), array(), '', '', '', '', '', '', '', '');
181  }
182 
183  $lists = array();
184  foreach ($ml_ids as $id) {
185  if (ilMailingList::_isOwner($id, $this->user->getId()) &&
186  !$this->umail->existsRecipient('#il_ml_' . $id, $mail_data['rcp_to'])) {
187  $lists[] = '#il_ml_' . $id;
188  }
189  }
190 
191  if (count($lists)) {
192  $mail_data = $this->umail->appendSearchResult($lists, 'to');
193  $this->umail->savePostData(
194  $mail_data['user_id'],
195  $mail_data['attachments'],
196  $mail_data['rcp_to'],
197  $mail_data['rcp_cc'],
198  $mail_data['rcp_bcc'],
199  $mail_data['m_type'],
200  $mail_data['m_email'],
201  $mail_data['m_subject'],
202  $mail_data['m_message'],
203  $mail_data['use_placeholders'],
204  $mail_data['tpl_ctx_id'],
205  $mail_data['tpl_ctx_params']
206  );
207  }
208 
209  ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
210 
211  return true;
212  }
$_GET["client_id"]
if(!array_key_exists('StateId', $_REQUEST)) $id
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
This class handles base functions for mail handling.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static redirect($a_script)
$_POST["username"]
+ Here is the call graph for this function:

◆ performDelete()

ilMailingListsGUI::performDelete ( )

Definition at line 136 of file class.ilMailingListsGUI.php.

References $_POST, $counter, $id, ilUtil\sendInfo(), showMailingLists(), ilUtil\stripSlashes(), and user().

137  {
138  if (is_array($_POST['ml_id'])) {
139  $counter = 0;
140  foreach ($_POST['ml_id'] as $id) {
141  if (ilMailingList::_isOwner($id, $this->user->getId())) {
142  $this->mlists->get(ilUtil::stripSlashes($id))->delete();
143  ++$counter;
144  }
145  }
146 
147  if ($counter) {
148  ilUtil::sendInfo($this->lng->txt('mail_deleted_entry'));
149  }
150  } else {
151  ilUtil::sendInfo($this->lng->txt('mail_delete_error'));
152  }
153 
154  $this->showMailingLists();
155 
156  return true;
157  }
if(!array_key_exists('StateId', $_REQUEST)) $id
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$counter
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
+ Here is the call graph for this function:

◆ performDeleteMembers()

ilMailingListsGUI::performDeleteMembers ( )

Definition at line 498 of file class.ilMailingListsGUI.php.

References $_POST, $form, $id, $names, $options, array, ilBuddyList\getInstanceByGlobalUser(), ilUserUtil\getNamePresentation(), ilUtil\sendInfo(), ilFormPropertyGUI\setRequired(), showMembersList(), and user().

499  {
500  if (!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
501  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
502  }
503 
504  if (is_array($_POST['a_id'])) {
505  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
506  foreach ($_POST['a_id'] as $id) {
507  if (isset($assigned_entries[$id])) {
508  $this->mlists->getCurrentMailingList()->deleteEntry((int) $id);
509  }
510  }
511  ilUtil::sendInfo($this->lng->txt('mail_deleted_entry'));
512  } else {
513  ilUtil::sendInfo($this->lng->txt('mail_delete_error'));
514  }
515 
516  $this->showMembersList();
517 
518  return true;
519  }
if(!array_key_exists('StateId', $_REQUEST)) $id
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ saveAssignmentForm()

ilMailingListsGUI::saveAssignmentForm ( )
Returns
bool

Definition at line 575 of file class.ilMailingListsGUI.php.

References $_POST, $form, ilBuddyList\getInstanceByGlobalUser(), ilUtil\sendInfo(), showAssignmentForm(), showMembersList(), and user().

576  {
577  if (!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
578  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
579  }
580 
581  $form = $this->getAssignmentForm();
582  if (!$form->checkInput()) {
583  $form->setValuesByPost();
584  $this->showAssignmentForm($form);
585  return true;
586  }
587 
588  require_once 'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
589  if (ilBuddyList::getInstanceByGlobalUser()->getRelationByUserId((int) $_POST['usr_id'])->isLinked()) {
590  $this->mlists->getCurrentMailingList()->assignUser((int) $_POST['usr_id']);
591  ilUtil::sendInfo($this->lng->txt('saved_successfully'));
592  $this->showMembersList();
593  return true;
594  }
595 
596  $this->showAssignmentForm($form);
597  return true;
598  }
static getInstanceByGlobalUser()
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(isset($_POST['submit'])) $form
showAssignmentForm(ilPropertyFormGUI $form=null)
$_POST["username"]
+ Here is the call graph for this function:

◆ saveForm()

ilMailingListsGUI::saveForm ( )

Definition at line 299 of file class.ilMailingListsGUI.php.

References $_POST, date, exit, initForm(), ilUtil\sendSuccess(), time, and user().

300  {
301  if ($this->mlists->getCurrentMailingList()->getId()) {
302  if (!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
303  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
304  }
305 
306  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
307  $this->initForm('edit');
308  } else {
309  $this->initForm();
310  }
311 
312  if ($this->form_gui->checkInput()) {
313  $this->mlists->getCurrentMailingList()->setTitle($_POST['title']);
314  $this->mlists->getCurrentMailingList()->setDescription($_POST['description']);
315  if ($this->mlists->getCurrentMailingList()->getId()) {
316  $this->mlists->getCurrentMailingList()->setChangedate(date('Y-m-d H:i:s', time()));
317  $this->mlists->getCurrentMailingList()->update();
318  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
319  } else {
320  $this->mlists->getCurrentMailingList()->setCreatedate(date('Y-m-d H:i:s', time()));
321  $this->mlists->getCurrentMailingList()->insert();
322  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
323  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
324 
325  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
326  $this->ctrl->redirect($this, 'showMembersList');
327 
328  exit;
329  }
330  }
331 
332  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
333  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_form.html', 'Services/Contact');
334 
335  $this->form_gui->setValuesByPost();
336 
337  $this->tpl->setVariable('FORM', $this->form_gui->getHTML());
338  return $this->tpl->show();
339  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
user()
Definition: user.php:4
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
initForm($a_type='create')
$_POST["username"]
+ Here is the call graph for this function:

◆ setDefaultValues()

ilMailingListsGUI::setDefaultValues ( )
private

Definition at line 370 of file class.ilMailingListsGUI.php.

References array.

Referenced by showForm().

371  {
372  $this->form_gui->setValuesByArray(array(
373  'title' => '',
374  'description' => ''
375  ));
376  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ setValuesByObject()

ilMailingListsGUI::setValuesByObject ( )
private

Definition at line 362 of file class.ilMailingListsGUI.php.

References array.

Referenced by showForm().

363  {
364  $this->form_gui->setValuesByArray(array(
365  'title' => $this->mlists->getCurrentMailingList()->getTitle(),
366  'description' => $this->mlists->getCurrentMailingList()->getDescription()
367  ));
368  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ showAssignmentForm()

ilMailingListsGUI::showAssignmentForm ( ilPropertyFormGUI  $form = null)
Parameters
ilPropertyFormGUI | null$form
Returns
bool

Definition at line 604 of file class.ilMailingListsGUI.php.

References $form, showMembersList(), and user().

Referenced by saveAssignmentForm().

605  {
606  if (!$this->mlists->getCurrentMailingList()->getId()) {
607  $this->showMembersList();
608  return true;
609  }
610 
611  if (!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
612  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
613  }
614 
615  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
616  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members_form.html', 'Services/Contact');
617 
618  if (!($form instanceof ilPropertyFormGUI)) {
619  $form = $this->getAssignmentForm();
620  }
621 
622  $this->tpl->setVariable('FORM', $form->getHTML());
623  $this->tpl->show();
624 
625  return true;
626  }
This class represents a property form user interface.
user()
Definition: user.php:4
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showForm()

ilMailingListsGUI::showForm ( )

Definition at line 378 of file class.ilMailingListsGUI.php.

References initForm(), setDefaultValues(), setValuesByObject(), and user().

379  {
380  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
381  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_form.html', 'Services/Contact');
382 
383  if ($this->mlists->getCurrentMailingList()->getId()) {
384  if (!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
385  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
386  }
387 
388  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
389  $this->initForm('edit');
390  $this->setValuesByObject();
391  } else {
392  $this->initForm();
393  $this->setDefaultValues();
394  }
395 
396  $this->tpl->setVariable('FORM', $this->form_gui->getHTML());
397  return $this->tpl->show();
398  }
user()
Definition: user.php:4
initForm($a_type='create')
+ Here is the call graph for this function:

◆ showMailingLists()

ilMailingListsGUI::showMailingLists ( )

Definition at line 214 of file class.ilMailingListsGUI.php.

References $_GET, $counter, $result, $tbl, array, ilUtil\formCheckbox(), ilLinkButton\getInstance(), ilMailingList\MODE_TEMPORARY, and user().

Referenced by cancel(), confirmDelete(), mailToList(), performDelete(), and showMembersList().

215  {
216  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
217  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_list.html', 'Services/Contact');
218 
219  // check if current user may send mails
220  include_once "Services/Mail/classes/class.ilMail.php";
221  $mail = new ilMail($this->user->getId());
222  $mailing_allowed = $this->rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
223 
224  require_once 'Services/Contact/classes/class.ilMailingListsTableGUI.php';
225  $tbl = new ilMailingListsTableGUI($this, 'showMailingLists');
226 
227  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
228  $create_btn = ilLinkButton::getInstance();
229  $create_btn->setCaption('create');
230  $create_btn->setUrl($this->ctrl->getLinkTarget($this, 'showForm'));
231  $this->toolbar->addButtonInstance($create_btn);
232 
233  $result = array();
234  $entries = $this->mlists->getAll();
235  if (count($entries)) {
236  $tbl->enable('select_all');
237  $counter = 0;
238  require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
239 
240  foreach ($entries as $entry) {
241  if ($entry->getMode() == ilMailingList::MODE_TEMPORARY) {
242  continue;
243  }
244 
245  $result[$counter]['check'] = ilUtil::formCheckbox(0, 'ml_id[]', $entry->getId());
246  $result[$counter]['title'] = $entry->getTitle() . " [#il_ml_" . $entry->getId() . "]";
247  $result[$counter]['description'] = $entry->getDescription();
248  $result[$counter]['members'] = count($entry->getAssignedEntries());
249 
250  $this->ctrl->setParameter($this, 'ml_id', $entry->getId());
251 
252  $current_selection_list = new ilAdvancedSelectionListGUI();
253  $current_selection_list->setListTitle($this->lng->txt("actions"));
254  $current_selection_list->setId("act_" . $counter);
255 
256  $current_selection_list->addItem($this->lng->txt("edit"), '', $this->ctrl->getLinkTarget($this, "showForm"));
257  $current_selection_list->addItem($this->lng->txt("members"), '', $this->ctrl->getLinkTarget($this, "showMembersList"));
258  if ($mailing_allowed) {
259  $current_selection_list->addItem($this->lng->txt("send_mail_to"), '', $this->ctrl->getLinkTarget($this, "mailToList"));
260  }
261  $current_selection_list->addItem($this->lng->txt("delete"), '', $this->ctrl->getLinkTarget($this, "confirmDelete"));
262 
263  $result[$counter]['COMMAND_SELECTION_LIST'] = $current_selection_list->getHTML();
264  ++$counter;
265  }
266 
267  if ($mailing_allowed) {
268  $tbl->addMultiCommand('mailToList', $this->lng->txt('send_mail_to'));
269  }
270  $tbl->addMultiCommand('confirmDelete', $this->lng->txt('delete'));
271  } else {
272  $tbl->disable('header');
273  $tbl->disable('footer');
274  }
275 
276  $tbl->setData($result);
277 
278  if (isset($_GET['ref']) && $_GET['ref'] == 'mail') {
279  $tbl->addCommandButton('cancel', $this->lng->txt('cancel'));
280  }
281 
282  $this->tpl->setVariable('MAILING_LISTS', $tbl->getHTML());
283  $this->tpl->show();
284  return true;
285  }
$result
$_GET["client_id"]
$tbl
Definition: example_048.php:81
user()
Definition: user.php:4
$counter
This class handles base functions for mail handling.
Create styles array
The data for the language used.
User interface class for advanced drop-down selection lists.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMembersList()

ilMailingListsGUI::showMembersList ( )

Definition at line 400 of file class.ilMailingListsGUI.php.

References $counter, $names, $result, $tbl, array, ilUtil\formCheckbox(), ilLinkButton\getInstance(), ilUserUtil\getNamePresentation(), and showMailingLists().

Referenced by confirmDeleteMembers(), performDeleteMembers(), saveAssignmentForm(), and showAssignmentForm().

401  {
402  if (!$this->mlists->getCurrentMailingList()->getId()) {
403  $this->showMailingLists();
404  return true;
405  }
406 
407  $this->ctrl->setParameter($this, 'cmd', 'post');
408  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
409 
410  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
411  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members.html', 'Services/Contact');
412 
413  require_once 'Services/Contact/classes/class.ilMailingListsMembersTableGUI.php';
414  $tbl = new ilMailingListsMembersTableGUI($this, 'showMembersList', $this->mlists->getCurrentMailingList());
415  $result = array();
416 
417  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
418  $create_btn = ilLinkButton::getInstance();
419  $create_btn->setCaption('add');
420  $create_btn->setUrl($this->ctrl->getLinkTarget($this, 'showAssignmentForm'));
421  $this->toolbar->addButtonInstance($create_btn);
422 
423  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
424  if (count($assigned_entries)) {
425  $tbl->enable('select_all');
426  $tbl->setSelectAllCheckbox('a_id');
427 
428  $usr_ids = array();
429  foreach ($assigned_entries as $entry) {
430  $usr_ids[] = $entry['usr_id'];
431  }
432 
433  require_once 'Services/User/classes/class.ilUserUtil.php';
434  $names = ilUserUtil::getNamePresentation($usr_ids, false, false, '', false, false, false);
435 
436  $counter = 0;
437  foreach ($assigned_entries as $entry) {
438  $result[$counter]['check'] = ilUtil::formCheckbox(0, 'a_id[]', $entry['a_id']);
439  $result[$counter]['user'] = $names[$entry['usr_id']];
440  ++$counter;
441  }
442 
443  $tbl->addMultiCommand('confirmDeleteMembers', $this->lng->txt('delete'));
444  } else {
445  $tbl->disable('header');
446  $tbl->disable('footer');
447 
448  $tbl->setNoEntriesText($this->lng->txt('mail_search_no'));
449  }
450 
451  $tbl->setData($result);
452 
453  $this->tpl->setVariable('MEMBERS_LIST', $tbl->getHTML());
454  $this->tpl->show();
455  return true;
456  }
$result
$tbl
Definition: example_048.php:81
$counter
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
Create styles array
The data for the language used.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilMailingListsGUI::$ctrl = null
protected

Definition at line 25 of file class.ilMailingListsGUI.php.

◆ $error

ilMailingListsGUI::$error
protected

Definition at line 40 of file class.ilMailingListsGUI.php.

◆ $form_gui

ilMailingListsGUI::$form_gui = null
private

Definition at line 59 of file class.ilMailingListsGUI.php.

◆ $lng

ilMailingListsGUI::$lng = null
protected

Definition at line 30 of file class.ilMailingListsGUI.php.

◆ $mlists

ilMailingListsGUI::$mlists = null
private

Definition at line 58 of file class.ilMailingListsGUI.php.

◆ $rbacsystem

ilMailingListsGUI::$rbacsystem
protected

Definition at line 55 of file class.ilMailingListsGUI.php.

◆ $tabs

ilMailingListsGUI::$tabs
protected

Definition at line 50 of file class.ilMailingListsGUI.php.

◆ $toolbar

ilMailingListsGUI::$toolbar
protected

Definition at line 45 of file class.ilMailingListsGUI.php.

◆ $tpl

ilMailingListsGUI::$tpl = null
protected

Definition at line 20 of file class.ilMailingListsGUI.php.

◆ $umail

ilMailingListsGUI::$umail = null
private

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

◆ $user

ilMailingListsGUI::$user
protected

Definition at line 35 of file class.ilMailingListsGUI.php.


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