ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMDCopyrightUsageGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25
32{
33 public const string DEFAULT_CMD = 'showUsageTable';
34
36
38 protected ilCtrl $ctrl;
39 protected ilLanguage $lng;
40 protected ilTabsGUI $tabs;
42 protected Factory $refinery;
43
45 {
46 global $DIC;
47
48 $this->tpl = $DIC->ui()->mainTemplate();
49 $this->http = $DIC->http();
50 $this->ctrl = $DIC->ctrl();
51 $this->lng = $DIC->language();
52 $this->tabs = $DIC->tabs();
53 $this->refinery = $DIC->refinery();
54
55 $this->entry = $entry;
56 }
57
58 public function executeCommand(): void
59 {
60 // save usage id for all request
61 $this->ctrl->saveParameter($this, 'entry_id');
62
63 $user = '';
64 if ($this->http->wrapper()->query()->has('user')) {
65 $user = $this->http->wrapper()->query()->retrieve(
66 'user',
67 $this->refinery->kindlyTo()->string()
68 );
69 }
70
71 $this->setTabs();
72 $next_class = $this->ctrl->getNextClass($this);
73 switch ($this->ctrl->getNextClass($this)) {
74 case strtolower(PublicProfileGUI::class):
75 $profile_gui = new PublicProfileGUI($this->http->wrapper()->query()->retrieve(
76 'user',
77 $this->refinery->kindlyTo()->int()
78 ));
79 $profile_gui->setBackUrl(
80 $this->ctrl->getLinkTarget($this, self::DEFAULT_CMD)
81 );
82 $html = $this->ctrl->forwardCommand($profile_gui);
83 $this->tpl->setContent($html);
84 break;
85
86 default:
87 $cmd = $this->ctrl->getCmd(self::DEFAULT_CMD);
88 $this->$cmd();
89 break;
90 }
91 }
92
93 public function showUsageTable(): void
94 {
95 $this->tpl->setOnScreenMessage('info', $this->lng->txt("meta_info_only_repository_objects"));
96
97 $table_gui = new ilMDCopyrightUsageTableGUI(
98 $this,
99 self::DEFAULT_CMD,
100 );
101 $table_gui->setFilterCommand("applyUsageFilter");
102 $table_gui->setResetCommand("resetUsageFilter");
103 $table_gui->init();
104 $table_gui->parse();
105
106 $this->tpl->setContent($table_gui->getHTML());
107 }
108
109 public function getEntryId(): int
110 {
111 return $this->entry->id();
112 }
113
114 public function getEntryTitle(): string
115 {
116 return $this->entry->title();
117 }
118
119 protected function applyUsageFilter(): void
120 {
121 $table_gui = new ilMDCopyrightUsageTableGUI(
122 $this,
123 self::DEFAULT_CMD,
124 );
125 $table_gui->init();
126 $table_gui->resetOffset(); // sets record offset to 0 (first page)
127 $table_gui->writeFilterToSession(); // writes filter to session
128
129 $this->ctrl->redirect($this, self::DEFAULT_CMD);
130 }
131
132 protected function resetUsageFilter(): void
133 {
134 $table_gui = new ilMDCopyrightUsageTableGUI(
135 $this,
136 self::DEFAULT_CMD,
137 );
138 $table_gui->init();
139 $table_gui->resetOffset(); // sets record offest to 0 (first page)
140 $table_gui->resetFilter(); // clears filter
141
142 $this->ctrl->redirect($this, self::DEFAULT_CMD);
143 }
144
145 protected function setTabs(): void
146 {
147 $this->tabs->clearTargets();
148 $this->tabs->setBackTarget(
149 $this->lng->txt('back'),
150 $this->ctrl->getParentReturn($this)
151 );
152 }
153}
Builds data types.
Definition: Factory.php:36
GUI class for public user profile presentation.
Class ilCtrl provides processing control methods.
language handling
__construct(EntryInterface $entry)
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface GlobalHttpState.
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26