ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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.

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.
Class UserMail this class handles user mails.
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15

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

Member Function Documentation

◆ cancel()

ilMailingListsGUI::cancel ( )

Cancel action.

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

268 {
269 if(isset($_GET['ref']) && $_GET['ref'] == 'mail')
270 {
271 $this->ctrl->returnToParent($this);
272 }
273 else
274 {
275 $this->showMailingLists();
276 }
277 }

References $_GET, and showMailingLists().

+ Here is the call graph for this function:

◆ confirmDelete()

ilMailingListsGUI::confirmDelete ( )

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

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 }
Confirmation screen class.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST['username']
Definition: cron.php:12

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

+ Here is the call graph for this function:

◆ confirmDeleteMembers()

ilMailingListsGUI::confirmDeleteMembers ( )

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

447 {
448 if (!isset($_POST['a_id']))
449 {
450 ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
451 $this->showMembersList();
452 return true;
453 }
454
455 include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
456 $c_gui = new ilConfirmationGUI();
457 $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
458 $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteMembers'));
459 $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
460 $c_gui->setCancel($this->lng->txt('cancel'), 'showMembersList');
461 $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteMembers');
462
463 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
464 if (is_array($assigned_entries))
465 {
466 foreach ($assigned_entries as $entry)
467 {
468 if (in_array($entry['a_id'], $_POST['a_id']))
469 {
470 $c_gui->addItem('a_id[]', $entry['a_id'], ($entry['login'] != '' ? $entry['login'] : $entry['email']));
471 }
472 }
473 }
474
475 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
476 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members.html', 'Services/Contact');
477 $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
478
479 $this->tpl->show();
480
481 return true;
482 }

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

+ Here is the call graph for this function:

◆ executeCommand()

ilMailingListsGUI::executeCommand ( )

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

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

References $cmd.

◆ getError()

ilMailingListsGUI::getError ( )

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

649 {
650 return array_pop($this->error);
651 }
error($a_errmsg)
set error message @access public

References error().

Referenced by saveAssignmentForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

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

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

332 {
333 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
334 $this->form_gui = new ilPropertyFormGUI();
335
336 $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
337 $this->form_gui->setTitle($this->lng->txt('mail_mailing_list'));
338
339 $titleGui = new ilTextInputGUI($this->lng->txt('title'), 'title');
340 $titleGui->setRequired(true);
341 $this->form_gui->addItem($titleGui);
342
343 $descriptionGui = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
344 $descriptionGui->setCols(40);
345 $descriptionGui->setRows(8);
346 $this->form_gui->addItem($descriptionGui);
347
348 $this->form_gui->addCommandButton('saveForm',$this->lng->txt('save'));
349 $this->form_gui->addCommandButton('showMailingLists',$this->lng->txt('cancel'));
350 }
This class represents a property form user interface.
This class represents a text area property in a property form.
This class represents a text property in a property form.

Referenced by saveForm(), and showForm().

+ Here is the caller graph for this function:

◆ isError()

ilMailingListsGUI::isError ( )

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

653 {
654 if (is_array($this->error) && !empty($this->error)) return true;
655
656 return false;
657 }

References error().

Referenced by saveAssignmentForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mailToList()

ilMailingListsGUI::mailToList ( )

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

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 }
Class Mail this class handles base functions for mail handling.
static _isOwner($a_ml_id, $a_usr_id)
static redirect($a_script)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
< 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']

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

+ Here is the call graph for this function:

◆ performDelete()

ilMailingListsGUI::performDelete ( )

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

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 stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

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

+ Here is the call graph for this function:

◆ performDeleteMembers()

ilMailingListsGUI::performDeleteMembers ( )

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

485 {
486 global $ilUser, $ilErr;
487
488 if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
489 {
490 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
491 }
492
493 if (is_array($_POST['a_id']))
494 {
495 foreach ($_POST['a_id'] as $id)
496 {
497 $this->mlists->getCurrentMailingList()->deassignAddressbookEntry(ilUtil::stripSlashes($id));
498 }
499
500 ilUtil::sendInfo($this->lng->txt('mail_deleted_entry'));
501 }
502 else
503 {
504 ilUtil::sendInfo($this->lng->txt('mail_delete_error'));
505 }
506
507 $this->showMembersList();
508
509 return true;
510 }

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

+ Here is the call graph for this function:

◆ saveAssignmentForm()

ilMailingListsGUI::saveAssignmentForm ( )

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

513 {
514 global $ilUser, $ilErr;
515
516 if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
517 {
518 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
519 }
520
521 if ($_POST['addr_id'] == '') $this->setError($this->lng->txt('mail_entry_of_addressbook'));
522
523 if (!$this->isError())
524 {
525 $found = false;
526
527 $all_entries = $this->abook->getEntries();
528 if ((int)count($all_entries))
529 {
530 foreach ($all_entries as $entry)
531 {
532 if($entry['addr_id'] == $_POST['addr_id'])
533 {
534 $found = true;
535 break;
536 }
537 }
538 }
539
540 if($found)
541 {
542 $this->mlists->getCurrentMailingList()->assignAddressbookEntry(ilUtil::stripSlashes($_POST['addr_id']));
543
544 ilUtil::sendInfo($this->lng->txt('saved_successfully'));
545 }
546
547 $this->showMembersList();
548 }
549 else
550 {
551 $mandatory = '';
552
553 while ($error = $this->getError())
554 {
555 $mandatory .= $error;
556 if ($this->isError()) $mandatory .= ', ';
557 }
558
559 ilUtil::sendInfo($this->lng->txt('fill_out_all_required_fields') . ': ' . $mandatory);
560
561 $this->showAssignmentForm();
562 }
563
564 return true;
565 }

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

+ Here is the call graph for this function:

◆ saveForm()

ilMailingListsGUI::saveForm ( )

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

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

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

+ Here is the call graph for this function:

◆ setDefaultValues()

ilMailingListsGUI::setDefaultValues ( )
private

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

361 {
362 $this->form_gui->setValuesByArray(array(
363 'title' => '',
364 'description' => ''
365 ));
366 }

Referenced by showForm().

+ Here is the caller graph for this function:

◆ setError()

ilMailingListsGUI::setError (   $a_error = '')

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

645 {
646 return $this->error[] = $a_error;
647 }

References error().

Referenced by saveAssignmentForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValuesByObject()

ilMailingListsGUI::setValuesByObject ( )
private

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

353 {
354 $this->form_gui->setValuesByArray(array(
355 'title' => $this->mlists->getCurrentMailingList()->getTitle(),
356 'description' => $this->mlists->getCurrentMailingList()->getDescription()
357 ));
358 }

Referenced by showForm().

+ Here is the caller graph for this function:

◆ showAssignmentForm()

ilMailingListsGUI::showAssignmentForm ( )

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

568 {
569 global $ilUser, $ilErr;
570
571 if (!$this->mlists->getCurrentMailingList()->getId())
572 {
573 $this->showMembersList();
574
575 return true;
576 }
577
578 if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
579 {
580 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
581 }
582
583 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
584 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members_form.html', 'Services/Contact');
585
586 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
587
588 $form = new ilPropertyFormGUI();
589 $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
590 $form->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
591 $form->setTitle($this->lng->txt('mail_assign_entry_to_mailing_list') . ' ' . $this->mlists->getCurrentMailingList()->getTitle());
592
593 $options = array();
594 $options[''] = $this->lng->txt('please_select');
595
596 $all_entries = $this->abook->getEntries();
597 if ((int)count($all_entries))
598 {
599 foreach ($all_entries as $entry)
600 {
601 $options[$entry['addr_id']] = ($entry['login'] != '' ? $entry['login'] : $entry['email']);
602 }
603 }
604
605 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
606 if ((int)count($assigned_entries))
607 {
608 foreach ($assigned_entries as $assigned_entry)
609 {
610 if (is_array($options) && array_key_exists($assigned_entry['addr_id'], $options))
611 {
612 unset($options[$assigned_entry['addr_id']]);
613 }
614 }
615 }
616
617 if (count($options) > 1)
618 {
619 $formItem = new ilSelectInputGUI($this->lng->txt('mail_entry_of_addressbook'), 'addr_id');
620 $formItem->setOptions($options);
621 $formItem->setValue($this->mlists->getCurrentMailingList()->getTitle());
622 $form->addItem($formItem);
623
624 $form->addCommandButton('saveAssignmentForm',$this->lng->txt('assign'));
625 }
626 else if(count($options) == 1 && (int)count($all_entries))
627 {
628 ilUtil::sendInfo($this->lng->txt('mail_mailing_lists_all_addressbook_entries_assigned'));
629 }
630 else if(!(int)count($all_entries))
631 {
632 ilUtil::sendInfo($this->lng->txt('mail_mailing_lists_no_addressbook_entries'));
633 }
634
635
636 $form->addCommandButton('showMembersList',$this->lng->txt('cancel'));
637
638 $this->tpl->setVariable('FORM', $form->getHTML());
639 $this->tpl->show();
640
641 return true;
642 }
This class represents a selection list property in a property form.
if(!is_array($argv)) $options

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

Referenced by saveAssignmentForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showForm()

ilMailingListsGUI::showForm ( )

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

369 {
370 global $ilUser, $ilErr;
371
372 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
373 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_form.html', 'Services/Contact');
374
375 if($this->mlists->getCurrentMailingList()->getId())
376 {
377 if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
378 {
379 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
380 }
381
382 $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
383 $this->initForm('edit');
384 $this->setValuesByObject();
385 }
386 else
387 {
388 $this->initForm();
389 $this->setDefaultValues();
390 }
391
392 $this->tpl->setVariable('FORM', $this->form_gui->getHTML());
393 return $this->tpl->show();
394 }

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

+ Here is the call graph for this function:

◆ showMailingLists()

ilMailingListsGUI::showMailingLists ( )

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

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 require_once 'Services/Contact/classes/class.ilMailingListsTableGUI.php';
200 $tbl = new ilMailingListsTableGUI($this, 'showMailingLists');
201
202 $result = array();
203 $entries = $this->mlists->getAll();
204 if(count($entries))
205 {
206 $tbl->enable('select_all');
207 $counter = 0;
208 require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
209
210 foreach($entries as $entry)
211 {
212 if($entry->getMode() == ilMailingList::MODE_TEMPORARY)
213 {
214 continue;
215 }
216
217 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'ml_id[]', $entry->getId());
218 $result[$counter]['title'] = $entry->getTitle() . " [#il_ml_" . $entry->getId() . "]";
219 $result[$counter]['description'] = $entry->getDescription();
220 $result[$counter]['members'] = count($entry->getAssignedEntries());
221
222 $this->ctrl->setParameter($this, 'ml_id', $entry->getId());
223
224 $current_selection_list = new ilAdvancedSelectionListGUI();
225 $current_selection_list->setListTitle($this->lng->txt("actions"));
226 $current_selection_list->setId("act_".$counter);
227
228 $current_selection_list->addItem($this->lng->txt("edit"), '', $this->ctrl->getLinkTarget($this, "showForm"));
229 $current_selection_list->addItem($this->lng->txt("members"), '', $this->ctrl->getLinkTarget($this, "showMembersList"));
230 if($mailing_allowed)
231 {
232 $current_selection_list->addItem($this->lng->txt("send_mail_to"), '', $this->ctrl->getLinkTarget($this, "mailToList"));
233 }
234 $current_selection_list->addItem($this->lng->txt("delete"), '', $this->ctrl->getLinkTarget($this, "confirmDelete"));
235
236 $result[$counter]['COMMAND_SELECTION_LIST'] = $current_selection_list->getHTML();
237 ++$counter;
238 }
239
240 if($mailing_allowed)
241 {
242 $tbl->addMultiCommand('mailToList', $this->lng->txt('send_mail_to'));
243 }
244 $tbl->addMultiCommand('confirmDelete', $this->lng->txt('delete'));
245 }
246 else
247 {
248 $tbl->disable('header');
249 $tbl->disable('footer');
250 }
251
252 $tbl->setData($result);
253
254 if(isset($_GET['ref']) && $_GET['ref'] == 'mail')
255 {
256 $tbl->addCommandButton('cancel', $this->lng->txt('cancel'));
257 }
258
259 $this->tpl->setVariable('MAILING_LISTS', $tbl->getHTML());
260 $this->tpl->show();
261 return true;
262 }
$result
User interface class for advanced drop-down selection lists.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMembersList()

ilMailingListsGUI::showMembersList ( )

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

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

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

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

+ 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: