ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.
global $DIC
+ Here is the call graph for this function:

Member Function Documentation

◆ cancel()

ilMailingListsGUI::cancel ( )

Cancel action.

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

References $_GET, and showMailingLists().

307  {
308  if(isset($_GET['ref']) && $_GET['ref'] == 'mail')
309  {
310  $this->ctrl->returnToParent($this);
311  }
312  else
313  {
314  $this->showMailingLists();
315  }
316  }
$_GET["client_id"]
+ Here is the call graph for this function:

◆ confirmDelete()

ilMailingListsGUI::confirmDelete ( )

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

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

100  {
101  $ml_ids = ((int)$_GET['ml_id']) ? array($_GET['ml_id']) : $_POST['ml_id'];
102  if (!$ml_ids)
103  {
104  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
105  $this->showMailingLists();
106  return true;
107  }
108 
109  include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
110  $c_gui = new ilConfirmationGUI();
111 
112  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDelete'));
113  $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
114  $c_gui->setCancel($this->lng->txt('cancel'), 'showMailingLists');
115  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDelete');
116 
117  $entries = $this->mlists->getSelected($ml_ids);
118  foreach($entries as $entry)
119  {
120  $c_gui->addItem('ml_id[]', $entry->getId(), $entry->getTitle());
121  }
122 
123  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
124  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_list.html', 'Services/Contact');
125  $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
126 
127  $this->tpl->show();
128 
129  return true;
130  }
$_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 495 of file class.ilMailingListsGUI.php.

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

496  {
497  if(!isset($_POST['a_id']))
498  {
499  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
500  $this->showMembersList();
501  return true;
502  }
503 
504  include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
505  $c_gui = new ilConfirmationGUI();
506  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
507  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteMembers'));
508  $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
509  $c_gui->setCancel($this->lng->txt('cancel'), 'showMembersList');
510  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteMembers');
511 
512  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
513 
514  $usr_ids = array();
515  foreach($assigned_entries as $entry)
516  {
517  $usr_ids[] = $entry['usr_id'];
518  }
519 
520  require_once 'Services/User/classes/class.ilUserUtil.php';
521  $names = ilUserUtil::getNamePresentation($usr_ids, false, false, '', false, false, false);
522 
523  foreach($assigned_entries as $entry)
524  {
525  if(in_array($entry['a_id'], $_POST['a_id']))
526  {
527  $c_gui->addItem('a_id[]', $entry['a_id'], $names[$entry['usr_id']]);
528  }
529  }
530 
531  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
532  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members.html', 'Services/Contact');
533  $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
534 
535  $this->tpl->show();
536  return true;
537  }
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:
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 $cmd.

83  {
84  $forward_class = $this->ctrl->getNextClass($this);
85  switch ($forward_class)
86  {
87  default:
88  if (!($cmd = $this->ctrl->getCmd()))
89  {
90  $cmd = 'showMailingLists';
91  }
92 
93  $this->$cmd();
94  break;
95  }
96  return true;
97  }
$cmd
Definition: sahs_server.php:35

◆ initForm()

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

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

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

Referenced by saveForm(), and showForm().

369  {
370  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
371  $this->form_gui = new ilPropertyFormGUI();
372 
373  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
374  $this->form_gui->setTitle($this->lng->txt('mail_mailing_list'));
375 
376  $titleGui = new ilTextInputGUI($this->lng->txt('title'), 'title');
377  $titleGui->setRequired(true);
378  $this->form_gui->addItem($titleGui);
379 
380  $descriptionGui = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
381  $descriptionGui->setCols(40);
382  $descriptionGui->setRows(8);
383  $this->form_gui->addItem($descriptionGui);
384 
385  $this->form_gui->addCommandButton('saveForm',$this->lng->txt('save'));
386  $this->form_gui->addCommandButton('showMailingLists',$this->lng->txt('cancel'));
387  }
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 161 of file class.ilMailingListsGUI.php.

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

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

