ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilMailingListsGUI Class Reference
+ Inheritance diagram for ilMailingListsGUI:
+ Collaboration diagram for ilMailingListsGUI:

Public Member Functions

 __construct ()
 
 getUnsafeGetCommands ()
 This method must return a list of unsafe GET commands. More...
 
 getSafePostCommands ()
 This method must return a list of safe POST commands. More...
 
 executeCommand ()
 
 performDeleteCommand ()
 
 showMailingListsCommand ()
 
 saveFormCommand ()
 
 showAssignmentFormCommand (?StandardForm $form=null)
 
 getUnsafeGetCommands ()
 This method must return a list of unsafe GET commands. More...
 
 getSafePostCommands ()
 This method must return a list of safe POST commands. More...
 

Private Member Functions

 getQueryMailingListId ()
 
 handleMailingListMemberActionsCommand ()
 
 handleMailingListActionsCommand ()
 
 getMailingListIdsFromRequest ()
 
 confirmDelete ()
 
 mailToList ()
 
 cancelCommand ()
 
 initForm ()
 
 showFormCommand ()
 
 showMembersListCommand ()
 
 confirmDeleteMembers ()
 
 performDeleteMembersCommand ()
 
 saveAssignmentFormCommand ()
 

Private Attributes

readonly ILIAS HTTP GlobalHttpState $http
 
readonly Refinery $refinery
 
readonly ilGlobalTemplateInterface $tpl
 
readonly ilCtrlInterface $ctrl
 
readonly ilLanguage $lng
 
readonly ilObjUser $user
 
readonly ilErrorHandling $error
 
readonly ilToolbarGUI $toolbar
 
readonly ilRbacSystem $rbacsystem
 
readonly ilFormatMail $umail
 
readonly ilMailingLists $mlists
 
StandardForm $form
 
readonly ILIAS UI Factory $ui_factory
 
readonly ILIAS UI Renderer $ui_renderer
 
readonly ilTabsGUI $tabs
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilMailingListsGUI::__construct ( )

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

45 {
46 global $DIC;
47
48 $this->tpl = $DIC->ui()->mainTemplate();
49 $this->ctrl = $DIC['ilCtrl'];
50 $this->lng = $DIC['lng'];
51 $this->rbacsystem = $DIC['rbacsystem'];
52 $this->user = $DIC['ilUser'];
53 $this->error = $DIC['ilErr'];
54 $this->toolbar = $DIC['ilToolbar'];
55 $this->http = $DIC->http();
56 $this->refinery = $DIC->refinery();
57 $this->ui_factory = $DIC->ui()->factory();
58 $this->ui_renderer = $DIC->ui()->renderer();
59 $this->tabs = $DIC->tabs();
60
61 $this->umail = new ilFormatMail($this->user->getId());
62 $this->mlists = new ilMailingLists($this->user);
63 $this->mlists->setCurrentMailingList($this->getQueryMailingListId());
64
65 $this->ctrl->saveParameter($this, 'mobj_id');
66 $this->ctrl->saveParameter($this, 'ref');
67
68 $this->lng->loadLanguageModule('mail');
69 }
error(string $a_errmsg)
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ cancelCommand()

ilMailingListsGUI::cancelCommand ( )
private

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

342 : void
343 {
344 if ($this->http->wrapper()->query()->has('ref') &&
345 $this->http->wrapper()->query()->retrieve('ref', $this->refinery->kindlyTo()->string()) === 'mail') {
346 $this->ctrl->returnToParent($this);
347 }
348
350 }

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

+ Here is the call graph for this function:

◆ confirmDelete()

ilMailingListsGUI::confirmDelete ( )
private

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

