ILIAS  trunk Revision v13.0_alpha-52-g21c366bbdd4
PermanentLinkManager.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26use ILIAS\StaticURL\Services as StaticUrl;
28
36{
37 protected StaticUrl $static_url;
40
41 public function __construct(
44 ) {
45 global $DIC;
47 $this->static_url = $DIC['static_url'];
48
49 $this->domain = $domain;
50 $this->gui = $gui;
51 }
52
53 protected function _setPermanentLink(array $append): void
54 {
55 $request = $this->gui->request();
56 $ref_id = $request->getRefId();
57 $uri = $this->static_url->builder()->build(
58 'exc', // namespace
59 $ref_id > 0 ? new ReferenceId($ref_id) : null, // ref_id
60 $append // additional parameters
61 );
63 }
64
65 public function setPermanentLink(): void
66 {
67 $request = $this->gui->request();
68 $this->_setPermanentLink(
69 $this->getDefaultAppend(
70 $request->getAssId()
71 )
72 );
73 }
74
75 public function getDefaultAppend(int $ass_id): array
76 {
77 $append = [];
78 if ($ass_id > 0) {
79 $append[] = $ass_id;
80 }
81 return $append;
82 }
83
84 public function getPermanentLink(int $ref_id, int $ass_id): string
85 {
86 $append = $this->getDefaultAppend($ass_id);
87 return $this->_getPermanentLink($ref_id, $append);
88 }
89
90 protected function _getPermanentLink(int $ref_id, array $append): string
91 {
92 $uri = $this->static_url->builder()->build(
93 'exc', // namespace
94 $ref_id > 0 ? new ReferenceId($ref_id) : null, // ref_id
95 $append // additional parameters
96 );
97
98 return (string) $uri;
99 }
100
101 public function getDownloadSubmissionLink(int $ref_id, int $ass_id, int $user_id): string
102 {
103 return $this->_getPermanentLink($ref_id, [$ass_id, $user_id, "setdownload"]);
104 }
105
106 public function setGradesPermanentLink(): void
107 {
108 $request = $this->gui->request();
109 $this->_setPermanentLink(
110 $this->getGradesAppend(
111 $request->getAssId()
112 )
113 );
114 }
115
116 public function getGradesLink(int $ref_id, int $ass_id): string
117 {
118 return $this->_getPermanentLink($ref_id, [$ass_id, "grades"]);
119 }
120
121 public function getGradesAppend(int $ass_id): array
122 {
123 return [$ass_id, "grades"];
124 }
125
126 public function setGivenFeedbackPermanentLink(): void
127 {
128 $request = $this->gui->request();
129 $this->_setPermanentLink(
131 $request->getAssId(),
132 $request->getPeerId()
133 )
134 );
135 }
136
137 public function getGivenFeedbackLink(int $ref_id, int $ass_id, int $peer_id): string
138 {
139 return $this->_getPermanentLink($ref_id, [$ass_id, $peer_id, "given"]);
140 }
141
142 public function getGivenFeedbackAppend(int $ass_id, int $peer_id): array
143 {
144 return [$ass_id, $peer_id, "given"];
145 }
146
147 public function setReceivedFeedbackPermanentLink(): void
148 {
149 $request = $this->gui->request();
150 $this->_setPermanentLink(
152 $request->getAssId()
153 )
154 );
155 }
156
157 public function getReceivedFeedbackLink(int $ref_id, int $ass_id): string
158 {
159 return $this->_getPermanentLink($ref_id, [$ass_id, "received"]);
160 }
161
162 public function getReceivedFeedbackAppend(int $ass_id): array
163 {
164 return [$ass_id, "received"];
165 }
166
167 public function getOpenSubmissionsLink(int $ref_id, int $ass_id, int $user_id): string
168 {
169 return $this->_getPermanentLink($ref_id, [$ass_id, $user_id, "opensubmission"]);
170 }
171
172}
Exercise UI frontend presentation service class.
static setPermaLink(string $perma_link)
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:76
$request
@ilCtrl_Calls ilObjLearningSequenceContentGUI: ilObjLearningSequenceConditionsGUI
Definition: ltiauth.php:39
global $DIC
Definition: shib_login.php:26