◆ performDelete()

ilMailingListsGUI::performDelete ( )

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

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

133  {
134  if(is_array($_POST['ml_id']))
135  {
136  $counter = 0;
137  foreach($_POST['ml_id'] as $id)
138  {
139  if(ilMailingList::_isOwner($id, $this->user->getId()))
140  {
141  $this->mlists->get(ilUtil::stripSlashes($id))->delete();
142  ++$counter;
143  }
144  }
145 
146  if($counter)
147  {
148  ilUtil::sendInfo($this->lng->txt('mail_deleted_entry'));
149  }
150  }
151  else
152  {
153  ilUtil::sendInfo($this->lng->txt('mail_delete_error'));
154  }
155 
156  $this->showMailingLists();
157 
158  return true;
159  }
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 539 of file class.ilMailingListsGUI.php.

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

540  {
541  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId()))
542  {
543  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
544  }
545 
546  if(is_array($_POST['a_id']))
547  {
548  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
549  foreach($_POST['a_id'] as $id)
550  {
551  if(isset($assigned_entries[$id]))
552  {
553  $this->mlists->getCurrentMailingList()->deleteEntry((int)$id);
554  }
555  }
556  ilUtil::sendInfo($this->lng->txt('mail_deleted_entry'));
557  }
558  else
559  {
560  ilUtil::sendInfo($this->lng->txt('mail_delete_error'));
561  }
562 
563  $this->showMembersList();
564 
565  return true;
566  }
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 631 of file class.ilMailingListsGUI.php.

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

632  {
633  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId()))
634  {
635  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
636  }
637 
638  $form = $this->getAssignmentForm();
639  if(!$form->checkInput())
640  {
641  $form->setValuesByPost();
642  $this->showAssignmentForm($form);
643  return true;
644  }
645 
646  require_once 'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
647  if(ilBuddyList::getInstanceByGlobalUser()->getRelationByUserId((int)$_POST['usr_id'])->isLinked())
648  {
649  $this->mlists->getCurrentMailingList()->assignUser((int)$_POST['usr_id']);
650  ilUtil::sendInfo($this->lng->txt('saved_successfully'));
651  $this->showMembersList();
652  return true;
653  }
654 
655  $this->showAssignmentForm($form);
656  return true;
657  }
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 318 of file class.ilMailingListsGUI.php.

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

319  {
320  if($this->mlists->getCurrentMailingList()->getId())
321  {
322  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId()))
323  {
324  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
325  }
326 
327  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
328  $this->initForm('edit');
329  }
330  else
331  {
332  $this->initForm();
333  }
334 
335  if($this->form_gui->checkInput())
336  {
337  $this->mlists->getCurrentMailingList()->setTitle($_POST['title']);
338  $this->mlists->getCurrentMailingList()->setDescription($_POST['description']);
339  if($this->mlists->getCurrentMailingList()->getId())
340  {
341  $this->mlists->getCurrentMailingList()->setChangedate(date('Y-m-d H:i:s', time()));
342  $this->mlists->getCurrentMailingList()->update();
343  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
344  }
345  else
346  {
347  $this->mlists->getCurrentMailingList()->setCreatedate(date('Y-m-d H:i:s', time()));
348  $this->mlists->getCurrentMailingList()->insert();
349  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
350  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
351 
352  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
353  $this->ctrl->redirect($this,'showMembersList');
354 
355  exit;
356  }
357  }
358 
359  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
360  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_form.html', 'Services/Contact');
361 
362  $this->form_gui->setValuesByPost();
363 
364  $this->tpl->setVariable('FORM', $this->form_gui->getHTML());
365  return $this->tpl->show();
366  }
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 397 of file class.ilMailingListsGUI.php.

References array.

Referenced by showForm().