190 : void
191 {
192 $ml_ids = $this->getMailingListIdsFromRequest();
193 if ($ml_ids === []) {
194 $this->tpl->setOnScreenMessage('info', $this->lng->txt('mail_select_one_entry'));
196 return;
197 }
198
199 if ((string) current($ml_ids) === 'ALL_OBJECTS') {
200 $entries = $this->mlists->getAll();
201 } else {
202 $entries = $this->mlists->getSelected(
203 array_map(intval(...), $ml_ids)
204 );
205 }
206
207 $c_gui = new ilConfirmationGUI();
208
209 $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDelete'));
210 $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
211 $c_gui->setCancel($this->lng->txt('cancel'), 'showMailingLists');
212 $c_gui->setConfirm($this->lng->txt('confirm'), 'performDelete');
213
214 foreach ($entries as $entry) {
215 $c_gui->addItem('ml_id[]', (string) $entry->getId(), $entry->getTitle());
216 }
217
218 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
219 $this->tpl->setContent($c_gui->getHTML());
220 $this->tpl->printToStdout();
221 }
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 showMailingListsCommand().

Referenced by handleMailingListActionsCommand().

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

◆ confirmDeleteMembers()

ilMailingListsGUI::confirmDeleteMembers ( )
private

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

497 : void
498 {
499 $requested_record_ids = $this->http->wrapper()->query()->retrieve(
500 'contact_mailinglist_members_entry_ids',
501 $this->refinery->byTrying([
502 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string()),
503 $this->refinery->always([])
504 ])
505 );
506
507 if ($requested_record_ids === []) {
508 $this->tpl->setOnScreenMessage('info', $this->lng->txt('mail_select_one_entry'));
509 $this->showMembersListCommand();
510 return;
511 }
512
513 if ((string) current($requested_record_ids) === 'ALL_OBJECTS') {
514 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
515 $requested_record_ids = [];
516 foreach ($assigned_entries as $entry) {
517 $requested_record_ids[] = $entry['a_id'];
518 }
519 } else {
520 $requested_record_ids = array_map(intval(...), $requested_record_ids);
521 }
522
523 $c_gui = new ilConfirmationGUI();
524 $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
525 $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteMembers'));
526 $c_gui->setHeaderText($this->lng->txt('mail_sure_remove_user'));
527 $c_gui->setCancel($this->lng->txt('cancel'), 'showMembersList');
528 $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteMembers');
529
530 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
531 $usr_ids = array_map(static fn(array $entry): int => $entry['usr_id'], $assigned_entries);
532 $names = ilUserUtil::getNamePresentation($usr_ids, false, false, '', false, false, false);
533
534 foreach ($assigned_entries as $entry) {
535 if (in_array($entry['a_id'], $requested_record_ids, true)) {
536 $c_gui->addItem('a_id[]', (string) $entry['a_id'], $names[$entry['usr_id']]);
537 }
538 }
539
540 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
541 $this->tpl->setContent($c_gui->getHTML());
542 $this->tpl->printToStdout();
543 }
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=null)
Default behaviour is:

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

Referenced by handleMailingListMemberActionsCommand().

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

◆ executeCommand()

ilMailingListsGUI::executeCommand ( )

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

105 : bool
106 {
107 if (
108 !ilBuddySystem::getInstance()->isEnabled() ||
109 (
110 count(ilBuddyList::getInstanceByGlobalUser()->getLinkedRelations()) === 0 &&
111 !$this->mlists->hasAny()
112 )
113 ) {
114 $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
115 }
116
117 $cmd = $this->ctrl->getCmd();
118 if ($cmd === null || $cmd === '' || !method_exists($this, $cmd . 'Command')) {
119 $cmd = 'showMailingLists';
120 }
121 $verified_command = $cmd . 'Command';
122
123 $this->$verified_command();
124
125 return true;
126 }
static getInstanceByGlobalUser(?ilObjUser $user=null)

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
list<int>|list<string>

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

164 : array
165 {
166 if ($this->http->wrapper()->query()->has('ml_id')) {
167 $ml_ids = [
168 $this->http->wrapper()->query()->retrieve('ml_id', $this->refinery->kindlyTo()->int())
169 ];
170 } elseif ($this->http->wrapper()->post()->has('ml_id')) {
171 $ml_ids = $this->http->wrapper()->post()->retrieve(
172 'ml_id',
173 $this->refinery->kindlyTo()->listOf(
174 $this->refinery->kindlyTo()->int()
175 )
176 );
177 } else {
178 $ml_ids = $this->http->wrapper()->query()->retrieve(
179 'contact_mailinglist_list_ml_ids',
180 $this->refinery->byTrying([
181 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string()),
182 $this->refinery->always([])
183 ])
184 );
185 }
186
187 return array_filter($ml_ids);
188 }

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:

◆ getQueryMailingListId()

ilMailingListsGUI::getQueryMailingListId ( )
private

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

84 : int
85 {
86 return $this->http->wrapper()->query()->retrieve(
87 'ml_id',
88 $this->refinery->byTrying([
89 $this->refinery->kindlyTo()->int(),
90 $this->refinery->always(
91 current(
92 $this->http->wrapper()->query()->retrieve(
93 'contact_mailinglist_list_ml_ids',
94 $this->refinery->byTrying([
95 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
96 $this->refinery->always([0])
97 ])
98 )
99 ) ?: 0
100 )
101 ])
102 );
103 }

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

Referenced by __construct().

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

◆ getSafePostCommands()

ilMailingListsGUI::getSafePostCommands ( )

This method must return a list of safe POST commands.

Safe post commands returned by this method will no longer be CSRF protected and will NOT be appended by an ilCtrlToken.

Returns
string[]

Implements ilCtrlSecurityInterface.

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

79 : array
80 {
81 return [];
82 }

◆ getUnsafeGetCommands()

ilMailingListsGUI::getUnsafeGetCommands ( )

This method must return a list of unsafe GET commands.

Unsafe get commands returned by this method will now be CSRF protected, which means an ilCtrlToken is appended each time a link-target is generated to the class implementing this interface with a command from that list.

Tokens will be validated in

See also
ilCtrlInterface::getCmd(), whereas the fallback command will be used if the CSRF validation fails.
Returns
string[]

Implements ilCtrlSecurityInterface.

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

71 : array
72 {
73 return [
74 'handleMailingListActions',
75 'handleMailingListMemberActions',
76 ];
77 }

◆ handleMailingListActionsCommand()

ilMailingListsGUI::handleMailingListActionsCommand ( )
private

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

143 : void
144 {
145 $action = $this->http->wrapper()->query()->retrieve(
146 'contact_mailinglist_list_action',
147 $this->refinery->byTrying([
148 $this->refinery->kindlyTo()->string(),
149 $this->refinery->always('')
150 ])
151 );
152 match ($action) {
153 'mailToList' => $this->mailToList(),
154 'confirmDelete' => $this->confirmDelete(),
155 'showMembersList' => $this->showMembersListCommand(),
156 'showForm' => $this->showFormCommand(),
157 default => $this->ctrl->redirect($this, 'showMailingLists'),
158 };
159 }

References confirmDelete(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), mailToList(), ILIAS\Repository\refinery(), showFormCommand(), and showMembersListCommand().

+ Here is the call graph for this function:

◆ handleMailingListMemberActionsCommand()

ilMailingListsGUI::handleMailingListMemberActionsCommand ( )
private

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

128 : void
129 {
130 $action = $this->http->wrapper()->query()->retrieve(
131 'contact_mailinglist_members_action',
132 $this->refinery->byTrying([
133 $this->refinery->kindlyTo()->string(),
134 $this->refinery->always('')
135 ])
136 );
137 match ($action) {
138 'confirmDeleteMembers' => $this->confirmDeleteMembers(),
139 default => $this->ctrl->redirect($this, 'showMailingLists'),
140 };
141 }

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

+ Here is the call graph for this function:

◆ initForm()

ilMailingListsGUI::initForm ( )
private

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

395 : void
396 {
397 $title = $this->ui_factory
398 ->input()
399 ->field()
400 ->text(
401 $this->lng->txt('title')
402 )
403 ->withRequired(true)
404 ->withValue(
405 $this->mlists->getCurrentMailingList() ? $this->mlists->getCurrentMailingList()->getTitle() : ''
406 );
407
408 $description = $this->ui_factory
409 ->input()
410 ->field()
411 ->textarea(
412 $this->lng->txt('description')
413 )
414 ->withValue(
415 $this->mlists->getCurrentMailingList() ? $this->mlists->getCurrentMailingList()->getDescription() : ''
416 );
417
418 $this->form = $this->ui_factory->input()->container()->form()->standard(
419 $this->ctrl->getFormAction($this, 'saveForm'),
420 [
421 'title' => $title,
422 'description' => $description
423 ]
424 );
425 }
form( $class_path, string $cmd, string $submit_caption="")

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

