167 : void
168 {
170
171 if (!$this->certificateSettings->get('active', '0')) {
172 $this->
ctrl->redirect($this);
173 }
174
177 $this->certificateLogger,
178 $this->language->txt('certificate_no_object_title')
179 );
180
183 $this->
user->getId(),
184 [
185 'order_field' => explode('_', $sorting)[0],
186 'order_direction' => explode('_', $sorting)[1],
187 'language' => $this->
user->getLanguage()
188 ],
189 []
190 );
191
192 $uiComponents = [];
193
194 if (count(
$data[
'items']) > 0) {
196 $cards = [];
197
198 foreach ($this->sortationOptions as $fieldAndDirection => $lngVariable) {
200 }
201
202 $sortViewControl = $this->uiFactory
203 ->viewControl()
205 ->withLabel($this->
language->txt($this->sortationOptions[$sorting]))
206 ->withTargetURL($this->
ctrl->getLinkTarget($this,
'applySortation'),
'sort_by');
207 $uiComponents[] = $sortViewControl;
208
209 foreach (
$data[
'items'] as $certificateData) {
210 $thumbnailImagePath = $certificateData['thumbnail_image_path'];
212 if ($thumbnailImagePath === null
213 || $thumbnailImagePath === ''
214 || !$this->
filesystem->has($thumbnailImagePath)
215 ) {
217 }
218
219 $cardImage = $this->uiFactory->image()->standard(
221 $certificateData['title']
222 );
223
224 $sections = [];
225
226 if ($certificateData['description'] !== '') {
227 $sections[] = $this->uiFactory->listing()->descriptive([
228 $this->
language->txt(
'cert_description_label') => $certificateData[
'description']
229 ]);
230 }
231
234 $sections[] = $this->uiFactory->listing()->descriptive([
237 )
238 ]);
240
241 $objectTypeIcon = $this->uiFactory
242 ->symbol()
243 ->icon()
244 ->standard($certificateData['obj_type'], $certificateData['obj_type']);
245
246 $objectTitle = $certificateData['title'];
248 if (count($refIds) > 0) {
249 foreach ($refIds as
$refId) {
250 if ($this->
access->checkAccess(
'read',
'', $refId)) {
251 $objectTitle = $this->uiRenderer->render(
253 );
254 break;
255 }
256 }
257 }
258
259 $sections[] = $this->uiFactory->listing()->descriptive([$this->
language->txt(
'cert_object_label') => implode(
260 '',
261 [
262 $this->uiRenderer->render($objectTypeIcon),
263 $objectTitle
264 ]
265 )
266 ]);
267
268 $this->
ctrl->setParameter($this,
'certificate_id', $certificateData[
'id']);
269 $downloadHref = $this->
ctrl->getLinkTarget($this,
'download');
270 $this->
ctrl->clearParameters($this);
271 $sections[] = $this->uiFactory->button()->standard('Download', $downloadHref);
272
273 $card = $this->uiFactory
274 ->card()
275 ->standard($certificateData['title'], $cardImage)
276 ->withSections($sections);
277
278 $cards[] = $card;
279 }
280
281 $deck = $this->uiFactory->deck($cards)->withSmallCardsSize();
282
283 $uiComponents[] = $this->uiFactory->divider()->horizontal();
284
285 $uiComponents[] = $deck;
286 } else {
287 $this->
template->setOnScreenMessage(
'info', $this->
language->txt(
'cert_currently_no_certs'));
288 }
289
290 $this->template->setContent($this->uiRenderer->render($uiComponents));
291 }
static useRelativeDates()
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
static getWebspaceDir(string $mode="filesystem")
get webspace directory
static _getLink(?int $a_ref_id, string $a_type='', array $a_params=array(), string $append="")
static _getAllReferences(int $id)
get all reference ids for object ID
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static signFile(string $path_to_file)