ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 289 of file class.ilMailingListsGUI.php.

References $_GET, and showMailingLists().

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

◆ confirmDelete()

ilMailingListsGUI::confirmDelete ( )

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

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

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

◆ confirmDeleteMembers()

ilMailingListsGUI::confirmDeleteMembers ( )

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

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

458  {
459  if (!isset($_POST['a_id'])) {
460  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
461  $this->showMembersList();
462  return true;
463  }
464 
465  include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
466  $c_gui = new ilConfirmationGUI();
467  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
468  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteMembers'));
469  $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
470  $c_gui->setCancel($this->lng->txt('cancel'), 'showMembersList');
471  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteMembers');
472 
473  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
474 
475  $usr_ids = array();
476  foreach ($assigned_entries as $entry) {
477  $usr_ids[] = $entry['usr_id'];
478  }
479 
480  require_once 'Services/User/classes/class.ilUserUtil.php';
481  $names = ilUserUtil::getNamePresentation($usr_ids, false, false, '', false, false, false);
482 
483  foreach ($assigned_entries as $entry) {
484  if (in_array($entry['a_id'], $_POST['a_id'])) {
485  $c_gui->addItem('a_id[]', $entry['a_id'], $names[$entry['usr_id']]);
486  }
487  }
488 
489  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
490  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members.html', 'Services/Contact');
491  $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
492 
493  $this->tpl->show();
494  return true;
495  }
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:
$_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  if (
85  !ilBuddySystem::getInstance()->isEnabled() ||
86  0 === count(ilBuddyList::getInstanceByGlobalUser()->getLinkedRelations())
87  ) {
88  $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
89  }
90 
91  $forward_class = $this->ctrl->getNextClass($this);
92  switch ($forward_class) {
93  default:
94  if (!($cmd = $this->ctrl->getCmd())) {
95  $cmd = 'showMailingLists';
96  }
97 
98  $this->$cmd();
99  break;
100  }
101  return true;
102  }
static getInstanceByGlobalUser()
+ Here is the call graph for this function:

◆ initForm()

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

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

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

Referenced by saveForm(), and showForm().

341  {
342  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
343  $this->form_gui = new ilPropertyFormGUI();
344 
345  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
346  $this->form_gui->setTitle($this->lng->txt('mail_mailing_list'));
347 
348  $titleGui = new ilTextInputGUI($this->lng->txt('title'), 'title');
349  $titleGui->setRequired(true);
350  $this->form_gui->addItem($titleGui);
351 
352  $descriptionGui = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
353  $descriptionGui->setCols(40);
354  $descriptionGui->setRows(8);
355  $this->form_gui->addItem($descriptionGui);
356 
357  $this->form_gui->addCommandButton('saveForm', $this->lng->txt('save'));
358  $this->form_gui->addCommandButton('showMailingLists', $this->lng->txt('cancel'));
359  }
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 158 of file class.ilMailingListsGUI.php.

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

159  {
160  // check if current user may send mails
161  include_once "Services/Mail/classes/class.ilMail.php";
162  $mail = new ilMail($this->user->getId());
163  $mailing_allowed = $this->rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
164 
165  if (!$mailing_allowed) {
166  ilUtil::sendFailure($this->lng->txt('no_permission'));
167  return true;
168  }
169 
170  $ml_ids = ((int) $_GET['ml_id']) ? array($_GET['ml_id']) : $_POST['ml_id'];
171  if (!$ml_ids) {
172  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
173  $this->showMailingLists();
174  return true;
175  }
176 
177  $mail_data = $this->umail->getSavedData();
178  if (!is_array($mail_data)) {
179  $this->umail->savePostData($this->user->getId(), array(), '', '', '', '', '', '', '', '');
180  }
181 
182  $lists = array();
183  foreach ($ml_ids as $id) {
184  if (ilMailingList::_isOwner($id, $this->user->getId()) &&
185  !$this->umail->existsRecipient('#il_ml_' . $id, (string) $mail_data['rcp_to'])) {
186  $lists[] = '#il_ml_' . $id;
187  }
188  }
189 
190  if (count($lists)) {
191  $mail_data = $this->umail->appendSearchResult($lists, 'to');
192  $this->umail->savePostData(
193  $mail_data['user_id'],
194  $mail_data['attachments'],
195  $mail_data['rcp_to'],
196  $mail_data['rcp_cc'],
197  $mail_data['rcp_bcc'],
198  $mail_data['m_type'],
199  $mail_data['m_email'],
200  $mail_data['m_subject'],
201  $mail_data['m_message'],
202  $mail_data['use_placeholders'],
203  $mail_data['tpl_ctx_id'],
204  $mail_data['tpl_ctx_params']
205  );
206  }
207 
208  ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
209 
210  return true;
211  }
$_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.
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 135 of file class.ilMailingListsGUI.php.

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

136  {
137  if (is_array($_POST['ml_id'])) {
138  $counter = 0;
139  foreach ($_POST['ml_id'] as $id) {
140  if (ilMailingList::_isOwner($id, $this->user->getId())) {
141  $this->mlists->get(ilUtil::stripSlashes($id))->delete();
142  ++$counter;
143  }
144  }
145 
146  if ($counter) {
147  ilUtil::sendInfo($this->lng->txt('mail_deleted_entry'));
148  }
149  } else {
150  ilUtil::sendInfo($this->lng->txt('mail_delete_error'));
151  }
152 
153  $this->showMailingLists();
154 
155  return true;
156  }
if(!array_key_exists('StateId', $_REQUEST)) $id
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
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 497 of file class.ilMailingListsGUI.php.

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

