ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMembershipBlockGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
25 public function initViewSettings(): void
26 {
27 $this->viewSettings = new ilPDSelectedItemsBlockViewSettings(
28 $this->user,
30 );
31
32 $this->ctrl->setParameter($this, 'view', $this->viewSettings->getCurrentView());
33 }
34
35 public function emptyHandling(): string
36 {
37 $this->lng->loadLanguageModule('rep');
38 return $this->renderer->render(
39 $this->factory->panel()->standard(
40 $this->getTitle(),
41 $this->factory->legacy()->content($this->lng->txt('rep_mo_mem_dash'))
42 )
43 );
44 }
45
46 public function initData(): void
47 {
49 $data = $provider->getItems();
50 $data = array_map(static function (array $item): BlockDTO {
51 $start = isset($item['start']) && $item['start'] instanceof ilDateTime ? $item['start'] : null;
52 $end = isset($item['end']) && $item['end'] instanceof ilDateTime ? $item['end'] : null;
53 return new BlockDTO(
54 $item['type'],
55 (int) $item['ref_id'],
56 (int) $item['obj_id'],
57 $item['title'],
58 $item['description'],
59 $start,
60 $end,
61 );
62 }, $data);
63
64 $this->setData(['' => $data]);
65 }
66
67 public function getBlockType(): string
68 {
69 return 'pdmem';
70 }
71
72 public function confirmedRemove(array $ids): void
73 {
74 foreach ($ids as $ref_id) {
75 if ($this->access->checkAccess('leave', '', $ref_id)) {
76 switch (ilObject::_lookupType($ref_id, true)) {
77 case 'crs':
79 $members->delete($this->user->getId());
80
81 $members->sendUnsubscribeNotificationToAdmins($this->user->getId());
82 $members->sendNotification(
84 $this->user->getId()
85 );
86 break;
87
88 case 'grp':
90 $members->delete($this->user->getId());
91
92 $members->sendNotification(
94 $this->user->getId()
95 );
96 $members->sendNotification(
98 $this->user->getId()
99 );
100 break;
101 default:
102 continue 2;
103 }
104
105 ilForumNotification::checkForumsExistsDelete($ref_id, $this->user->getId());
106 }
107 }
108
109 $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('mmbr_unsubscribed_from_objs'), true);
110 $this->ctrl->returnToParent($this);
111 }
112
113 public function removeMultipleEnabled(): bool
114 {
115 return true;
116 }
117
118 public function getRemoveMultipleActionText(): string
119 {
120 return $this->lng->txt('pd_unsubscribe_multiple_memberships');
121 }
122}
renderer()
factory()
@classDescription Date and time handling
static checkForumsExistsDelete(int $ref_id, int $user_id)
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
$ref_id
Definition: ltiauth.php:66
$provider
Definition: ltitoken.php:80