ILIAS  release_8 Revision v8.24
class.ilMDCopyrightUsageGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
6
9
16{
17 public const DEFAULT_CMD = 'showUsageTable';
18
19 protected int $entry_id;
20
22 protected ilCtrl $ctrl;
23 protected ilLanguage $lng;
24 protected ilTabsGUI $tabs;
26 protected Factory $refinery;
27
28 public function __construct(int $a_entry_id)
29 {
30 global $DIC;
31
32 $this->tpl = $DIC->ui()->mainTemplate();
33 $this->http = $DIC->http();
34 $this->ctrl = $DIC->ctrl();
35 $this->lng = $DIC->language();
36 $this->tabs = $DIC->tabs();
37 $this->refinery = $DIC->refinery();
38
39 $this->entry_id = $a_entry_id;
40 }
41
42 public function executeCommand(): void
43 {
44 // save usage id for all request
45 $this->ctrl->saveParameter($this, 'entry_id');
46
47 $user = '';
48 if ($this->http->wrapper()->query()->has('user')) {
49 $user = $this->http->wrapper()->query()->retrieve(
50 'user',
51 $this->refinery->kindlyTo()->string()
52 );
53 }
54
55 $this->setTabs();
56 $next_class = $this->ctrl->getNextClass($this);
57 switch ($this->ctrl->getNextClass($this)) {
58 case 'ilpublicuserprofilegui':
59 $profile_gui = new ilPublicUserProfileGUI($this->http->wrapper()->query()->retrieve(
60 'user',
61 $this->refinery->kindlyTo()->int()
62 ));
63 $profile_gui->setBackUrl(
64 $this->ctrl->getLinkTarget($this, self::DEFAULT_CMD)
65 );
66 $html = $this->ctrl->forwardCommand($profile_gui);
67 $this->tpl->setContent($html);
68 break;
69
70 default:
71 $cmd = $this->ctrl->getCmd(self::DEFAULT_CMD);
72 $this->$cmd();
73 break;
74 }
75 }
76
77 public function showUsageTable(): void
78 {
79 $this->tpl->setOnScreenMessage('info', $this->lng->txt("meta_info_only_repository_objects"));
80
81 $table_gui = new ilMDCopyrightUsageTableGUI(
82 $this,
83 self::DEFAULT_CMD,
84 );
85 $table_gui->setFilterCommand("applyUsageFilter");
86 $table_gui->setResetCommand("resetUsageFilter");
87 $table_gui->init();
88 $table_gui->parse();
89
90 $this->tpl->setContent($table_gui->getHTML());
91 }
92
93 public function getEntryId(): int
94 {
95 return $this->entry_id;
96 }
97
98 protected function applyUsageFilter(): void
99 {
100 $table_gui = new ilMDCopyrightUsageTableGUI(
101 $this,
102 self::DEFAULT_CMD,
103 );
104 $table_gui->init();
105 $table_gui->resetOffset(); // sets record offset to 0 (first page)
106 $table_gui->writeFilterToSession(); // writes filter to session
107
108 $this->ctrl->redirect($this, self::DEFAULT_CMD);
109 }
110
111 protected function resetUsageFilter(): void
112 {
113 $table_gui = new ilMDCopyrightUsageTableGUI(
114 $this,
115 self::DEFAULT_CMD,
116 );
117 $table_gui->init();
118 $table_gui->resetOffset(); // sets record offest to 0 (first page)
119 $table_gui->resetFilter(); // clears filter
120
121 $this->ctrl->redirect($this, self::DEFAULT_CMD);
122 }
123
124 protected function setTabs(): void
125 {
126 $this->tabs->clearTargets();
127 $this->tabs->setBackTarget(
128 $this->lng->txt('back'),
129 $this->ctrl->getParentReturn($this)
130 );
131 }
132}
Builds data types.
Definition: Factory.php:21
Class ilCtrl provides processing control methods.
language handling
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
Interface GlobalHttpState.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.