498  {
499  if (!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
500  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
501  }
502 
503  if (is_array($_POST['a_id'])) {
504  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
505  foreach ($_POST['a_id'] as $id) {
506  if (isset($assigned_entries[$id])) {
507  $this->mlists->getCurrentMailingList()->deleteEntry((int) $id);
508  }
509  }
510  ilUtil::sendInfo($this->lng->txt('mail_deleted_entry'));
511  } else {
512  ilUtil::sendInfo($this->lng->txt('mail_delete_error'));
513  }
514 
515  $this->showMembersList();
516 
517  return true;
518  }
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 574 of file class.ilMailingListsGUI.php.

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

575  {
576  if (!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
577  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
578  }
579 
580  $form = $this->getAssignmentForm();
581  if (!$form->checkInput()) {
582  $form->setValuesByPost();
583  $this->showAssignmentForm($form);
584  return true;
585  }
586 
587  require_once 'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
588  if (ilBuddyList::getInstanceByGlobalUser()->getRelationByUserId((int) $_POST['usr_id'])->isLinked()) {
589  $this->mlists->getCurrentMailingList()->assignUser((int) $_POST['usr_id']);
590  ilUtil::sendInfo($this->lng->txt('saved_successfully'));
591  $this->showMembersList();
592  return true;
593  }
594 
595  $this->showAssignmentForm($form);
596  return true;
597  }
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 298 of file class.ilMailingListsGUI.php.

References $_POST, exit, initForm(), and user().

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

◆ setDefaultValues()

ilMailingListsGUI::setDefaultValues ( )
private

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

Referenced by showForm().

370  {
371  $this->form_gui->setValuesByArray(array(
372  'title' => '',
373  'description' => ''
374  ));
375  }
+ Here is the caller graph for this function:

◆ setValuesByObject()

ilMailingListsGUI::setValuesByObject ( )
private

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

Referenced by showForm().

362  {
363  $this->form_gui->setValuesByArray(array(
364  'title' => $this->mlists->getCurrentMailingList()->getTitle(),
365  'description' => $this->mlists->getCurrentMailingList()->getDescription()
366  ));
367  }
+ Here is the caller graph for this function:

◆ showAssignmentForm()

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

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

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

Referenced by saveAssignmentForm().

604  {
605  if (!$this->mlists->getCurrentMailingList()->getId()) {
606  $this->showMembersList();
607  return true;
608  }
609 
610  if (!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
611  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
612  }
613 
614  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
615  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members_form.html', 'Services/Contact');
616 
617  if (!($form instanceof ilPropertyFormGUI)) {
618  $form = $this->getAssignmentForm();
619  }
620 
621  $this->tpl->setVariable('FORM', $form->getHTML());
622  $this->tpl->show();
623 
624  return true;
625  }
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 377 of file class.ilMailingListsGUI.php.

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

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

◆ showMailingLists()

ilMailingListsGUI::showMailingLists ( )

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

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

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

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

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

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

400  {
401  if (!$this->mlists->getCurrentMailingList()->getId()) {
402  $this->showMailingLists();
403  return true;
404  }
405 
406  $this->ctrl->setParameter($this, 'cmd', 'post');
407  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
408 
409  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
410  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members.html', 'Services/Contact');
411 
412  require_once 'Services/Contact/classes/class.ilMailingListsMembersTableGUI.php';
413  $tbl = new ilMailingListsMembersTableGUI($this, 'showMembersList', $this->mlists->getCurrentMailingList());
414  $result = array();
415 
416  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
417  $create_btn = ilLinkButton::getInstance();
418  $create_btn->setCaption('add');
419  $create_btn->setUrl($this->ctrl->getLinkTarget($this, 'showAssignmentForm'));
420  $this->toolbar->addButtonInstance($create_btn);
421 
422  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
423  if (count($assigned_entries)) {
424  $tbl->enable('select_all');
425  $tbl->setSelectAllCheckbox('a_id');
426 
427  $usr_ids = array();
428  foreach ($assigned_entries as $entry) {
429  $usr_ids[] = $entry['usr_id'];
430  }
431 
432  require_once 'Services/User/classes/class.ilUserUtil.php';
433  $names = ilUserUtil::getNamePresentation($usr_ids, false, false, '', false, false, false);
434 
435  $counter = 0;
436  foreach ($assigned_entries as $entry) {
437  $result[$counter]['check'] = ilUtil::formCheckbox(0, 'a_id[]', $entry['a_id']);
438  $result[$counter]['user'] = $names[$entry['usr_id']];
439  ++$counter;
440  }
441 
442  $tbl->addMultiCommand('confirmDeleteMembers', $this->lng->txt('delete'));
443  } else {
444  $tbl->disable('header');
445  $tbl->disable('footer');
446 
447  $tbl->setNoEntriesText($this->lng->txt('mail_search_no'));
448  }
449 
450  $tbl->setData($result);
451 
452  $this->tpl->setVariable('MEMBERS_LIST', $tbl->getHTML());
453  $this->tpl->show();
454  return true;
455  }
$result
$tbl
Definition: example_048.php:81
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:
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: