ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjCmiXapiListGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
31{
32 public function init(): void
33 {
34 global $DIC; /* @var \ILIAS\DI\Container $DIC */
35
36 $this->static_link_enabled = true; // Create static links for default command (linked title) or not
37 $this->delete_enabled = true;
38 $this->cut_enabled = true;
39 $this->subscribe_enabled = false;
40 $this->link_enabled = true;
41 $this->copy_enabled = true;
42 $this->progress_enabled = true;
43 $this->notice_properties_enabled = true;
44 $this->info_screen_enabled = true;
45 $this->type = "cmix";
46 $this->gui_class_name = "ilObjCmiXapiGUI";
47
48 $this->commands = ilObjCmiXapiAccess::_getCommands();
49
50 $DIC->language()->loadLanguageModule('cmix');
51 }
52
56 public function getProperties(): array
57 {
58 global $DIC; /* @var \ILIAS\DI\Container $DIC */
59
60 $props = array();
61
62 if (ilObjCmiXapiAccess::_isOffline($this->obj_id)) {
63 $props[] = array("alert" => true, "property" => $DIC->language()->txt("status"),
64 "value" => $DIC->language()->txt("offline"));
65 }
66
67 $props[] = array(
68 'alert' => false, 'property' => $DIC->language()->txt('type'),
69 'value' => $DIC->language()->txt('obj_cmix')
70 );
71
72 $validator = new ilCertificateDownloadValidator();
73 if ($validator->isCertificateDownloadable((int) $DIC->user()->getId(), $this->obj_id)) {
74 $DIC->ctrl()->setParameterByClass(ilCmiXapiSettingsGUI::class, 'ref_id', $this->ref_id);
75
76 $certLink = $DIC->ui()->factory()->link()->standard(
77 $DIC->language()->txt('download_certificate'),
78 $DIC->ctrl()->getLinkTargetByClass(
79 [ilObjCmiXapiGUI::class, ilCmiXapiSettingsGUI::class],
81 )
82 );
83
84 $props[] = array(
85 'alert' => false, 'property' => $DIC->language()->txt('certificate'),
86 'value' => $DIC->ui()->renderer()->render($certLink)
87 );
88 }
89
90 return $props;
91 }
92
93 public function getCommandLink(string $cmd): string
94 {
95 global $ilCtrl;
96
97 $cmd = explode('::', $cmd);
98
99 if (count($cmd) == 2) {
100 $cmd_link = $ilCtrl->getLinkTargetByClass(array('ilRepositoryGUI', 'ilObjCmiXapiGUI', $cmd[0]), $cmd[1]);
101 } else {
102 $cmd_link = $ilCtrl->getLinkTargetByClass(array('ilRepositoryGUI', 'ilObjCmiXapiGUI'), $cmd[0]);
103 }
104
105 return $cmd_link;
106 }
107}
Validates if an active certificate is stored in the database and can be downloaded by the user.
getCommandLink(string $cmd)
Get command link url.
static _isOffline(int $obj_id)
Type-specific implementation of general status, has to be overwritten if object type does not support...
global $DIC
Definition: shib_login.php:26