ILIAS  release_8 Revision v8.24
ilMailingListsGUI Class Reference
+ Collaboration diagram for ilMailingListsGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 confirmDelete ()
 
 performDelete ()
 
 mailToList ()
 
 showMailingLists ()
 
 cancel ()
 
 saveForm ()
 
 showForm ()
 
 showMembersList ()
 
 confirmDeleteMembers ()
 
 performDeleteMembers ()
 
 saveAssignmentForm ()
 
 showAssignmentForm (?ilPropertyFormGUI $form=null)
 

Private Member Functions

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

Private Attributes

ILIAS HTTP GlobalHttpState $http
 
Refinery $refinery
 
ilGlobalTemplateInterface $tpl
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilObjUser $user
 
ilErrorHandling $error
 
ilToolbarGUI $toolbar
 
ilRbacSystem $rbacsystem
 
ilFormatMail $umail
 
ilMailingLists $mlists
 
ilPropertyFormGUI $form_gui
 

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

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

Constructor & Destructor Documentation

◆ __construct()

ilMailingListsGUI::__construct ( )

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

43 {
44 global $DIC;
45
46 $this->tpl = $DIC->ui()->mainTemplate();
47 $this->ctrl = $DIC['ilCtrl'];
48 $this->lng = $DIC['lng'];
49 $this->rbacsystem = $DIC['rbacsystem'];
50 $this->user = $DIC['ilUser'];
51 $this->error = $DIC['ilErr'];
52 $this->toolbar = $DIC['ilToolbar'];
53 $this->http = $DIC->http();
54 $this->refinery = $DIC->refinery();
55
56 $this->umail = new ilFormatMail($this->user->getId());
57 $this->mlists = new ilMailingLists($this->user);
58 $this->mlists->setCurrentMailingList(
59 $this->http->wrapper()->query()->has('ml_id')
60 ? $this->http->wrapper()->query()->retrieve('ml_id', $this->refinery->kindlyTo()->int())
61 : 0
62 );
63
64 $this->ctrl->saveParameter($this, 'mobj_id');
65 $this->ctrl->saveParameter($this, 'ref');
66 }
error(string $a_errmsg)
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.

References $DIC, ILIAS\Repository\ctrl(), error(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ cancel()

ilMailingListsGUI::cancel ( )

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

315 : void
316 {
317 if (
318 $this->http->wrapper()->query()->has('ref') &&
319 $this->http->wrapper()->query()->retrieve('ref', $this->refinery->kindlyTo()->string()) === 'mail') {
320 $this->ctrl->returnToParent($this);
321 }
322
323 $this->showMailingLists();
324 }

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), and showMailingLists().

+ Here is the call graph for this function:

◆ confirmDelete()

ilMailingListsGUI::confirmDelete ( )

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

118 : bool
119 {
120 $ml_ids = $this->getMailingListIdsFromRequest();
121 if ($ml_ids === []) {
122 $this->tpl->setOnScreenMessage('info', $this->lng->txt('mail_select_one_entry'));
123 $this->showMailingLists();
124 return true;
125 }
126
127 $c_gui = new ilConfirmationGUI();
128
129 $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDelete'));
130 $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
131 $c_gui->setCancel($this->lng->txt('cancel'), 'showMailingLists');
132 $c_gui->setConfirm($this->lng->txt('confirm'), 'performDelete');
133
134 $entries = $this->mlists->getSelected($ml_ids);
135 foreach ($entries as $entry) {
136 $c_gui->addItem('ml_id[]', (string) $entry->getId(), $entry->getTitle());
137 }
138
139 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
140 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_list.html', 'Services/Contact');
141 $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
142
143 $this->tpl->printToStdout();
144
145 return true;
146 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), getMailingListIdsFromRequest(), ILIAS\Repository\lng(), and showMailingLists().

+ Here is the call graph for this function:

◆ confirmDeleteMembers()

ilMailingListsGUI::confirmDeleteMembers ( )

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

501 : bool
502 {
503 if (!$this->http->wrapper()->post()->has('a_id')) {
504 $this->tpl->setOnScreenMessage('info', $this->lng->txt('mail_select_one_entry'));
505 $this->showMembersList();
506 return true;
507 }
508
509 $c_gui = new ilConfirmationGUI();
510 $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
511 $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteMembers'));
512 $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
513 $c_gui->setCancel($this->lng->txt('cancel'), 'showMembersList');
514 $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteMembers');
515
516 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
517
518 $usr_ids = [];
519 foreach ($assigned_entries as $entry) {
520 $usr_ids[] = $entry['usr_id'];
521 }
522
523 $names = ilUserUtil::getNamePresentation($usr_ids, false, false, '', false, false, false);
524
525 $requested_entry_ids = $this->http->wrapper()->post()->retrieve(
526 'a_id',
527 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
528 );
529
530 foreach ($assigned_entries as $entry) {
531 if (in_array($entry['a_id'], $requested_entry_ids, true)) {
532 $c_gui->addItem('a_id[]', (string) $entry['a_id'], $names[$entry['usr_id']]);
533 }
534 }
535
536 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
537 $this->tpl->addBlockFile(
538 'ADM_CONTENT',
539 'adm_content',
540 'tpl.mail_mailing_lists_members.html',
541 'Services/Contact'
542 );
543 $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
544
545 $this->tpl->printToStdout();
546 return true;
547 }
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:

References ILIAS\Repository\ctrl(), ilUserUtil\getNamePresentation(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and showMembersList().

+ Here is the call graph for this function:

◆ executeCommand()

ilMailingListsGUI::executeCommand ( )

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

68 : bool
69 {
70 if (
71 !ilBuddySystem::getInstance()->isEnabled() ||
72 (
73 0 === count(ilBuddyList::getInstanceByGlobalUser()->getLinkedRelations()) &&
74 !$this->mlists->hasAny()
75 )
76 ) {
77 $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
78 }
79
80 $forward_class = $this->ctrl->getNextClass($this);
81
82 switch ($forward_class) {
83 default:
84 if (!($cmd = $this->ctrl->getCmd())) {
85 $cmd = 'showMailingLists';
86 }
87
88 $this->$cmd();
89 break;
90 }
91
92
93 return true;
94 }
static getInstanceByGlobalUser()

References ILIAS\Repository\ctrl(), error(), ilBuddySystem\getInstance(), ilBuddyList\getInstanceByGlobalUser(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getMailingListIdsFromRequest()

ilMailingListsGUI::getMailingListIdsFromRequest ( )
private
Returns
int[]

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

99 : array
100 {
101 $ml_ids = [];
102 if ($this->http->wrapper()->query()->has('ml_id')) {
103 $ml_ids = [
104 $this->http->wrapper()->query()->retrieve('ml_id', $this->refinery->kindlyTo()->int())
105 ];
106 } elseif ($this->http->wrapper()->post()->has('ml_id')) {
107 $ml_ids = $this->http->wrapper()->post()->retrieve(
108 'ml_id',
109 $this->refinery->kindlyTo()->listOf(
110 $this->refinery->kindlyTo()->int()
111 )
112 );
113 }
114
115 return array_filter($ml_ids);
116 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by confirmDelete(), and mailToList().

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

◆ initForm()

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

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

367 : void
368 {
369 $this->form_gui = new ilPropertyFormGUI();
370
371 $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
372 $this->form_gui->setTitle($this->lng->txt('mail_mailing_list'));
373
374 $titleGui = new ilTextInputGUI($this->lng->txt('title'), 'title');
375 $titleGui->setRequired(true);
376 $this->form_gui->addItem($titleGui);
377
378 $descriptionGui = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
379 $descriptionGui->setCols(40);
380 $descriptionGui->setRows(8);
381 $this->form_gui->addItem($descriptionGui);
382
383 $this->form_gui->addCommandButton('saveForm', $this->lng->txt('save'));
384 $this->form_gui->addCommandButton('showMailingLists', $this->lng->txt('cancel'));
385 }
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.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by saveForm(), and showForm().

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

◆ mailToList()

ilMailingListsGUI::mailToList ( )

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

180 : bool
181 {
182 // check if current user may send mails
183 $mail = new ilMail($this->user->getId());
184 $mailing_allowed = $this->rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
185
186 if (!$mailing_allowed) {
187 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_permission'));
188 return true;
189 }
190
191 $ml_ids = $this->getMailingListIdsFromRequest();
192 if ($ml_ids === []) {
193 $this->tpl->setOnScreenMessage('info', $this->lng->txt('mail_select_one_entry'));
194 $this->showMailingLists();
195 return true;
196 }
197
198 $mail_data = $this->umail->retrieveFromStage();
199 $lists = [];
200 foreach ($ml_ids as $id) {
201 if ($this->mlists->isOwner($id, $this->user->getId()) &&
202 !$this->umail->existsRecipient('#il_ml_' . $id, (string) $mail_data['rcp_to'])) {
203 $lists['#il_ml_' . $id] = '#il_ml_' . $id;
204 }
205 }
206
207 if (count($lists)) {
208 $mail_data = $this->umail->appendSearchResult(array_values($lists), 'to');
209 $this->umail->persistToStage(
210 (int) $mail_data['user_id'],
211 $mail_data['attachments'],
212 $mail_data['rcp_to'],
213 $mail_data['rcp_cc'],
214 $mail_data['rcp_bcc'],
215 $mail_data['m_subject'],
216 $mail_data['m_message'],
217 $mail_data['use_placeholders'],
218 $mail_data['tpl_ctx_id'],
219 $mail_data['tpl_ctx_params']
220 );
221 }
222
223 ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
224
225 return true;
226 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static redirect(string $a_script)

References $id, getMailingListIdsFromRequest(), ILIAS\Repository\lng(), ilUtil\redirect(), showMailingLists(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ performDelete()

ilMailingListsGUI::performDelete ( )

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

148 : bool
149 {
150 if ($this->http->wrapper()->post()->has('ml_id')) {
151 $ml_ids = array_filter(
152 $this->http->wrapper()->post()->retrieve(
153 'ml_id',
154 $this->refinery->kindlyTo()->listOf(
155 $this->refinery->kindlyTo()->int()
156 )
157 )
158 );
159
160 $counter = 0;
161 foreach ($ml_ids as $id) {
162 if ($this->mlists->isOwner($id, $this->user->getId())) {
163 $this->mlists->get($id)->delete();
164 ++$counter;
165 }
166 }
167
168 if ($counter) {
169 $this->tpl->setOnScreenMessage('success', $this->lng->txt('mail_deleted_entry'));
170 }
171 } else {
172 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('mail_delete_error'));
173 }
174
175 $this->showMailingLists();
176
177 return true;
178 }

References $id, ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and showMailingLists().

+ Here is the call graph for this function:

◆ performDeleteMembers()

ilMailingListsGUI::performDeleteMembers ( )

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

549 : bool
550 {
551 if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
552 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
553 }
554
555 if (
556 $this->http->wrapper()->post()->has('a_id') &&
557 ($requested_entry_ids = $this->http->wrapper()->post()->retrieve(
558 'a_id',
559 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
560 )) !== []
561 ) {
562 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
563 foreach ($requested_entry_ids as $id) {
564 if (isset($assigned_entries[$id])) {
565 $this->mlists->getCurrentMailingList()->deleteEntry($id);
566 }
567 }
568 $this->tpl->setOnScreenMessage('success', $this->lng->txt('mail_deleted_entry'));
569 } else {
570 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('mail_delete_error'));
571 }
572
573 $this->showMembersList();
574
575 return true;
576 }

References $id, error(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and showMembersList().

+ Here is the call graph for this function:

◆ saveAssignmentForm()

ilMailingListsGUI::saveAssignmentForm ( )

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

633 : bool
634 {
635 if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
636 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
637 }
638
639 $form = $this->getAssignmentForm();
640 if (!$form->checkInput()) {
641 $form->setValuesByPost();
642 $this->showAssignmentForm($form);
643 return true;
644 }
645
646 if (
647 ilBuddyList::getInstanceByGlobalUser()->getRelationByUserId(
648 $this->http->wrapper()->post()->retrieve('usr_id', $this->refinery->kindlyTo()->int())
649 )->isLinked()
650 ) {
651 $this->mlists->getCurrentMailingList()->assignUser(
652 $this->http->wrapper()->post()->retrieve('usr_id', $this->refinery->kindlyTo()->int())
653 );
654 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
655 $this->showMembersList();
656 return true;
657 }
658
659 $this->showAssignmentForm($form);
660 return true;
661 }
showAssignmentForm(?ilPropertyFormGUI $form=null)

References error(), ilBuddyList\getInstanceByGlobalUser(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), showAssignmentForm(), and showMembersList().

+ Here is the call graph for this function:

◆ saveForm()

ilMailingListsGUI::saveForm ( )

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

326 : void
327 {
328 if ($this->mlists->getCurrentMailingList() && $this->mlists->getCurrentMailingList()->getId()) {
329 if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
330 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
331 }
332
333 $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
334 $this->initForm('edit');
335 } else {
336 $this->initForm();
337 }
338
339 if ($this->form_gui->checkInput()) {
340 $this->mlists->getCurrentMailingList()->setTitle(
341 $this->form_gui->getInput('title')
342 );
343 $this->mlists->getCurrentMailingList()->setDescription(
344 $this->form_gui->getInput('description')
345 );
346 if ($this->mlists->getCurrentMailingList()->getId()) {
347 $this->mlists->getCurrentMailingList()->setChangedate(date('Y-m-d H:i:s'));
348 $this->mlists->getCurrentMailingList()->update();
349 } else {
350 $this->mlists->getCurrentMailingList()->setCreatedate(date('Y-m-d H:i:s'));
351 $this->mlists->getCurrentMailingList()->insert();
352 }
353
354 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
355 $this->ctrl->redirect($this, 'showMailingLists');
356 }
357
358 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
359 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_form.html', 'Services/Contact');
360
361 $this->form_gui->setValuesByPost();
362
363 $this->tpl->setVariable('FORM', $this->form_gui->getHTML());
364 $this->tpl->printToStdout();
365 }
initForm(string $a_type='create')

References ILIAS\Repository\ctrl(), error(), initForm(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ setDefaultValues()

ilMailingListsGUI::setDefaultValues ( )
private

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

395 : void
396 {
397 $this->form_gui->setValuesByArray([
398 'title' => '',
399 'description' => ''
400 ]);
401 }

Referenced by showForm().

+ Here is the caller graph for this function:

◆ setValuesByObject()

ilMailingListsGUI::setValuesByObject ( )
private

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

387 : void
388 {
389 $this->form_gui->setValuesByArray([
390 'title' => $this->mlists->getCurrentMailingList()->getTitle(),
391 'description' => $this->mlists->getCurrentMailingList()->getDescription() ?? ''
392 ]);
393 }

Referenced by showForm().

+ Here is the caller graph for this function:

◆ showAssignmentForm()

ilMailingListsGUI::showAssignmentForm ( ?ilPropertyFormGUI  $form = null)

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

664 : bool
665 {
666 if (!$this->mlists->getCurrentMailingList()->getId()) {
667 $this->showMembersList();
668 return true;
669 }
670
671 if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
672 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
673 }
674
675 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
676 $this->tpl->addBlockFile(
677 'ADM_CONTENT',
678 'adm_content',
679 'tpl.mail_mailing_lists_members_form.html',
680 'Services/Contact'
681 );
682
683 if (!($form instanceof ilPropertyFormGUI)) {
684 $form = $this->getAssignmentForm();
685 }
686
687 $this->tpl->setVariable('FORM', $form->getHTML());
688 $this->tpl->printToStdout();
689
690 return true;
691 }

References error(), ILIAS\Repository\lng(), 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 403 of file class.ilMailingListsGUI.php.

403 : void
404 {
405 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
406 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_form.html', 'Services/Contact');
407
408 if ($this->mlists->getCurrentMailingList() && $this->mlists->getCurrentMailingList()->getId()) {
409 if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
410 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
411 }
412
413 $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
414 $this->initForm('edit');
415 $this->setValuesByObject();
416 } else {
417 $this->initForm();
418 $this->setDefaultValues();
419 }
420
421 $this->tpl->setVariable('FORM', $this->form_gui->getHTML());
422 $this->tpl->printToStdout();
423 }

References ILIAS\Repository\ctrl(), error(), initForm(), ILIAS\Repository\lng(), setDefaultValues(), and setValuesByObject().

+ Here is the call graph for this function:

◆ showMailingLists()

ilMailingListsGUI::showMailingLists ( )

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

228 : bool
229 {
230 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
231 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_list.html', 'Services/Contact');
232
233 // check if current user may send mails
234 $mail = new ilMail($this->user->getId());
235 $mailing_allowed = $this->rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
236
237 $tbl = new ilMailingListsTableGUI($this, 'showMailingLists');
238
239 $create_btn = ilLinkButton::getInstance();
240 $create_btn->setCaption('create');
241 $create_btn->setUrl($this->ctrl->getLinkTarget($this, 'showForm'));
242 $this->toolbar->addButtonInstance($create_btn);
243
244 $result = [];
245 $entries = $this->mlists->getAll();
246 if (count($entries)) {
247 $tbl->enable('select_all');
248 $counter = 0;
249
250 foreach ($entries as $entry) {
251 if ($entry->getMode() === ilMailingList::MODE_TEMPORARY) {
252 continue;
253 }
254
255 $result[$counter]['check'] = ilLegacyFormElementsUtil::formCheckbox(false, 'ml_id[]', (string) $entry->getId());
256 $result[$counter]['title'] = $entry->getTitle() . " [#il_ml_" . $entry->getId() . "]";
257 $result[$counter]['description'] = $entry->getDescription() ?? '';
258 $result[$counter]['members'] = count($entry->getAssignedEntries());
259
260 $this->ctrl->setParameter($this, 'ml_id', $entry->getId());
261
262 $current_selection_list = new ilAdvancedSelectionListGUI();
263 $current_selection_list->setListTitle($this->lng->txt("actions"));
264 $current_selection_list->setId("act_" . $counter);
265
266 $current_selection_list->addItem(
267 $this->lng->txt("edit"),
268 '',
269 $this->ctrl->getLinkTarget($this, "showForm")
270 );
271 $current_selection_list->addItem(
272 $this->lng->txt("members"),
273 '',
274 $this->ctrl->getLinkTarget($this, "showMembersList")
275 );
276 if ($mailing_allowed) {
277 $current_selection_list->addItem(
278 $this->lng->txt("send_mail_to"),
279 '',
280 $this->ctrl->getLinkTarget($this, "mailToList")
281 );
282 }
283 $current_selection_list->addItem(
284 $this->lng->txt("delete"),
285 '',
286 $this->ctrl->getLinkTarget($this, "confirmDelete")
287 );
288
289 $result[$counter]['COMMAND_SELECTION_LIST'] = $current_selection_list->getHTML();
290 ++$counter;
291 }
292
293 if ($mailing_allowed) {
294 $tbl->addMultiCommand('mailToList', $this->lng->txt('send_mail_to'));
295 }
296 $tbl->addMultiCommand('confirmDelete', $this->lng->txt('delete'));
297 } else {
298 $tbl->disable('header');
299 $tbl->disable('footer');
300 }
301
302 $tbl->setData($result);
303
304 if (
305 $this->http->wrapper()->query()->has('ref') &&
306 $this->http->wrapper()->query()->retrieve('ref', $this->refinery->kindlyTo()->string()) === 'mail') {
307 $tbl->addCommandButton('cancel', $this->lng->txt('cancel'));
308 }
309
310 $this->tpl->setVariable('MAILING_LISTS', $tbl->getHTML());
311 $this->tpl->printToStdout();
312 return true;
313 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formCheckbox(bool $checked, string $varname, string $value, bool $disabled=false)

References ILIAS\Repository\ctrl(), ilLegacyFormElementsUtil\formCheckbox(), ilLinkButton\getInstance(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ilMailingList\MODE_TEMPORARY, ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

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 425 of file class.ilMailingListsGUI.php.

425 : bool
426 {
427 if (!$this->mlists->getCurrentMailingList()->getId()) {
428 $this->showMailingLists();
429 return true;
430 }
431
432 $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
433
434 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
435 $this->tpl->addBlockFile(
436 'ADM_CONTENT',
437 'adm_content',
438 'tpl.mail_mailing_lists_members.html',
439 'Services/Contact'
440 );
441
442 $tbl = new ilMailingListsMembersTableGUI($this, 'showMembersList', $this->mlists->getCurrentMailingList());
443 $result = [];
444
445 $availale_usr_ids = array_diff(
446 array_map(
447 static function (ilBuddySystemRelation $relation): int {
448 return $relation->getBuddyUsrId();
449 },
450 ilBuddyList::getInstanceByGlobalUser()->getLinkedRelations()->toArray()
451 ),
452 array_map(
453 static function (array $entry): int {
454 return $entry['usr_id'];
455 },
456 $this->mlists->getCurrentMailingList()->getAssignedEntries()
457 ),
458 );
459
460 if (count($availale_usr_ids) > 0) {
461 $create_btn = ilLinkButton::getInstance();
462 $create_btn->setCaption('add');
463 $create_btn->setUrl($this->ctrl->getLinkTarget($this, 'showAssignmentForm'));
464 $this->toolbar->addButtonInstance($create_btn);
465 }
466
467 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
468 if (count($assigned_entries)) {
469 $tbl->enable('select_all');
470 $tbl->setSelectAllCheckbox('a_id');
471
472 $usr_ids = [];
473 foreach ($assigned_entries as $entry) {
474 $usr_ids[] = $entry['usr_id'];
475 }
476
477 $names = ilUserUtil::getNamePresentation($usr_ids, false, false, '', false, false, false);
478
479 $counter = 0;
480 foreach ($assigned_entries as $entry) {
481 $result[$counter]['check'] = ilLegacyFormElementsUtil::formCheckbox(false, 'a_id[]', (string) $entry['a_id']);
482 $result[$counter]['user'] = $names[$entry['usr_id']];
483 ++$counter;
484 }
485
486 $tbl->addMultiCommand('confirmDeleteMembers', $this->lng->txt('delete'));
487 } else {
488 $tbl->disable('header');
489 $tbl->disable('footer');
490
491 $tbl->setNoEntriesText($this->lng->txt('mail_search_no'));
492 }
493
494 $tbl->setData($result);
495
496 $this->tpl->setVariable('MEMBERS_LIST', $tbl->getHTML());
497 $this->tpl->printToStdout();
498 return true;
499 }
Class ilBuddySystemRelation.
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']

References ILIAS\Repository\ctrl(), ilLegacyFormElementsUtil\formCheckbox(), ilBuddySystemRelation\getBuddyUsrId(), ilLinkButton\getInstance(), ilBuddyList\getInstanceByGlobalUser(), ilUserUtil\getNamePresentation(), ILIAS\Repository\lng(), showMailingLists(), and ILIAS\Repository\toolbar().

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

◆ $ctrl

ilCtrlInterface ilMailingListsGUI::$ctrl
private

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

◆ $error

ilErrorHandling ilMailingListsGUI::$error
private

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

◆ $form_gui

ilPropertyFormGUI ilMailingListsGUI::$form_gui
private

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

◆ $http

ILIAS HTTP GlobalHttpState ilMailingListsGUI::$http
private

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

◆ $lng

ilLanguage ilMailingListsGUI::$lng
private

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

◆ $mlists

ilMailingLists ilMailingListsGUI::$mlists
private

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

◆ $rbacsystem

ilRbacSystem ilMailingListsGUI::$rbacsystem
private

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

◆ $refinery

Refinery ilMailingListsGUI::$refinery
private

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

◆ $toolbar

ilToolbarGUI ilMailingListsGUI::$toolbar
private

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

◆ $tpl

ilGlobalTemplateInterface ilMailingListsGUI::$tpl
private

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

◆ $umail

ilFormatMail ilMailingListsGUI::$umail
private

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

◆ $user

ilObjUser ilMailingListsGUI::$user
private

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


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