ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

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

57  {
58  global $DIC;
59  $this->main_tpl = $DIC->ui()->mainTemplate();
60  $this->object = $object;
61  $this->access = $access;
62  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ buildForm()

ilLTIConsumerSettingsGUI::buildForm ( )
protected

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

References $DIC.

Referenced by saveSettingsCmd(), and showSettingsCmd().

203  {
204  global $DIC; /* @var \ILIAS\DI\Container $DIC */
205 
206  $form = new ilLTIConsumerSettingsFormGUI(
207  $this->object,
208  $DIC->ctrl()->getFormAction($this),
209  self::CMD_SAVE_SETTINGS,
210  self::CMD_SHOW_SETTINGS
211  );
212 
213  return $form;
214  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ deliverCertificateCmd()

ilLTIConsumerSettingsGUI::deliverCertificateCmd ( )
protected

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

References $DIC, ilObjLTIConsumerGUI\DEFAULT_CMD, and ilCertificatePdfAction\downloadPdf().

216  : void
217  {
218  global $DIC; /* @var \ILIAS\DI\Container $DIC */
219 
220  $validator = new ilCertificateDownloadValidator();
221 
222  if (!$validator->isCertificateDownloadable($DIC->user()->getId(), $this->object->getId())) {
223  $this->main_tpl->setOnScreenMessage('failure', $DIC->language()->txt("permission_denied"), true);
224  $DIC->ctrl()->redirectByClass(ilObjLTIConsumerGUI::class, ilObjLTIConsumerGUI::DEFAULT_CMD);
225  }
226 
227  $repository = new ilUserCertificateRepository();
228 
229  $certLogger = $DIC->logger()->cert();
230  $pdfGenerator = new ilPdfGenerator($repository);
231 
232  $pdfAction = new ilCertificatePdfAction(
233  $pdfGenerator,
235  $DIC->language()->txt('error_creating_certificate_pdf')
236  );
237 
238  $pdfAction->downloadPdf($DIC->user()->getId(), $this->object->getId());
239  }
Validates if an active certificate is stored in the database and can be downloaded by the user...
global $DIC
Definition: shib_login.php:22
downloadPdf(int $userId, int $objectId)
+ Here is the call graph for this function:

◆ executeCommand()

ilLTIConsumerSettingsGUI::executeCommand ( )

Execute Command.

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

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

127  : void
128  {
129  global $DIC; /* @var \ILIAS\DI\Container $DIC */
130 
131  $this->initSubTabs();
132 
133  $nc = $DIC->ctrl()->getNextClass();
134 
135  switch ($nc) {
136  case strtolower(ilCertificateGUI::class):
137 
138  $validator = new ilCertificateActiveValidator();
139 
140  if (!$validator->validate()) {
141  throw new ilCmiXapiException('access denied!');
142  }
143 
144  $DIC->tabs()->activateSubTab(self::SUBTAB_ID_CERTIFICATE);
145 
146  $guiFactory = new ilCertificateGUIFactory();
147  $gui = $guiFactory->create($this->object);
148 
149  $DIC->ctrl()->forwardCommand($gui);
150 
151  break;
152 
153  case strtolower(ilLTIConsumeProviderSettingsGUI::class):
154 
155  $DIC->tabs()->activateSubTab(self::SUBTAB_ID_PROVIDER_SETTINGS);
156 
157  $gui = new ilLTIConsumeProviderSettingsGUI($this->object, $this->access);
158  $DIC->ctrl()->forwardCommand($gui);
159  break;
160 
161  default:
162  $DIC->tabs()->activateSubTab(self::SUBTAB_ID_OBJECT_SETTINGS);
163  $command = $DIC->ctrl()->getCmd(self::CMD_SHOW_SETTINGS) . 'Cmd';
164  $this->{$command}();
165  }
166  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ initSubTabs()

ilLTIConsumerSettingsGUI::initSubTabs ( )
protected

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

References $DIC, and needsProviderSettingsSubTab().

Referenced by executeCommand().

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  }
global $DIC
Definition: shib_login.php:22
+ 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.

References $DIC, ilSession\get(), ilLTIConsumeProvider\getClientId(), ilLTIConsumeProvider\getCreator(), and ilSession\has().

Referenced by ilLTIConsumeProviderFormGUI\initToolConfigForm().

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)
global $DIC
Definition: shib_login.php:22
static has($a_var)
+ 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.

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

Referenced by initSubTabs().

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  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveSettingsCmd()

ilLTIConsumerSettingsGUI::saveSettingsCmd ( )
protected

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

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

179  : void
180  {
181  global $DIC; /* @var \ILIAS\DI\Container $DIC */
182 
183  $form = $this->buildForm();
184 
185  if ($form->checkInput()) {
186  $oldMasteryScore = $this->object->getMasteryScore();
187 
188  $form->initObject($this->object);
189  $this->object->update();
190 
191  if ($oldMasteryScore !== $this->object->getMasteryScore()) {
192  ilLPStatusWrapper::_refreshStatus($this->object->getId());
193  }
194 
195  $this->main_tpl->setOnScreenMessage('success', $DIC->language()->txt('msg_obj_modified'), true);
196  $DIC->ctrl()->redirect($this, self::CMD_SHOW_SETTINGS);
197  }
198 
199  $this->showSettingsCmd($form);
200  }
global $DIC
Definition: shib_login.php:22
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
showSettingsCmd(?ilLTIConsumerSettingsFormGUI $form=null)
+ Here is the call graph for this function:

◆ showSettingsCmd()

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

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

References $DIC, buildForm(), and null.

Referenced by saveSettingsCmd().

168  : void
169  {
170  global $DIC; /* @var \ILIAS\DI\Container $DIC */
171 
172  if ($form === null) {
173  $form = $this->buildForm();
174  }
175 
176  $DIC->ui()->mainTemplate()->setContent($form->getHTML());
177  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ 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().

◆ $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: