ILIAS  release_8 Revision v8.24
ilLTIConsumerSettingsGUI Class Reference
+ Collaboration diagram for ilLTIConsumerSettingsGUI:

Public Member Functions

 __construct (ilObjLTIConsumer $object, ilLTIConsumerAccess $access)
 ilLTIConsumerAccess constructor. More...
 
 executeCommand ()
 Execute Command. More...
 

Static Public Member Functions

static isUserDynamicRegistrationTransaction (ilLTIConsumeProvider $provider)
 

Data Fields

const SUBTAB_ID_OBJECT_SETTINGS = 'subtab_object_settings'
 
const SUBTAB_ID_PROVIDER_SETTINGS = 'subtab_provider_settings'
 
const SUBTAB_ID_CERTIFICATE = 'subtab_certificate'
 
const CMD_SHOW_SETTINGS = 'showSettings'
 
const CMD_SAVE_SETTINGS = 'saveSettings'
 
const CMD_DELIVER_CERTIFICATE = 'deliverCertificate'
 

Protected Member Functions

 initSubTabs ()
 
 needsProviderSettingsSubTab ()
 
 showSettingsCmd (ilLTIConsumerSettingsFormGUI $form=null)
 
 saveSettingsCmd ()
 
 buildForm ()
 
 deliverCertificateCmd ()
 

Protected Attributes

ilObjLTIConsumer $object
 
ilLTIConsumerAccess $access
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 

Detailed Description

Definition at line 32 of file class.ilLTIConsumerSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLTIConsumerSettingsGUI::__construct ( ilObjLTIConsumer  $object,
ilLTIConsumerAccess  $access 
)

ilLTIConsumerAccess constructor.

Definition at line 56 of file class.ilLTIConsumerSettingsGUI.php.

57 {
58 global $DIC;
59 $this->main_tpl = $DIC->ui()->mainTemplate();
60 $this->object = $object;
61 $this->access = $access;
62 }
global $DIC
Definition: feed.php:28

References $access, $DIC, $object, and ILIAS\Repository\access().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildForm()

ilLTIConsumerSettingsGUI::buildForm ( )
protected

Definition at line 209 of file class.ilLTIConsumerSettingsGUI.php.

210 {
211 global $DIC; /* @var \ILIAS\DI\Container $DIC */
212
214 $this->object,
215 $DIC->ctrl()->getFormAction($this),
216 self::CMD_SAVE_SETTINGS,
217 self::CMD_SHOW_SETTINGS
218 );
219
220 return $form;
221 }

References $DIC.

Referenced by saveSettingsCmd(), and showSettingsCmd().

+ Here is the caller graph for this function:

◆ deliverCertificateCmd()

ilLTIConsumerSettingsGUI::deliverCertificateCmd ( )
protected

Definition at line 223 of file class.ilLTIConsumerSettingsGUI.php.

223 : void
224 {
225 global $DIC; /* @var \ILIAS\DI\Container $DIC */
226
227 $validator = new ilCertificateDownloadValidator();
228
229 if (!$validator->isCertificateDownloadable($DIC->user()->getId(), $this->object->getId())) {
230 $this->main_tpl->setOnScreenMessage('failure', $DIC->language()->txt("permission_denied"), true);
231 $DIC->ctrl()->redirectByClass(ilObjLTIConsumerGUI::class, ilObjLTIConsumerGUI::DEFAULT_CMD);
232 }
233
234 $repository = new ilUserCertificateRepository();
235
236 $certLogger = $DIC->logger()->cert();
237 $pdfGenerator = new ilPdfGenerator($repository, $certLogger);
238
239 $pdfAction = new ilCertificatePdfAction(
240 $certLogger,
241 $pdfGenerator,
243 $DIC->language()->txt('error_creating_certificate_pdf')
244 );
245
246 $pdfAction->downloadPdf($DIC->user()->getId(), $this->object->getId());
247 }
Validates if an active certificate is stored in the database and can be downloaded by the user.
Just a wrapper class to create Unit Test for other classes.
Class ilPdfGeneratorConstantsTest.

References $DIC, and ilObjLTIConsumerGUI\DEFAULT_CMD.

◆ executeCommand()

ilLTIConsumerSettingsGUI::executeCommand ( )

Execute Command.

Definition at line 127 of file class.ilLTIConsumerSettingsGUI.php.

127 : void
128 {
129 global $DIC; /* @var \ILIAS\DI\Container $DIC */
130 $access = $DIC->access();
131
132 if (!$access->checkAccess('write', '', $this->object->getRefId())) {
133 $DIC->ui()->mainTemplate()->setOnScreenMessage('failure', $DIC->language()->txt('permission_denied'), true);
134 } else {
135
136 $this->initSubTabs();
137
138 $nc = $DIC->ctrl()->getNextClass();
139
140 switch ($nc) {
141 case strtolower(ilCertificateGUI::class):
142
143 $validator = new ilCertificateActiveValidator();
144
145 if (!$validator->validate()) {
146 throw new ilCmiXapiException('access denied!');
147 }
148
149 $DIC->tabs()->activateSubTab(self::SUBTAB_ID_CERTIFICATE);
150
151 $guiFactory = new ilCertificateGUIFactory();
152 $gui = $guiFactory->create($this->object);
153
154 $DIC->ctrl()->forwardCommand($gui);
155
156 break;
157
158 case strtolower(ilLTIConsumeProviderSettingsGUI::class):
159
160 $DIC->tabs()->activateSubTab(self::SUBTAB_ID_PROVIDER_SETTINGS);
161
162 $gui = new ilLTIConsumeProviderSettingsGUI($this->object, $this->access);
163 $DIC->ctrl()->forwardCommand($gui);
164 break;
165
166 default:
167 $DIC->tabs()->activateSubTab(self::SUBTAB_ID_OBJECT_SETTINGS);
168 $command = $DIC->ctrl()->getCmd(self::CMD_SHOW_SETTINGS) . 'Cmd';
169 $this->{$command}();
170
171 }
172 }
173 }
checkAccess(string $permission)

References $access, $DIC, ILIAS\Repository\access(), ilLTIConsumerAccess\checkAccess(), and initSubTabs().

+ Here is the call graph for this function:

◆ initSubTabs()

ilLTIConsumerSettingsGUI::initSubTabs ( )
protected

Definition at line 64 of file class.ilLTIConsumerSettingsGUI.php.

64 : void
65 {
66 global $DIC; /* @var \ILIAS\DI\Container $DIC */
67 $DIC->language()->loadLanguageModule('lti');
68
69 $DIC->tabs()->addSubTab(
70 self::SUBTAB_ID_OBJECT_SETTINGS,
71 $DIC->language()->txt(self::SUBTAB_ID_OBJECT_SETTINGS),
72 $DIC->ctrl()->getLinkTarget($this)
73 );
74
75 if ($this->needsProviderSettingsSubTab()) {
76 $DIC->tabs()->addSubTab(
77 self::SUBTAB_ID_PROVIDER_SETTINGS,
78 $DIC->language()->txt(self::SUBTAB_ID_PROVIDER_SETTINGS),
79 $DIC->ctrl()->getLinkTargetByClass(ilLTIConsumeProviderSettingsGUI::class)
80 );
81 }
82
83 $validator = new ilCertificateActiveValidator();
84
85 if ($validator->validate()) {
86 $DIC->tabs()->addSubTab(
87 self::SUBTAB_ID_CERTIFICATE,
88 $DIC->language()->txt(self::SUBTAB_ID_CERTIFICATE),
89 $DIC->ctrl()->getLinkTargetByClass(ilCertificateGUI::class, 'certificateEditor')
90 );
91 }
92 }

References $DIC, and needsProviderSettingsSubTab().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isUserDynamicRegistrationTransaction()

static ilLTIConsumerSettingsGUI::isUserDynamicRegistrationTransaction ( ilLTIConsumeProvider  $provider)
static

Definition at line 109 of file class.ilLTIConsumerSettingsGUI.php.

109 : bool
110 {
111 global $DIC;
112 if (!ilSession::has('lti_dynamic_registration_client_id')) {
113 return false;
114 }
115 if ($provider->getCreator() != $DIC->user()->getId()) {
116 return false;
117 }
118 if ($provider->getClientId() == ilSession::get('lti_dynamic_registration_client_id')) {
119 return true;
120 }
121 return false;
122 }
static get(string $a_var)
static has($a_var)
$provider
Definition: ltitoken.php:83

References $DIC, $provider, ilSession\get(), and ilSession\has().

Referenced by ilLTIConsumeProviderFormGUI\initToolConfigForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ needsProviderSettingsSubTab()

ilLTIConsumerSettingsGUI::needsProviderSettingsSubTab ( )
protected

