ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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  }
$_GET["client_id"]
user()
Definition: user.php:4
Class UserMail this class handles user mails.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ cancel()

ilMailingListsGUI::cancel ( )

Cancel action.

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

References $_GET, and showMailingLists().

289  {
290  if (isset($_GET['ref']) && $_GET['ref'] == 'mail') {
291  $this->ctrl->returnToParent($this);
292  } else {
293  $this->showMailingLists();
294  }
295  }
$_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->printToStdout();
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 456 of file class.ilMailingListsGUI.php.

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

457  {
458  if (!isset($_POST['a_id'])) {
459  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
460  $this->showMembersList();
461  return true;
462  }
463 
464  include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
465  $c_gui = new ilConfirmationGUI();
466  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
467  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteMembers'));
468  $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
469  $c_gui->setCancel($this->lng->txt('cancel'), 'showMembersList');
470  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteMembers');
471 
472  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
473 
474  $usr_ids = array();
475  foreach ($assigned_entries as $entry) {
476  $usr_ids[] = $entry['usr_id'];
477  }
478 
479  require_once 'Services/User/classes/class.ilUserUtil.php';
480  $names = ilUserUtil::getNamePresentation($usr_ids, false, false, '', false, false, false);
481 
482  foreach ($assigned_entries as $entry) {
483  if (in_array($entry['a_id'], $_POST['a_id'])) {
484  $c_gui->addItem('a_id[]', $entry['a_id'], $names[$entry['usr_id']]);
485  }
486  }
487 
488  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
489  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members.html', 'Services/Contact');
490  $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
491 
492  $this->tpl->print();
493  return true;
494  }
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 339 of file class.ilMailingListsGUI.php.

References ilTextAreaInputGUI\setCols().

Referenced by saveForm(), and showForm().

340  {
341  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
342  $this->form_gui = new ilPropertyFormGUI();
343 
344  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
345  $this->form_gui->setTitle($this->lng->txt('mail_mailing_list'));
346 
347  $titleGui = new ilTextInputGUI($this->lng->txt('title'), 'title');
348  $titleGui->setRequired(true);
349  $this->form_gui->addItem($titleGui);
350 
351  $descriptionGui = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
352  $descriptionGui->setCols(40);
353  $descriptionGui->setRows(8);
354  $this->form_gui->addItem($descriptionGui);
355 
356  $this->form_gui->addCommandButton('saveForm', $this->lng->txt('save'));
357  $this->form_gui->addCommandButton('showMailingLists', $this->lng->txt('cancel'));
358  }
This class represents a property form user interface.
This class represents a text area property in a property form.
+ 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, 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_email'],
199  $mail_data['m_subject'],
200  $mail_data['m_message'],
201  $mail_data['use_placeholders'],
202  $mail_data['tpl_ctx_id'],
203  $mail_data['tpl_ctx_params']
204  );
205  }
206 
207  ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
208 
209  return true;
210  }
$_GET["client_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, 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  }
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 496 of file class.ilMailingListsGUI.php.

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

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

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

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

◆ saveForm()

ilMailingListsGUI::saveForm ( )

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

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

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

◆ setDefaultValues()

ilMailingListsGUI::setDefaultValues ( )
private

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

Referenced by showForm().

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

◆ setValuesByObject()

ilMailingListsGUI::setValuesByObject ( )
private

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

Referenced by showForm().

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

◆ showAssignmentForm()

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

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

References showMembersList(), and user().

Referenced by saveAssignmentForm().

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

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

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

◆ showMailingLists()

ilMailingListsGUI::showMailingLists ( )

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

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

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

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

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

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

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