ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLTIConsumerSettingsGUI Class Reference
+ Collaboration diagram for ilLTIConsumerSettingsGUI:

Public Member Functions

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

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

 $object
 
 $access
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

ilLTIConsumerAccess constructor.

Parameters
ilObjLTIConsumer$object

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

References $access, and $object.

Member Function Documentation

◆ buildForm()

ilLTIConsumerSettingsGUI::buildForm ( )
protected

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

References $DIC.

Referenced by saveSettingsCmd(), and showSettingsCmd().

172  {
173  global $DIC; /* @var \ILIAS\DI\Container $DIC */
174 
175  $form = new ilLTIConsumerSettingsFormGUI(
176  $this->object,
177  $DIC->ctrl()->getFormAction($this),
178  self::CMD_SAVE_SETTINGS,
179  self::CMD_SHOW_SETTINGS
180  );
181 
182  return $form;
183  }
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ deliverCertificateCmd()

ilLTIConsumerSettingsGUI::deliverCertificateCmd ( )
protected

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

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

186  {
187  global $DIC; /* @var \ILIAS\DI\Container $DIC */
188 
189  $validator = new ilCertificateDownloadValidator();
190 
191  if (!$validator->isCertificateDownloadable((int) $DIC->user()->getId(), (int) $this->object->getId())) {
192  ilUtil::sendFailure($DIC->language()->txt("permission_denied"), true);
193  $DIC->ctrl()->redirectByClass(ilObjLTIConsumerGUI::class, ilObjLTIConsumerGUI::DEFAULT_CMD);
194  }
195 
196  $repository = new ilUserCertificateRepository();
197 
198  $certLogger = $DIC->logger()->cert();
199  $pdfGenerator = new ilPdfGenerator($repository, $certLogger);
200 
201  $pdfAction = new ilCertificatePdfAction(
202  $certLogger,
203  $pdfGenerator,
205  $DIC->language()->txt('error_creating_certificate_pdf')
206  );
207 
208  $pdfAction->downloadPdf((int) $DIC->user()->getId(), (int) $this->object->getId());
209  }
Class ilPdfGeneratorConstantsTest.
Validates if an active certificate is stored in the database and can be downloaded by the user...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Just a wrapper class to create Unit Test for other classes.
$DIC
Definition: xapitoken.php:46
downloadPdf(int $userId, int $objectId)
+ Here is the call graph for this function:

◆ executeCommand()

ilLTIConsumerSettingsGUI::executeCommand ( )

Execute Command.

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

References $DIC, and initSubTabs().

95  {
96  global $DIC; /* @var \ILIAS\DI\Container $DIC */
97 
98  $this->initSubTabs();
99 
100  $nc = $DIC->ctrl()->getNextClass();
101 
102  switch ($nc) {
103  case strtolower(ilCertificateGUI::class):
104 
105  $validator = new ilCertificateActiveValidator();
106 
107  if (!$validator->validate()) {
108  throw new ilCmiXapiException('access denied!');
109  }
110 
111  $DIC->tabs()->activateSubTab(self::SUBTAB_ID_CERTIFICATE);
112 
113  $guiFactory = new ilCertificateGUIFactory();
114  $gui = $guiFactory->create($this->object);
115 
116  $DIC->ctrl()->forwardCommand($gui);
117 
118  break;
119 
120  case strtolower(ilLTIConsumeProviderSettingsGUI::class):
121 
122  $DIC->tabs()->activateSubTab(self::SUBTAB_ID_PROVIDER_SETTINGS);
123 
124  $gui = new ilLTIConsumeProviderSettingsGUI($this->object, $this->access);
125  $DIC->ctrl()->forwardCommand($gui);
126  break;
127 
128  default:
129 
130  $DIC->tabs()->activateSubTab(self::SUBTAB_ID_OBJECT_SETTINGS);
131 
132  $command = $DIC->ctrl()->getCmd(self::CMD_SHOW_SETTINGS) . 'Cmd';
133  $this->{$command}();
134  }
135  }
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ initSubTabs()

ilLTIConsumerSettingsGUI::initSubTabs ( )
protected

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

References $DIC, and needsProviderSettingsSubTab().

Referenced by executeCommand().

48  {
49  global $DIC; /* @var \ILIAS\DI\Container $DIC */
50  $DIC->language()->loadLanguageModule('lti');
51  $DIC->tabs()->addSubTab(
52  self::SUBTAB_ID_OBJECT_SETTINGS,
53  $DIC->language()->txt(self::SUBTAB_ID_OBJECT_SETTINGS),
54  $DIC->ctrl()->getLinkTarget($this)
55  );
56 
57  if ($this->needsProviderSettingsSubTab()) {
58  $DIC->tabs()->addSubTab(
59  self::SUBTAB_ID_PROVIDER_SETTINGS,
60  $DIC->language()->txt(self::SUBTAB_ID_PROVIDER_SETTINGS),
61  $DIC->ctrl()->getLinkTargetByClass(ilLTIConsumeProviderSettingsGUI::class)
62  );
63  }
64 
65  $validator = new ilCertificateActiveValidator();
66 
67  if ($validator->validate()) {
68  $DIC->tabs()->addSubTab(
69  self::SUBTAB_ID_CERTIFICATE,
70  $DIC->language()->txt(self::SUBTAB_ID_CERTIFICATE),
71  $DIC->ctrl()->getLinkTargetByClass(ilCertificateGUI::class, 'certificateEditor')
72  );
73  }
74  }
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ needsProviderSettingsSubTab()

ilLTIConsumerSettingsGUI::needsProviderSettingsSubTab ( )
protected

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

References $DIC.

Referenced by initSubTabs().

77  {
78  global $DIC; /* @var \ILIAS\DI\Container $DIC */
79 
80  if ($this->object->getProvider()->isGlobal()) {
81  return false;
82  }
83 
84  if ($this->object->getProvider()->getCreator() != $DIC->user()->getId()) {
85  return false;
86  }
87 
88  return true;
89  }
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ saveSettingsCmd()

ilLTIConsumerSettingsGUI::saveSettingsCmd ( )
protected

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

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

149  {
150  global $DIC; /* @var \ILIAS\DI\Container $DIC */
151 
152  $form = $this->buildForm();
153 
154  if ($form->checkInput()) {
155  $oldMasteryScore = $this->object->getMasteryScore();
156 
157  $form->initObject($this->object);
158  $this->object->update();
159 
160  if ($oldMasteryScore != $this->object->getMasteryScore()) {
161  ilLPStatusWrapper::_refreshStatus($this->object->getId());
162  }
163 
164  ilUtil::sendSuccess($DIC->language()->txt('msg_obj_modified'), true);
165  $DIC->ctrl()->redirect($this, self::CMD_SHOW_SETTINGS);
166  }
167 
168  $this->showSettingsCmd($form);
169  }
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
showSettingsCmd(ilLTIConsumerSettingsFormGUI $form=null)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ showSettingsCmd()

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

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

References $DIC, and buildForm().

Referenced by saveSettingsCmd().

138  {
139  global $DIC; /* @var \ILIAS\DI\Container $DIC */
140 
141  if ($form === null) {
142  $form = $this->buildForm();
143  }
144 
145  $DIC->ui()->mainTemplate()->setContent($form->getHTML());
146  }
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilLTIConsumerSettingsGUI::$access
protected

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

Referenced by __construct().

◆ $object

ilLTIConsumerSettingsGUI::$object
protected

Definition at line 30 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 24 of file class.ilLTIConsumerSettingsGUI.php.

◆ CMD_SHOW_SETTINGS

const ilLTIConsumerSettingsGUI::CMD_SHOW_SETTINGS = 'showSettings'

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

◆ SUBTAB_ID_CERTIFICATE

const ilLTIConsumerSettingsGUI::SUBTAB_ID_CERTIFICATE = 'subtab_certificate'

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

◆ SUBTAB_ID_OBJECT_SETTINGS

const ilLTIConsumerSettingsGUI::SUBTAB_ID_OBJECT_SETTINGS = 'subtab_object_settings'

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

◆ SUBTAB_ID_PROVIDER_SETTINGS

const ilLTIConsumerSettingsGUI::SUBTAB_ID_PROVIDER_SETTINGS = 'subtab_provider_settings'

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


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