Definition at line 94 of file class.ilLTIConsumerSettingsGUI.php.

94 : bool
95 {
96 global $DIC; /* @var \ILIAS\DI\Container $DIC */
97
98 if ($this->object->getProvider()->isGlobal()) {
99 return false;
100 }
101
102 if ($this->object->getProvider()->getCreator() != $DIC->user()->getId()) {
103 return false;
104 }
105
106 return true;
107 }

References $DIC, and ILIAS\Repository\object().

Referenced by initSubTabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveSettingsCmd()

ilLTIConsumerSettingsGUI::saveSettingsCmd ( )
protected

Definition at line 186 of file class.ilLTIConsumerSettingsGUI.php.

186 : void
187 {
188 global $DIC; /* @var \ILIAS\DI\Container $DIC */
189
190 $form = $this->buildForm();
191
192 if ($form->checkInput()) {
193 $oldMasteryScore = $this->object->getMasteryScore();
194
195 $form->initObject($this->object);
196 $this->object->update();
197
198 if ($oldMasteryScore !== $this->object->getMasteryScore()) {
200 }
201
202 $this->main_tpl->setOnScreenMessage('success', $DIC->language()->txt('msg_obj_modified'), true);
203 $DIC->ctrl()->redirect($this, self::CMD_SHOW_SETTINGS);
204 }
205
206 $this->showSettingsCmd($form);
207 }
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
showSettingsCmd(ilLTIConsumerSettingsFormGUI $form=null)

References $DIC, ilLPStatusWrapper\_refreshStatus(), buildForm(), ILIAS\Repository\object(), and showSettingsCmd().

+ Here is the call graph for this function:

◆ showSettingsCmd()

ilLTIConsumerSettingsGUI::showSettingsCmd ( ilLTIConsumerSettingsFormGUI  $form = null)
protected

Definition at line 175 of file class.ilLTIConsumerSettingsGUI.php.

175 : void
176 {
177 global $DIC; /* @var \ILIAS\DI\Container $DIC */
178
179 if ($form === null) {
180 $form = $this->buildForm();
181 }
182
183 $DIC->ui()->mainTemplate()->setContent($form->getHTML());
184 }

References $DIC, and buildForm().

Referenced by saveSettingsCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilLTIConsumerAccess ilLTIConsumerSettingsGUI::$access
protected

Definition at line 50 of file class.ilLTIConsumerSettingsGUI.php.

Referenced by __construct(), and executeCommand().

◆ $main_tpl

ilGlobalTemplateInterface ilLTIConsumerSettingsGUI::$main_tpl
private

Definition at line 51 of file class.ilLTIConsumerSettingsGUI.php.

◆ $object

ilObjLTIConsumer ilLTIConsumerSettingsGUI::$object
protected

Definition at line 45 of file class.ilLTIConsumerSettingsGUI.php.

Referenced by __construct().

◆ CMD_DELIVER_CERTIFICATE

const ilLTIConsumerSettingsGUI::CMD_DELIVER_CERTIFICATE = 'deliverCertificate'

◆ CMD_SAVE_SETTINGS

const ilLTIConsumerSettingsGUI::CMD_SAVE_SETTINGS = 'saveSettings'

Definition at line 39 of file class.ilLTIConsumerSettingsGUI.php.

◆ CMD_SHOW_SETTINGS

const ilLTIConsumerSettingsGUI::CMD_SHOW_SETTINGS = 'showSettings'

Definition at line 38 of file class.ilLTIConsumerSettingsGUI.php.

◆ SUBTAB_ID_CERTIFICATE

const ilLTIConsumerSettingsGUI::SUBTAB_ID_CERTIFICATE = 'subtab_certificate'

Definition at line 36 of file class.ilLTIConsumerSettingsGUI.php.

◆ SUBTAB_ID_OBJECT_SETTINGS

const ilLTIConsumerSettingsGUI::SUBTAB_ID_OBJECT_SETTINGS = 'subtab_object_settings'

Definition at line 34 of file class.ilLTIConsumerSettingsGUI.php.

◆ SUBTAB_ID_PROVIDER_SETTINGS

const ilLTIConsumerSettingsGUI::SUBTAB_ID_PROVIDER_SETTINGS = 'subtab_provider_settings'

Definition at line 35 of file class.ilLTIConsumerSettingsGUI.php.


The documentation for this class was generated from the following file: