ILIAS  release_4-4 Revision
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 ()
 
 setError ($a_error='')
 
 getError ()
 
 isError ()
 

Private Member Functions

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

Private Attributes

 $tpl = null
 
 $ctrl = null
 
 $lng = null
 
 $umail = null
 
 $mlists = null
 
 $abook = 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 16 of file class.ilMailingListsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailingListsGUI::__construct ( )

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

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

31  {
32  global $tpl, $ilCtrl, $lng, $ilUser;
33 
34  $this->tpl = $tpl;
35  $this->ctrl = $ilCtrl;
36  $this->lng = $lng;
37 
38  $this->umail = new ilFormatMail($ilUser->getId());
39  $this->abook = new ilAddressbook($ilUser->getId());
40 
41  $this->mlists = new ilMailingLists($ilUser);
42  $this->mlists->setCurrentMailingList($_GET['ml_id']);
43 
44  $this->ctrl->saveParameter($this, 'mobj_id');
45  $this->ctrl->saveParameter($this, 'ref');
46  }
$_GET["client_id"]
Mail Box class Base class for creating and handling mail boxes.
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 288 of file class.ilMailingListsGUI.php.

References $_GET, and showMailingLists().

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

◆ confirmDelete()

ilMailingListsGUI::confirmDelete ( )

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

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

66  {
67  $ml_ids = ((int)$_GET['ml_id']) ? array($_GET['ml_id']) : $_POST['ml_id'];
68  if (!$ml_ids)
69  {
70  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
71  $this->showMailingLists();
72  return true;
73  }
74 
75  include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
76  $c_gui = new ilConfirmationGUI();
77 
78  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDelete'));
79  $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
80  $c_gui->setCancel($this->lng->txt('cancel'), 'showMailingLists');
81  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDelete');
82 
83  $entries = $this->mlists->getSelected($ml_ids);
84  foreach($entries as $entry)
85  {
86  $c_gui->addItem('ml_id[]', $entry->getId(), $entry->getTitle());
87  }
88 
89  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
90  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_list.html', 'Services/Contact');
91  $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
92 
93  $this->tpl->show();
94 
95  return true;
96  }
$_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 483 of file class.ilMailingListsGUI.php.

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

484  {
485  if (!isset($_POST['a_id']))
486  {
487  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
488  $this->showMembersList();
489  return true;
490  }
491 
492  include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
493  $c_gui = new ilConfirmationGUI();
494  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
495  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteMembers'));
496  $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
497  $c_gui->setCancel($this->lng->txt('cancel'), 'showMembersList');
498  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteMembers');
499 
500  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
501  if (is_array($assigned_entries))
502  {
503  foreach ($assigned_entries as $entry)
504  {
505  if (in_array($entry['a_id'], $_POST['a_id']))
506  {
507  $c_gui->addItem('a_id[]', $entry['a_id'], ($entry['login'] != '' ? $entry['login'] : $entry['email']));
508  }
509  }
510  }
511 
512  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
513  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members.html', 'Services/Contact');
514  $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
515 
516  $this->tpl->show();
517 
518  return true;
519  }
$_POST['username']
Definition: cron.php:12
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Confirmation screen class.
+ Here is the call graph for this function:

◆ executeCommand()

ilMailingListsGUI::executeCommand ( )

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

References $cmd.

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

◆ getError()

ilMailingListsGUI::getError ( )

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

Referenced by saveAssignmentForm().

686  {
687  return array_pop($this->error);
688  }
+ Here is the caller graph for this function:

◆ initForm()

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

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

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

Referenced by saveForm(), and showForm().

353  {
354  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
355  $this->form_gui = new ilPropertyFormGUI();
356 
357  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
358  $this->form_gui->setTitle($this->lng->txt('mail_mailing_list'));
359 
360  $titleGui = new ilTextInputGUI($this->lng->txt('title'), 'title');
361  $titleGui->setRequired(true);
362  $this->form_gui->addItem($titleGui);
363 
364  $descriptionGui = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
365  $descriptionGui->setCols(40);
366  $descriptionGui->setRows(8);
367  $this->form_gui->addItem($descriptionGui);
368 
369  $this->form_gui->addCommandButton('saveForm',$this->lng->txt('save'));
370  $this->form_gui->addCommandButton('showMailingLists',$this->lng->txt('cancel'));
371  }
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:

◆ isError()

ilMailingListsGUI::isError ( )

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

Referenced by saveAssignmentForm().

690  {
691  if (is_array($this->error) && !empty($this->error)) return true;
692 
693  return false;
694  }
+ Here is the caller graph for this function:

◆ mailToList()

ilMailingListsGUI::mailToList ( )

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

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

127  {
128  global $ilUser, $rbacsystem;
129 
130  // check if current user may send mails
131  include_once "Services/Mail/classes/class.ilMail.php";
132  $mail = new ilMail($_SESSION["AccountId"]);
133  $mailing_allowed = $rbacsystem->checkAccess('internal_mail',$mail->getMailObjectReferenceId());
134 
135  if (!$mailing_allowed)
136  {
137  ilUtil::sendFailure($this->lng->txt('no_permission'));
138  return true;
139  }
140 
141  $ml_ids = ((int)$_GET['ml_id']) ? array($_GET['ml_id']) : $_POST['ml_id'];
142  if (!$ml_ids)
143  {
144  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
145  $this->showMailingLists();
146  return true;
147  }
148 
149  $mail_data = $this->umail->getSavedData();
150  if(!is_array($mail_data))
151  {
152  $this->umail->savePostData($ilUser->getId(), array(), '', '', '', '', '', '', '', '');
153  }
154 
155  $lists = array();
156  foreach($ml_ids as $id)
157  {
158  if(ilMailingList::_isOwner($id, $ilUser->getId()) &&
159  !$this->umail->doesRecipientStillExists('#il_ml_'.$id, $mail_data['rcp_to']))
160  {
161  $lists[] = '#il_ml_'.$id;
162  }
163  }
164 
165  if(count($lists))
166  {
167  $mail_data = $this->umail->appendSearchResult($lists, 'to');
168  $this->umail->savePostData(
169  $mail_data['user_id'],
170  $mail_data['attachments'],
171  $mail_data['rcp_to'],
172  $mail_data['rcp_cc'],
173  $mail_data['rcp_bcc'],
174  $mail_data['m_type'],
175  $mail_data['m_email'],
176  $mail_data['m_subject'],
177  $mail_data['m_message'],
178  $mail_data['use_placeholders']
179  );
180  }
181 
182  ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
183 
184  return true;
185  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static _isOwner($a_ml_id, $a_usr_id)
$_POST['username']
Definition: cron.php:12
$_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 98 of file class.ilMailingListsGUI.php.

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

99  {
100  global $ilUser;
101 
102  if (is_array($_POST['ml_id']))
103  {
104  $counter = 0;
105  foreach ($_POST['ml_id'] as $id)
106  {
107  if(ilMailingList::_isOwner($id, $ilUser->getId()))
108  {
109  $this->mlists->get(ilUtil::stripSlashes($id))->delete();
110  ++$counter;
111  }
112  }
113  if($counter)
114  ilUtil::sendInfo($this->lng->txt('mail_deleted_entry'));
115  }
116  else
117  {
118  ilUtil::sendInfo($this->lng->txt('mail_delete_error'));
119  }
120 
121  $this->showMailingLists();
122 
123  return true;
124  }
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 521 of file class.ilMailingListsGUI.php.

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

522  {
523  global $ilUser, $ilErr;
524 
525  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
526  {
527  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
528  }
529 
530  if (is_array($_POST['a_id']))
531  {
532  foreach ($_POST['a_id'] as $id)
533  {
534  $this->mlists->getCurrentMailingList()->deassignAddressbookEntry(ilUtil::stripSlashes($id));
535  }
536 
537  ilUtil::sendInfo($this->lng->txt('mail_deleted_entry'));
538  }
539  else
540  {
541  ilUtil::sendInfo($this->lng->txt('mail_delete_error'));
542  }
543 
544  $this->showMembersList();
545 
546  return true;
547  }
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:

◆ saveAssignmentForm()

ilMailingListsGUI::saveAssignmentForm ( )

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

References $_POST, $error, $ilErr, $ilUser, ilMailingList\_isOwner(), getError(), isError(), ilUtil\sendInfo(), setError(), showAssignmentForm(), showMembersList(), and ilUtil\stripSlashes().

550  {
551  global $ilUser, $ilErr;
552 
553  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
554  {
555  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
556  }
557 
558  if ($_POST['addr_id'] == '') $this->setError($this->lng->txt('mail_entry_of_addressbook'));
559 
560  if (!$this->isError())
561  {
562  $found = false;
563 
564  $all_entries = $this->abook->getEntries();
565  if ((int)count($all_entries))
566  {
567  foreach ($all_entries as $entry)
568  {
569  if($entry['addr_id'] == $_POST['addr_id'])
570  {
571  $found = true;
572  break;
573  }
574  }
575  }
576 
577  if($found)
578  {
579  $this->mlists->getCurrentMailingList()->assignAddressbookEntry(ilUtil::stripSlashes($_POST['addr_id']));
580 
581  ilUtil::sendInfo($this->lng->txt('saved_successfully'));
582  }
583 
584  $this->showMembersList();
585  }
586  else
587  {
588  $mandatory = '';
589 
590  while ($error = $this->getError())
591  {
592  $mandatory .= $error;
593  if ($this->isError()) $mandatory .= ', ';
594  }
595 
596  ilUtil::sendInfo($this->lng->txt('fill_out_all_required_fields') . ': ' . $mandatory);
597 
598  $this->showAssignmentForm();
599  }
600 
601  return true;
602  }
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:

◆ saveForm()

ilMailingListsGUI::saveForm ( )

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

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

301  {
302  if($this->mlists->getCurrentMailingList()->getId())
303  {
304  global $ilUser, $ilErr;
305 
306  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
307  {
308  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
309  }
310 
311  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
312  $this->initForm('edit');
313  }
314  else
315  {
316  $this->initForm();
317  }
318 
319  if($this->form_gui->checkInput())
320  {
321  $this->mlists->getCurrentMailingList()->setTitle($_POST['title']);
322  $this->mlists->getCurrentMailingList()->setDescription($_POST['description']);
323  if($this->mlists->getCurrentMailingList()->getId())
324  {
325  $this->mlists->getCurrentMailingList()->setChangedate(date('Y-m-d H:i:s', time()));
326  $this->mlists->getCurrentMailingList()->update();
327  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
328  }
329  else
330  {
331  $this->mlists->getCurrentMailingList()->setCreatedate(date('Y-m-d H:i:s', time()));
332  $this->mlists->getCurrentMailingList()->insert();
333  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
334  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
335 
336  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
337  $this->ctrl->redirect($this,'showMembersList');
338 
339  exit;
340  }
341  }
342 
343  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
344  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_form.html', 'Services/Contact');
345 
346  $this->form_gui->setValuesByPost();
347 
348  $this->tpl->setVariable('FORM', $this->form_gui->getHTML());
349  return $this->tpl->show();
350  }
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 381 of file class.ilMailingListsGUI.php.

Referenced by showForm().

382  {
383  $this->form_gui->setValuesByArray(array(
384  'title' => '',
385  'description' => ''
386  ));
387  }
+ Here is the caller graph for this function:

◆ setError()

ilMailingListsGUI::setError (   $a_error = '')

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

Referenced by saveAssignmentForm().

682  {
683  return $this->error[] = $a_error;
684  }
+ Here is the caller graph for this function:

◆ setValuesByObject()

ilMailingListsGUI::setValuesByObject ( )
private

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

Referenced by showForm().

374  {
375  $this->form_gui->setValuesByArray(array(
376  'title' => $this->mlists->getCurrentMailingList()->getTitle(),
377  'description' => $this->mlists->getCurrentMailingList()->getDescription()
378  ));
379  }
+ Here is the caller graph for this function:

◆ showAssignmentForm()

ilMailingListsGUI::showAssignmentForm ( )

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

References $ilErr, $ilUser, $options, ilMailingList\_isOwner(), ilUtil\sendInfo(), ilSelectInputGUI\setOptions(), and showMembersList().

Referenced by saveAssignmentForm().

605  {
606  global $ilUser, $ilErr;
607 
608  if (!$this->mlists->getCurrentMailingList()->getId())
609  {
610  $this->showMembersList();
611 
612  return true;
613  }
614 
615  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
616  {
617  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
618  }
619 
620  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
621  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members_form.html', 'Services/Contact');
622 
623  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
624 
625  $form = new ilPropertyFormGUI();
626  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
627  $form->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
628  $form->setTitle($this->lng->txt('mail_assign_entry_to_mailing_list') . ' ' . $this->mlists->getCurrentMailingList()->getTitle());
629 
630  $options = array();
631  $options[''] = $this->lng->txt('please_select');
632 
633  $all_entries = $this->abook->getEntries();
634  if ((int)count($all_entries))
635  {
636  foreach ($all_entries as $entry)
637  {
638  $options[$entry['addr_id']] = ($entry['login'] != '' ? $entry['login'] : $entry['email']);
639  }
640  }
641 
642  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
643  if ((int)count($assigned_entries))
644  {
645  foreach ($assigned_entries as $assigned_entry)
646  {
647  if (is_array($options) && array_key_exists($assigned_entry['addr_id'], $options))
648  {
649  unset($options[$assigned_entry['addr_id']]);
650  }
651  }
652  }
653 
654  if (count($options) > 1)
655  {
656  $formItem = new ilSelectInputGUI($this->lng->txt('mail_entry_of_addressbook'), 'addr_id');
657  $formItem->setOptions($options);
658  $formItem->setValue($this->mlists->getCurrentMailingList()->getTitle());
659  $form->addItem($formItem);
660 
661  $form->addCommandButton('saveAssignmentForm',$this->lng->txt('assign'));
662  }
663  else if(count($options) == 1 && (int)count($all_entries))
664  {
665  ilUtil::sendInfo($this->lng->txt('mail_mailing_lists_all_addressbook_entries_assigned'));
666  }
667  else if(!(int)count($all_entries))
668  {
669  ilUtil::sendInfo($this->lng->txt('mail_mailing_lists_no_addressbook_entries'));
670  }
671 
672 
673  $form->addCommandButton('showMembersList',$this->lng->txt('cancel'));
674 
675  $this->tpl->setVariable('FORM', $form->getHTML());
676  $this->tpl->show();
677 
678  return true;
679  }
static _isOwner($a_ml_id, $a_usr_id)
This class represents a selection list property in a property form.
This class represents a property form user interface.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!is_array($argv)) $options
setOptions($a_options)
Set Options.
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 389 of file class.ilMailingListsGUI.php.

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

390  {
391  global $ilUser, $ilErr;
392 
393  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
394  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_form.html', 'Services/Contact');
395 
396  if($this->mlists->getCurrentMailingList()->getId())
397  {
398  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
399  {
400  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
401  }
402 
403  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
404  $this->initForm('edit');
405  $this->setValuesByObject();
406  }
407  else
408  {
409  $this->initForm();
410  $this->setDefaultValues();
411  }
412 
413  $this->tpl->setVariable('FORM', $this->form_gui->getHTML());
414  return $this->tpl->show();
415  }
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 187 of file class.ilMailingListsGUI.php.

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

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

188  {
189  global $rbacsystem;
190 
191  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
192  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_list.html', 'Services/Contact');
193 
194  // check if current user may send mails
195  include_once "Services/Mail/classes/class.ilMail.php";
196  $mail = new ilMail($_SESSION["AccountId"]);
197  $mailing_allowed = $rbacsystem->checkAccess('internal_mail',$mail->getMailObjectReferenceId());
198 
199  $tbl = new ilTable2GUI($this);
200  $tbl->setId('show_mlng_lists_tbl');
201  $tbl->setFormAction($this->ctrl->getFormAction($this), 'showForm');
202  $tbl->setTitle($this->lng->txt('mail_mailing_lists'));
203  $tbl->setRowTemplate('tpl.mail_mailing_lists_listrow.html', 'Services/Contact');
204 
205  $tbl->setDefaultOrderField('title');
206 
207  $result = array();
208 
209  $tbl->addColumn('', 'check', '10%', true);
210  $tbl->addColumn($this->lng->txt('title'), 'title', '30%');
211  $tbl->addColumn($this->lng->txt('description'), 'description', '30%');
212  $tbl->addColumn($this->lng->txt('members'), 'members', '20%');
213  $tbl->addColumn($this->lng->txt('actions'), '', '10%');
214 
215  $entries = $this->mlists->getAll();
216  if (count($entries))
217  {
218  $tbl->enable('select_all');
219  $tbl->setSelectAllCheckbox('ml_id');
220 
221  $counter = 0;
222 
223  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
224 
225  foreach ($entries as $entry)
226  {
227  if($entry->getMode() == ilMailingList::MODE_TEMPORARY)
228  {
229  continue;
230  }
231 
232  $result[$counter]['check'] = ilUtil::formCheckbox(0, 'ml_id[]', $entry->getId());
233  $result[$counter]['title'] = $entry->getTitle() . " [#il_ml_" . $entry->getId() . "]";
234  $result[$counter]['description'] = $entry->getDescription();
235  $result[$counter]['members'] = count($entry->getAssignedEntries());
236 
237  $this->ctrl->setParameter($this, 'ml_id', $entry->getId());
238  //$result[$counter]['edit_text'] = $this->lng->txt("edit");
239  //$result[$counter]['edit_url'] = $this->ctrl->getLinkTarget($this, "showForm");
240  //$result[$counter]['members_text'] = $this->lng->txt("members");
241  //$result[$counter]['members_url'] = $this->ctrl->getLinkTarget($this, "showMembersList");
242 
243  $current_selection_list = new ilAdvancedSelectionListGUI();
244  $current_selection_list->setListTitle($this->lng->txt("actions"));
245  $current_selection_list->setId("act_".$counter);
246 
247  $current_selection_list->addItem($this->lng->txt("edit"), '', $this->ctrl->getLinkTarget($this, "showForm"));
248  $current_selection_list->addItem($this->lng->txt("members"), '', $this->ctrl->getLinkTarget($this, "showMembersList"));
249  if ($mailing_allowed)
250  $current_selection_list->addItem($this->lng->txt("send_mail_to"), '', $this->ctrl->getLinkTarget($this, "mailToList"));
251  $current_selection_list->addItem($this->lng->txt("delete"), '', $this->ctrl->getLinkTarget($this, "confirmDelete"));
252 
253  $result[$counter]['COMMAND_SELECTION_LIST'] = $current_selection_list->getHTML();
254 
255  ++$counter;
256  }
257 
258  if ($mailing_allowed)
259  $tbl->addMultiCommand('mailToList', $this->lng->txt('send_mail_to'));
260  $tbl->addMultiCommand('confirmDelete', $this->lng->txt('delete'));
261  }
262  else
263  {
264  $tbl->disable('header');
265  $tbl->disable('footer');
266 
267  $tbl->setNoEntriesText($this->lng->txt('mail_search_no'));
268  }
269 
270  $tbl->setData($result);
271 
272  $tbl->addCommandButton('showForm', $this->lng->txt('add'));
273 
274  if(isset($_GET['ref']) && $_GET['ref'] == 'mail')
275  {
276  $tbl->addCommandButton('cancel', $this->lng->txt('cancel'));
277  }
278 
279  $this->tpl->setVariable('MAILING_LISTS', $tbl->getHTML());
280  $this->tpl->show();
281 
282  return true;
283  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$result
$_GET["client_id"]
Class ilTable2GUI.
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 417 of file class.ilMailingListsGUI.php.

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

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

418  {
419  if (!$this->mlists->getCurrentMailingList()->getId())
420  {
421  $this->showMailingLists();
422 
423  return true;
424  }
425 
426  $this->ctrl->setParameter($this, 'cmd', 'post');
427  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
428 
429  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
430  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members.html', 'Services/Contact');
431 
432  $tbl = new ilTable2GUI($this);
433  $tbl->setId('show_mlng_mmbrs_list_tbl');
434  $tbl->setFormAction($this->ctrl->getFormAction($this), 'showMemberForm');
435  $tbl->setTitle($this->lng->txt('mail_members_of_mailing_list') . ' ' .$this->mlists->getCurrentMailingList()->getTitle());
436  $tbl->setRowTemplate('tpl.mail_mailing_lists_membersrow.html', 'Services/Contact');
437 
438  $this->ctrl->setParameter($this, 'cmd', 'showMembersList');
439 
440  $tbl->setDefaultOrderField('title');
441 
442  $result = array();
443 
444  $tbl->addColumn('', 'check', '10%');
445  $tbl->addColumn($this->lng->txt('title'), 'title', '90%');
446 
447  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
448  if (count($assigned_entries))
449  {
450  $tbl->enable('select_all');
451  $tbl->setSelectAllCheckbox('a_id');
452 
453  $counter = 0;
454  foreach ($assigned_entries as $entry)
455  {
456  $result[$counter]['check'] = ilUtil::formCheckbox(0, 'a_id[]', $entry['a_id']);
457  $result[$counter]['title'] = ($entry['login'] != '' ? $entry['login'] : $entry['email']);
458 
459  ++$counter;
460  }
461 
462  $tbl->addMultiCommand('confirmDeleteMembers', $this->lng->txt('delete'));
463  }
464  else
465  {
466  $tbl->disable('header');
467  $tbl->disable('footer');
468 
469  $tbl->setNoEntriesText($this->lng->txt('mail_search_no'));
470  }
471 
472  $tbl->setData($result);
473 
474  $tbl->addCommandButton('showAssignmentForm', $this->lng->txt('add'));
475  $tbl->addCommandButton('showMailingLists', $this->lng->txt('back'));
476 
477  $this->tpl->setVariable('MEMBERS_LIST', $tbl->getHTML());
478  $this->tpl->show();
479 
480  return true;
481  }
$result
Class ilTable2GUI.
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

◆ $abook

ilMailingListsGUI::$abook = null
private

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

◆ $ctrl

ilMailingListsGUI::$ctrl = null
private

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

◆ $error

ilMailingListsGUI::$error = array()
private

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

Referenced by saveAssignmentForm().

◆ $form_gui

ilMailingListsGUI::$form_gui = null
private

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

◆ $lng

ilMailingListsGUI::$lng = null
private

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

Referenced by __construct().

◆ $mlists

ilMailingListsGUI::$mlists = null
private

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

◆ $tpl

ilMailingListsGUI::$tpl = null
private

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

Referenced by __construct().

◆ $umail

ilMailingListsGUI::$umail = null
private

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


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