Referenced by saveFormCommand(), and showFormCommand().

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

◆ mailToList()

ilMailingListsGUI::mailToList ( )
private

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

261 : void
262 {
263 // check if current user may send mails
264 $mail = new ilMail($this->user->getId());
265 $mailing_allowed = $this->rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
266
267 if (!$mailing_allowed) {
268 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->lng->txt('no_permission'));
269 return;
270 }
271
272 $ml_ids = $this->getMailingListIdsFromRequest();
273 if ($ml_ids === []) {
274 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_INFO, $this->lng->txt('mail_select_one_entry'));
276 return;
277 }
278
279 if ((string) current($ml_ids) === 'ALL_OBJECTS') {
280 $entries = $this->mlists->getAll();
281 $ml_ids = [];
282 foreach ($entries as $entry) {
283 $ml_ids[] = $entry->getId();
284 }
285 } else {
286 $ml_ids = array_map(intval(...), $ml_ids);
287 }
288
289 $mail_data = $this->umail->retrieveFromStage();
290 $lists = [];
291 foreach ($ml_ids as $id) {
292 if ($this->mlists->isOwner($id, $this->user->getId()) &&
293 !$this->umail->existsRecipient('#il_ml_' . $id, (string) $mail_data['rcp_to'])) {
294 $lists['#il_ml_' . $id] = '#il_ml_' . $id;
295 }
296 }
297
298 if ($lists !== []) {
299 $mail_data = $this->umail->appendSearchResult(array_values($lists), 'to');
300 $this->umail->persistToStage(
301 (int) $mail_data['user_id'],
302 $mail_data['attachments'],
303 $mail_data['rcp_to'],
304 $mail_data['rcp_cc'],
305 $mail_data['rcp_bcc'],
306 $mail_data['m_subject'],
307 $mail_data['m_message'],
308 $mail_data['use_placeholders'],
309 $mail_data['tpl_ctx_id'],
310 $mail_data['tpl_ctx_params']
311 );
312 }
313
314 ilUtil::redirect('ilias.php?baseClass=ilMailGUI&type=search_res');
315 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static redirect(string $a_script)

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

Referenced by handleMailingListActionsCommand().

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

◆ performDeleteCommand()

ilMailingListsGUI::performDeleteCommand ( )

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

223 : void
224 {
225 if ($this->http->wrapper()->post()->has('ml_id')) {
226 $ml_ids = array_filter(
227 $this->http->wrapper()->post()->retrieve(
228 'ml_id',
229 $this->refinery->kindlyTo()->listOf(
230 $this->refinery->kindlyTo()->int()
231 )
232 )
233 );
234
235 $counter = 0;
236 foreach ($ml_ids as $id) {
237 if ($this->mlists->isOwner($id, $this->user->getId())) {
238 $this->mlists->get($id)->delete();
239 ++$counter;
240 }
241 }
242
243 if ($counter !== 0) {
244 $this->tpl->setOnScreenMessage(
245 $this->tpl::MESSAGE_TYPE_SUCCESS,
246 $this->lng->txt('mail_deleted_entry'),
247 true
248 );
249 }
250 } else {
251 $this->tpl->setOnScreenMessage(
252 $this->tpl::MESSAGE_TYPE_FAILURE,
253 $this->lng->txt('mail_delete_error'),
254 true
255 );
256 }
257
258 $this->ctrl->redirect($this, 'showMailingLists');
259 }
$counter

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

+ Here is the call graph for this function:

◆ performDeleteMembersCommand()

ilMailingListsGUI::performDeleteMembersCommand ( )
private

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

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

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

+ Here is the call graph for this function:

◆ saveAssignmentFormCommand()

ilMailingListsGUI::saveAssignmentFormCommand ( )
private

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

641 : void
642 {
643 if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
644 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
645 }
646
647 $form = $this->getAssignmentForm();
648 if (!$form) {
650 return;
651 }
652
653 $form = $form->withRequest($this->http->request());
654 if ($form->getError()) {
656 return;
657 }
658 $data = $form->getData();
659
660 if (
661 ilBuddyList::getInstanceByGlobalUser()->getRelationByUserId(
662 $this->refinery->kindlyTo()->int()->transform($data['usr_id'])
663 )->isLinked()
664 ) {
665 $this->mlists->getCurrentMailingList()->assignUser(
666 $this->refinery->kindlyTo()->int()->transform($data['usr_id'])
667 );
668 $this->tpl->setOnScreenMessage(
669 $this->tpl::MESSAGE_TYPE_SUCCESS,
670 $this->lng->txt('saved_successfully'),
671 true
672 );
673
674 $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
675 $this->ctrl->redirect($this, 'showMembersList');
676 }
677
679 }
showAssignmentFormCommand(?StandardForm $form=null)

References $data, $form, ILIAS\Repository\ctrl(), error(), ilBuddyList\getInstanceByGlobalUser(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and showAssignmentFormCommand().

+ Here is the call graph for this function:

◆ saveFormCommand()

ilMailingListsGUI::saveFormCommand ( )

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

352 : void
353 {
354 if ($this->mlists->getCurrentMailingList() && $this->mlists->getCurrentMailingList()->getId()) {
355 if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
356 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
357 }
358
359 $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
360 }
361 $this->initForm();
362
363 $form = $this->form->withRequest($this->http->request());
364
365 if (!$form->getError()) {
366 $data = $form->getData();
367 $this->mlists->getCurrentMailingList()->setTitle(
368 $data['title']
369 );
370 $this->mlists->getCurrentMailingList()->setDescription(
371 $data['description']
372 );
373
374 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
375 if ($this->mlists->getCurrentMailingList()->getId() > 0) {
376 $this->mlists->getCurrentMailingList()->setChangedate(date('Y-m-d H:i:s'));
377 $this->mlists->getCurrentMailingList()->update();
378 $this->ctrl->redirect($this, 'showMailingLists');
379 } else {
380 $this->mlists->getCurrentMailingList()->setCreatedate(date('Y-m-d H:i:s'));
381 $this->mlists->getCurrentMailingList()->insert();
382
383 $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
384 $this->ctrl->redirect($this, 'showMembersList');
385 }
386 }
387
388 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
389 $this->tpl->setContent($this->ui_renderer->render([
390 'mailing_lists' => $form
391 ]));
392 $this->tpl->printToStdout();
393 }

References $data, $form, ILIAS\Repository\ctrl(), error(), ILIAS\Repository\form(), ILIAS\FileDelivery\http(), initForm(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ showAssignmentFormCommand()

ilMailingListsGUI::showAssignmentFormCommand ( ?StandardForm  $form = null)

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

681 : void
682 {
683 if (!$this->mlists->getCurrentMailingList() || $this->mlists->getCurrentMailingList()->getId() === 0) {
684 $this->showMembersListCommand();
685 return;
686 }
687
688 if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
689 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
690 }
691
692 if (!$form instanceof StandardForm) {
693 $form = $this->getAssignmentForm();
694 }
695
696 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
697 $this->tpl->setContent($this->ui_renderer->render($form));
698 $this->tpl->printToStdout();
699 }

References $form, error(), ILIAS\Repository\lng(), and showMembersListCommand().

Referenced by saveAssignmentFormCommand().

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

◆ showFormCommand()

ilMailingListsGUI::showFormCommand ( )
private

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

427 : void
428 {
429 if ($this->mlists->getCurrentMailingList() && $this->mlists->getCurrentMailingList()->getId()) {
430 if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
431 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
432 }
433
434 $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
435 }
436 $this->initForm();
437
438 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
439 $this->tpl->setContent($this->ui_renderer->render([
440 'mailing_lists' => $this->form
441 ]));
442 $this->tpl->printToStdout();
443 }

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

Referenced by handleMailingListActionsCommand().

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

◆ showMailingListsCommand()

ilMailingListsGUI::showMailingListsCommand ( )

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

317 : void
318 {
319 $mail = new ilMail($this->user->getId());
320
321 $this->toolbar->addComponent(
322 $this->ui_factory->button()->standard(
323 $this->lng->txt('create'),
324 $this->ctrl->getLinkTarget($this, 'showForm')
325 )
326 );
327
328 $tbl = new MailingListsTable(
329 $this->mlists,
330 $this->ctrl,
331 $this->lng,
332 $this->ui_factory,
333 $this->http
334 );
335 $tbl->setMailingAllowed($this->rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId()));
336
337 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
338 $this->tpl->setContent($this->ui_renderer->render($tbl->getComponent()));
339 $this->tpl->printToStdout();
340 }

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

Referenced by cancelCommand(), confirmDelete(), mailToList(), and showMembersListCommand().

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

◆ showMembersListCommand()

ilMailingListsGUI::showMembersListCommand ( )
private

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

445 : void
446 {
447 if (!$this->mlists->getCurrentMailingList() || $this->mlists->getCurrentMailingList()->getId() === 0) {
449 return;
450 }
451
452 $this->tabs->clearTargets();
453 $this->tabs->setBackTarget(
454 $this->lng->txt('back'),
455 $this->ctrl->getLinkTarget($this, 'showMailingLists')
456 );
457
458 $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
459
460 $available_usr_ids = array_diff(
461 array_map(
462 static function (ilBuddySystemRelation $relation): int {
463 return $relation->getBuddyUsrId();
464 },
465 ilBuddyList::getInstanceByGlobalUser()->getLinkedRelations()->toArray()
466 ),
467 array_map(
468 static function (array $entry): int {
469 return $entry['usr_id'];
470 },
471 $this->mlists->getCurrentMailingList()->getAssignedEntries()
472 ),
473 );
474
475 if ($available_usr_ids !== []) {
476 $this->toolbar->addComponent(
477 $this->ui_factory->button()->standard(
478 $this->lng->txt('add'),
479 $this->ctrl->getLinkTarget($this, 'showAssignmentForm')
480 )
481 );
482 }
483
484 $tbl = new MailingListsMembersTable(
485 $this->mlists->getCurrentMailingList(),
486 $this->ctrl,
487 $this->lng,
488 $this->ui_factory,
489 $this->http
490 );
491
492 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
493 $this->tpl->setContent($this->ui_renderer->render($tbl->getComponent()));
494 $this->tpl->printToStdout();
495 }
$relation
Class ilBuddySystemRelation.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $relation, ILIAS\Repository\ctrl(), ilBuddyList\getInstanceByGlobalUser(), ILIAS\Repository\lng(), showMailingListsCommand(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

Referenced by confirmDeleteMembers(), handleMailingListActionsCommand(), and showAssignmentFormCommand().

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

Field Documentation

◆ $ctrl

readonly ilCtrlInterface ilMailingListsGUI::$ctrl
private

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

◆ $error

readonly ilErrorHandling ilMailingListsGUI::$error
private

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

◆ $form

StandardForm ilMailingListsGUI::$form
private

◆ $http

readonly ILIAS HTTP GlobalHttpState ilMailingListsGUI::$http
private

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

◆ $lng

readonly ilLanguage ilMailingListsGUI::$lng
private

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

◆ $mlists

readonly ilMailingLists ilMailingListsGUI::$mlists
private

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

◆ $rbacsystem

readonly ilRbacSystem ilMailingListsGUI::$rbacsystem
private

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

◆ $refinery

readonly Refinery ilMailingListsGUI::$refinery
private

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

◆ $tabs

readonly ilTabsGUI ilMailingListsGUI::$tabs
private

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

◆ $toolbar

readonly ilToolbarGUI ilMailingListsGUI::$toolbar
private

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

◆ $tpl

readonly ilGlobalTemplateInterface ilMailingListsGUI::$tpl
private

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

◆ $ui_factory

readonly ILIAS UI Factory ilMailingListsGUI::$ui_factory
private

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

◆ $ui_renderer

readonly ILIAS UI Renderer ilMailingListsGUI::$ui_renderer
private

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

◆ $umail

readonly ilFormatMail ilMailingListsGUI::$umail
private

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

◆ $user

readonly ilObjUser ilMailingListsGUI::$user
private

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


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