ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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)
 

Private Member Functions

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

Private Attributes

 $tpl = null
 
 $ctrl = null
 
 $lng = null
 
 $umail = null
 
 $mlists = null
 
 $error = array()
 
 $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 28 of file class.ilMailingListsGUI.php.

References $_GET, $ilCtrl, $ilUser, $lng, and $tpl.

29  {
30  global $tpl, $ilCtrl, $lng, $ilUser;
31 
32  $this->tpl = $tpl;
33  $this->ctrl = $ilCtrl;
34  $this->lng = $lng;
35 
36  $this->umail = new ilFormatMail($ilUser->getId());
37 
38  $this->mlists = new ilMailingLists($ilUser);
39  $this->mlists->setCurrentMailingList($_GET['ml_id']);
40 
41  $this->ctrl->saveParameter($this, 'mobj_id');
42  $this->ctrl->saveParameter($this, 'ref');
43  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
Class UserMail this class handles user mails.
global $ilUser
Definition: imgupload.php:15

Member Function Documentation

◆ cancel()

ilMailingListsGUI::cancel ( )

Cancel action.

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

References $_GET, and showMailingLists().

267  {
268  if(isset($_GET['ref']) && $_GET['ref'] == 'mail')
269  {
270  $this->ctrl->returnToParent($this);
271  }
272  else
273  {
274  $this->showMailingLists();
275  }
276  }
$_GET["client_id"]
+ Here is the call graph for this function:

◆ confirmDelete()

ilMailingListsGUI::confirmDelete ( )

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

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

63  {
64  $ml_ids = ((int)$_GET['ml_id']) ? array($_GET['ml_id']) : $_POST['ml_id'];
65  if (!$ml_ids)
66  {
67  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
68  $this->showMailingLists();
69  return true;
70  }
71 
72  include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
73  $c_gui = new ilConfirmationGUI();
74 
75  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDelete'));
76  $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
77  $c_gui->setCancel($this->lng->txt('cancel'), 'showMailingLists');
78  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDelete');
79 
80  $entries = $this->mlists->getSelected($ml_ids);
81  foreach($entries as $entry)
82  {
83  $c_gui->addItem('ml_id[]', $entry->getId(), $entry->getTitle());
84  }
85 
86  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
87  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_list.html', 'Services/Contact');
88  $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
89 
90  $this->tpl->show();
91 
92  return true;
93  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmDeleteMembers()

ilMailingListsGUI::confirmDeleteMembers ( )

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

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

454  {
455  if(!isset($_POST['a_id']))
456  {
457  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
458  $this->showMembersList();
459  return true;
460  }
461 
462  include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
463  $c_gui = new ilConfirmationGUI();
464  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
465  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteMembers'));
466  $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
467  $c_gui->setCancel($this->lng->txt('cancel'), 'showMembersList');
468  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteMembers');
469 
470  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
471 
472  $usr_ids = array();
473  foreach($assigned_entries as $entry)
474  {
475  $usr_ids[] = $entry['usr_id'];
476  }
477 
478  require_once 'Services/User/classes/class.ilUserUtil.php';
479  $names = ilUserUtil::getNamePresentation($usr_ids, false, false, '', false, false, false);
480 
481  foreach($assigned_entries as $entry)
482  {
483  if(in_array($entry['a_id'], $_POST['a_id']))
484  {
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  }
$_POST['username']
Definition: cron.php:12
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)
Default behaviour is:
Confirmation screen class.
+ Here is the call graph for this function:

◆ executeCommand()

ilMailingListsGUI::executeCommand ( )

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

References $cmd.

46  {
47  $forward_class = $this->ctrl->getNextClass($this);
48  switch ($forward_class)
49  {
50  default:
51  if (!($cmd = $this->ctrl->getCmd()))
52  {
53  $cmd = 'showMailingLists';
54  }
55 
56  $this->$cmd();
57  break;
58  }
59  return true;
60  }
$cmd
Definition: sahs_server.php:35

◆ initForm()

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

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

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

Referenced by saveForm(), and showForm().

331  {
332  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
333  $this->form_gui = new ilPropertyFormGUI();
334 
335  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
336  $this->form_gui->setTitle($this->lng->txt('mail_mailing_list'));
337 
338  $titleGui = new ilTextInputGUI($this->lng->txt('title'), 'title');
339  $titleGui->setRequired(true);
340  $this->form_gui->addItem($titleGui);
341 
342  $descriptionGui = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
343  $descriptionGui->setCols(40);
344  $descriptionGui->setRows(8);
345  $this->form_gui->addItem($descriptionGui);
346 
347  $this->form_gui->addCommandButton('saveForm',$this->lng->txt('save'));
348  $this->form_gui->addCommandButton('showMailingLists',$this->lng->txt('cancel'));
349  }
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 123 of file class.ilMailingListsGUI.php.

References $_GET, $_POST, $_SESSION, $ilUser, ilMailingList\_isOwner(), ilUtil\redirect(), ilUtil\sendFailure(), ilUtil\sendInfo(), and showMailingLists().

124  {
125  global $ilUser, $rbacsystem;
126 
127  // check if current user may send mails
128  include_once "Services/Mail/classes/class.ilMail.php";
129  $mail = new ilMail($_SESSION["AccountId"]);
130  $mailing_allowed = $rbacsystem->checkAccess('internal_mail',$mail->getMailObjectReferenceId());
131 
132  if (!$mailing_allowed)
133  {
134  ilUtil::sendFailure($this->lng->txt('no_permission'));
135  return true;
136  }
137 
138  $ml_ids = ((int)$_GET['ml_id']) ? array($_GET['ml_id']) : $_POST['ml_id'];
139  if (!$ml_ids)
140  {
141  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
142  $this->showMailingLists();
143  return true;
144  }
145 
146  $mail_data = $this->umail->getSavedData();
147  if(!is_array($mail_data))
148  {
149  $this->umail->savePostData($ilUser->getId(), array(), '', '', '', '', '', '', '', '');
150  }
151 
152  $lists = array();
153  foreach($ml_ids as $id)
154  {
155  if(ilMailingList::_isOwner($id, $ilUser->getId()) &&
156  !$this->umail->doesRecipientStillExists('#il_ml_'.$id, $mail_data['rcp_to']))
157  {
158  $lists[] = '#il_ml_'.$id;
159  }
160  }
161 
162  if(count($lists))
163  {
164  $mail_data = $this->umail->appendSearchResult($lists, 'to');
165  $this->umail->savePostData(
166  $mail_data['user_id'],
167  $mail_data['attachments'],
168  $mail_data['rcp_to'],
169  $mail_data['rcp_cc'],
170  $mail_data['rcp_bcc'],
171  $mail_data['m_type'],
172  $mail_data['m_email'],
173  $mail_data['m_subject'],
174  $mail_data['m_message'],
175  $mail_data['use_placeholders'],
176  $mail_data['tpl_ctx_id'],
177  $mail_data['tpl_ctx_params']
178  );
179  }
180 
181  ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
182 
183  return true;
184  }
static _isOwner($a_ml_id, $a_usr_id)
$_POST['username']
Definition: cron.php:12
$_SESSION["AccountId"]
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class Mail this class handles base functions for mail handling.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilUser
Definition: imgupload.php:15
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ performDelete()

ilMailingListsGUI::performDelete ( )

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

References $_POST, $ilUser, ilMailingList\_isOwner(), ilUtil\sendInfo(), showMailingLists(), and ilUtil\stripSlashes().

96  {
97  global $ilUser;
98 
99  if (is_array($_POST['ml_id']))
100  {
101  $counter = 0;
102  foreach ($_POST['ml_id'] as $id)
103  {
104  if(ilMailingList::_isOwner($id, $ilUser->getId()))
105  {
106  $this->mlists->get(ilUtil::stripSlashes($id))->delete();
107  ++$counter;
108  }
109  }
110  if($counter)
111  ilUtil::sendInfo($this->lng->txt('mail_deleted_entry'));
112  }
113  else
114  {
115  ilUtil::sendInfo($this->lng->txt('mail_delete_error'));
116  }
117 
118  $this->showMailingLists();
119 
120  return true;
121  }
static _isOwner($a_ml_id, $a_usr_id)
$_POST['username']
Definition: cron.php:12
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
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ performDeleteMembers()

ilMailingListsGUI::performDeleteMembers ( )

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

References $_POST, $ilErr, $ilUser, $options, ilMailingList\_isOwner(), ilUserUtil\getNamePresentation(), ilUtil\sendInfo(), ilFormPropertyGUI\setRequired(), and showMembersList().

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

◆ saveAssignmentForm()

ilMailingListsGUI::saveAssignmentForm ( )
Returns
bool

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

References $_POST, $ilErr, $ilUser, ilMailingList\_isOwner(), ilUtil\sendInfo(), showAssignmentForm(), and showMembersList().

591  {
592  global $ilUser, $ilErr;
593 
594  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
595  {
596  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
597  }
598 
599  $form = $this->getAssignmentForm();
600  if(!$form->checkInput())
601  {
602  $form->setValuesByPost();
603  $this->showAssignmentForm($form);
604  return true;
605  }
606 
607  require_once 'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
608  if(ilBuddyList::getInstanceByGlobalUser()->getRelationByUserId((int)$_POST['usr_id'])->isLinked())
609  {
610  $this->mlists->getCurrentMailingList()->assignUser((int)$_POST['usr_id']);
611  ilUtil::sendInfo($this->lng->txt('saved_successfully'));
612  $this->showMembersList();
613  return true;
614  }
615 
616  $this->showAssignmentForm($form);
617  return true;
618  }
static _isOwner($a_ml_id, $a_usr_id)
$_POST['username']
Definition: cron.php:12
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
showAssignmentForm(ilPropertyFormGUI $form=null)
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ saveForm()

ilMailingListsGUI::saveForm ( )

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

References $_POST, $ilErr, $ilUser, ilMailingList\_isOwner(), exit, initForm(), and ilUtil\sendSuccess().

279  {
280  if($this->mlists->getCurrentMailingList()->getId())
281  {
282  global $ilUser, $ilErr;
283 
284  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
285  {
286  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
287  }
288 
289  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
290  $this->initForm('edit');
291  }
292  else
293  {
294  $this->initForm();
295  }
296 
297  if($this->form_gui->checkInput())
298  {
299  $this->mlists->getCurrentMailingList()->setTitle($_POST['title']);
300  $this->mlists->getCurrentMailingList()->setDescription($_POST['description']);
301  if($this->mlists->getCurrentMailingList()->getId())
302  {
303  $this->mlists->getCurrentMailingList()->setChangedate(date('Y-m-d H:i:s', time()));
304  $this->mlists->getCurrentMailingList()->update();
305  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
306  }
307  else
308  {
309  $this->mlists->getCurrentMailingList()->setCreatedate(date('Y-m-d H:i:s', time()));
310  $this->mlists->getCurrentMailingList()->insert();
311  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
312  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
313 
314  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
315  $this->ctrl->redirect($this,'showMembersList');
316 
317  exit;
318  }
319  }
320 
321  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
322  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_form.html', 'Services/Contact');
323 
324  $this->form_gui->setValuesByPost();
325 
326  $this->tpl->setVariable('FORM', $this->form_gui->getHTML());
327  return $this->tpl->show();
328  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _isOwner($a_ml_id, $a_usr_id)
exit
Definition: login.php:54
$_POST['username']
Definition: cron.php:12
global $ilUser
Definition: imgupload.php:15
initForm($a_type='create')
+ Here is the call graph for this function:

◆ setDefaultValues()

ilMailingListsGUI::setDefaultValues ( )
private

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

Referenced by showForm().

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

◆ setValuesByObject()

ilMailingListsGUI::setValuesByObject ( )
private

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

Referenced by showForm().

352  {
353  $this->form_gui->setValuesByArray(array(
354  'title' => $this->mlists->getCurrentMailingList()->getTitle(),
355  'description' => $this->mlists->getCurrentMailingList()->getDescription()
356  ));
357  }
+ Here is the caller graph for this function:

◆ showAssignmentForm()

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

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

References $ilErr, $ilUser, ilMailingList\_isOwner(), and showMembersList().

Referenced by saveAssignmentForm().

625  {
626  global $ilUser, $ilErr;
627 
628  if(!$this->mlists->getCurrentMailingList()->getId())
629  {
630  $this->showMembersList();
631  return true;
632  }
633 
634  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
635  {
636  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
637  }
638 
639  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
640  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members_form.html', 'Services/Contact');
641 
642  if(!($form instanceof ilPropertyFormGUI))
643  {
644  $form = $this->getAssignmentForm();
645  }
646 
647  $this->tpl->setVariable('FORM', $form->getHTML());
648  $this->tpl->show();
649 
650  return true;
651  }
static _isOwner($a_ml_id, $a_usr_id)
This class represents a property form user interface.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showForm()

ilMailingListsGUI::showForm ( )

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

References $ilErr, $ilUser, ilMailingList\_isOwner(), initForm(), setDefaultValues(), and setValuesByObject().

368  {
369  global $ilUser, $ilErr;
370 
371  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
372  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_form.html', 'Services/Contact');
373 
374  if($this->mlists->getCurrentMailingList()->getId())
375  {
376  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
377  {
378  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
379  }
380 
381  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
382  $this->initForm('edit');
383  $this->setValuesByObject();
384  }
385  else
386  {
387  $this->initForm();
388  $this->setDefaultValues();
389  }
390 
391  $this->tpl->setVariable('FORM', $this->form_gui->getHTML());
392  return $this->tpl->show();
393  }
static _isOwner($a_ml_id, $a_usr_id)
global $ilUser
Definition: imgupload.php:15
initForm($a_type='create')
+ Here is the call graph for this function:

◆ showMailingLists()

ilMailingListsGUI::showMailingLists ( )

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

References $_GET, $_SESSION, $result, $tbl, ilUtil\formCheckbox(), and ilMailingList\MODE_TEMPORARY.

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

187  {
188  global $rbacsystem;
189 
190  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
191  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_list.html', 'Services/Contact');
192 
193  // check if current user may send mails
194  include_once "Services/Mail/classes/class.ilMail.php";
195  $mail = new ilMail($_SESSION['AccountId']);
196  $mailing_allowed = $rbacsystem->checkAccess('internal_mail',$mail->getMailObjectReferenceId());
197 
198  require_once 'Services/Contact/classes/class.ilMailingListsTableGUI.php';
199  $tbl = new ilMailingListsTableGUI($this, 'showMailingLists');
200 
201  $result = array();
202  $entries = $this->mlists->getAll();
203  if(count($entries))
204  {
205  $tbl->enable('select_all');
206  $counter = 0;
207  require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
208 
209  foreach($entries as $entry)
210  {
211  if($entry->getMode() == ilMailingList::MODE_TEMPORARY)
212  {
213  continue;
214  }
215 
216  $result[$counter]['check'] = ilUtil::formCheckbox(0, 'ml_id[]', $entry->getId());
217  $result[$counter]['title'] = $entry->getTitle() . " [#il_ml_" . $entry->getId() . "]";
218  $result[$counter]['description'] = $entry->getDescription();
219  $result[$counter]['members'] = count($entry->getAssignedEntries());
220 
221  $this->ctrl->setParameter($this, 'ml_id', $entry->getId());
222 
223  $current_selection_list = new ilAdvancedSelectionListGUI();
224  $current_selection_list->setListTitle($this->lng->txt("actions"));
225  $current_selection_list->setId("act_".$counter);
226 
227  $current_selection_list->addItem($this->lng->txt("edit"), '', $this->ctrl->getLinkTarget($this, "showForm"));
228  $current_selection_list->addItem($this->lng->txt("members"), '', $this->ctrl->getLinkTarget($this, "showMembersList"));
229  if($mailing_allowed)
230  {
231  $current_selection_list->addItem($this->lng->txt("send_mail_to"), '', $this->ctrl->getLinkTarget($this, "mailToList"));
232  }
233  $current_selection_list->addItem($this->lng->txt("delete"), '', $this->ctrl->getLinkTarget($this, "confirmDelete"));
234 
235  $result[$counter]['COMMAND_SELECTION_LIST'] = $current_selection_list->getHTML();
236  ++$counter;
237  }
238 
239  if($mailing_allowed)
240  {
241  $tbl->addMultiCommand('mailToList', $this->lng->txt('send_mail_to'));
242  }
243  $tbl->addMultiCommand('confirmDelete', $this->lng->txt('delete'));
244  }
245  else
246  {
247  $tbl->disable('header');
248  $tbl->disable('footer');
249  }
250 
251  $tbl->setData($result);
252 
253  if(isset($_GET['ref']) && $_GET['ref'] == 'mail')
254  {
255  $tbl->addCommandButton('cancel', $this->lng->txt('cancel'));
256  }
257 
258  $this->tpl->setVariable('MAILING_LISTS', $tbl->getHTML());
259  $this->tpl->show();
260  return true;
261  }
$_SESSION["AccountId"]
$result
$_GET["client_id"]
$tbl
Definition: example_048.php:81
Class Mail this class handles base functions for mail handling.
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 395 of file class.ilMailingListsGUI.php.

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

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

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

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

◆ $error

ilMailingListsGUI::$error = array()
private

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

◆ $form_gui

ilMailingListsGUI::$form_gui = null
private

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

◆ $lng

ilMailingListsGUI::$lng = null
private

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

Referenced by __construct().

◆ $mlists

ilMailingListsGUI::$mlists = null
private

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

◆ $tpl

ilMailingListsGUI::$tpl = null
private

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

Referenced by __construct().

◆ $umail

ilMailingListsGUI::$umail = null
private

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


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