ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSelectedItemsBlockGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23
25{
26 public function initViewSettings(): void
27 {
28 $this->viewSettings = new ilPDSelectedItemsBlockViewSettings(
29 $this->user,
31 );
32
33 $this->ctrl->setParameter($this, 'view', $this->viewSettings->getCurrentView());
34 }
35
36 public function emptyHandling(): string
37 {
38 $this->lng->loadLanguageModule('rep');
39 $txt = $this->lng->txt('rep_fav_intro1') . '<br>';
40 $txt .= sprintf(
41 $this->lng->txt('rep_fav_intro2'),
42 $this->getRepositoryTitle()
43 ) . '<br>';
44 $txt .= $this->lng->txt('rep_fav_intro3');
45 $mbox = $this->ui->factory()->messageBox()->info($txt);
46 $mbox = $mbox->withLinks(
47 [
48 $this->ui->factory()->link()->standard(
49 $this->getRepositoryTitle(),
50 ilLink::_getStaticLink(1, 'root', true)
51 )
52 ]
53 );
54
55 return $this->renderer->render(
56 $this->factory->panel()->standard(
57 $this->getTitle(),
58 $this->factory->legacy()->content($this->renderer->render($mbox))
59 )
60 );
61 }
62
63 public function initData(): void
64 {
66 $data = $provider->getItems();
67 $data = array_map(static function (array $item): BlockDTO {
68 $start = isset($item['start']) && $item['start'] instanceof ilDateTime ? $item['start'] : null;
69 $end = isset($item['end']) && $item['end'] instanceof ilDateTime ? $item['end'] : null;
70
71 return new BlockDTO(
72 $item['type'],
73 (int) $item['ref_id'],
74 (int) $item['obj_id'],
75 $item['title'],
76 $item['description'],
77 $start,
78 $end,
79 );
80 }, $data);
81
82 $this->setData(['' => $data]);
83 }
84
85 public function getBlockType(): string
86 {
87 return 'pditems';
88 }
89
90 public function confirmedRemove(array $ids): void
91 {
92 foreach ($ids as $ref_id) {
93 $this->favourites_manager->remove($this->user->getId(), $ref_id);
94 }
95
96 $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('pd_remove_multi_confirm'), true);
97 $this->ctrl->returnToParent($this);
98 }
99
100 public function removeMultipleEnabled(): bool
101 {
102 return true;
103 }
104
105 public function getRemoveMultipleActionText(): string
106 {
107 return $this->lng->txt('pd_remove_multiple');
108 }
109}
renderer()
factory()
@classDescription Date and time handling
$txt
Definition: error.php:31
$ref_id
Definition: ltiauth.php:66
$provider
Definition: ltitoken.php:80