398  {
399  $this->form_gui->setValuesByArray(array(
400  'title' => '',
401  'description' => ''
402  ));
403  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ setValuesByObject()

ilMailingListsGUI::setValuesByObject ( )
private

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

References array.

Referenced by showForm().

390  {
391  $this->form_gui->setValuesByArray(array(
392  'title' => $this->mlists->getCurrentMailingList()->getTitle(),
393  'description' => $this->mlists->getCurrentMailingList()->getDescription()
394  ));
395  }
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 663 of file class.ilMailingListsGUI.php.

References showMembersList(), and user().

Referenced by saveAssignmentForm().

664  {
665  if(!$this->mlists->getCurrentMailingList()->getId())
666  {
667  $this->showMembersList();
668  return true;
669  }
670 
671  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId()))
672  {
673  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
674  }
675 
676  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
677  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members_form.html', 'Services/Contact');
678 
679  if(!($form instanceof ilPropertyFormGUI))
680  {
681  $form = $this->getAssignmentForm();
682  }
683 
684  $this->tpl->setVariable('FORM', $form->getHTML());
685  $this->tpl->show();
686 
687  return true;
688  }
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 405 of file class.ilMailingListsGUI.php.

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

406  {
407  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
408  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_form.html', 'Services/Contact');
409 
410  if($this->mlists->getCurrentMailingList()->getId())
411  {
412  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId()))
413  {
414  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
415  }
416 
417  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
418  $this->initForm('edit');
419  $this->setValuesByObject();
420  }
421  else
422  {
423  $this->initForm();
424  $this->setDefaultValues();
425  }
426 
427  $this->tpl->setVariable('FORM', $this->form_gui->getHTML());
428  return $this->tpl->show();
429  }
user()
Definition: user.php:4
initForm($a_type='create')
+ Here is the call graph for this function:

◆ showMailingLists()

ilMailingListsGUI::showMailingLists ( )

Definition at line 222 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().

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

432  {
433  if(!$this->mlists->getCurrentMailingList()->getId())
434  {
435  $this->showMailingLists();
436  return true;
437  }
438 
439  $this->ctrl->setParameter($this, 'cmd', 'post');
440  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
441 
442  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
443  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members.html', 'Services/Contact');
444 
445  require_once 'Services/Contact/classes/class.ilMailingListsMembersTableGUI.php';
446  $tbl = new ilMailingListsMembersTableGUI($this, 'showMembersList', $this->mlists->getCurrentMailingList());
447  $result = array();
448 
449  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
450  $create_btn = ilLinkButton::getInstance();
451  $create_btn->setCaption('add');
452  $create_btn->setUrl($this->ctrl->getLinkTarget($this, 'showAssignmentForm'));
453  $this->toolbar->addButtonInstance($create_btn);
454 
455  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
456  if(count($assigned_entries))
457  {
458  $tbl->enable('select_all');
459  $tbl->setSelectAllCheckbox('a_id');
460 
461  $usr_ids = array();
462  foreach($assigned_entries as $entry)
463  {
464  $usr_ids[] = $entry['usr_id'];
465  }
466 
467  require_once 'Services/User/classes/class.ilUserUtil.php';
468  $names = ilUserUtil::getNamePresentation($usr_ids, false, false, '', false, false, false);
469 
470  $counter = 0;
471  foreach($assigned_entries as $entry)
472  {
473  $result[$counter]['check'] = ilUtil::formCheckbox(0, 'a_id[]', $entry['a_id']);
474  $result[$counter]['user'] = $names[$entry['usr_id']];
475  ++$counter;
476  }
477 
478  $tbl->addMultiCommand('confirmDeleteMembers', $this->lng->txt('delete'));
479  }
480  else
481  {
482  $tbl->disable('header');
483  $tbl->disable('footer');
484 
485  $tbl->setNoEntriesText($this->lng->txt('mail_search_no'));
486  }
487 
488  $tbl->setData($result);
489 
490  $this->tpl->setVariable('MEMBERS_LIST', $tbl->getHTML());
491  $this->tpl->show();
492  return true;
493  }
$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)
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: