59 $this->ref_id = $a_ref_id;
60 $this->logger =
$GLOBALS[
'DIC']->logger()->lti();
61 $this->ctrl =
$GLOBALS[
'DIC']->ctrl();
62 $this->tpl =
$GLOBALS[
'DIC']->ui()->mainTemplate();
64 $this->lng =
$GLOBALS[
'DIC']->language();
65 $this->lng->loadLanguageModule(
'lti');
76 $this->logger->debug(
'No LTI consumers activated for object type: ' .
ilObject::_lookupType($this->ref_id,
true));
79 $access =
$GLOBALS[
'DIC']->rbac()->system();
80 return $access->checkAccess(
92 $this->custom_roles = $a_roles;
101 $this->use_lti_roles = $a_stat;
110 $cmd = $this->ctrl->getCmd(
'settings');
111 $next_class = $this->ctrl->getNextClass($this);
113 switch ($next_class) {
129 $this->tpl->setContent(
$form->getHTML());
139 $form->setFormAction($this->ctrl->getFormAction($this));
140 $form->setTitle($this->lng->txt(
'lti_object_release_settings_form'));
142 foreach (ilObjLTIAdministration::getEnabledConsumersForType(
ilObject::_lookupType($this->ref_id,
true)) as $global_consumer) {
145 $this->logger->debug($object_info->getAdminRole());
150 $section->setTitle($global_consumer->getTitle());
151 $section->setInfo($global_consumer->getDescription());
157 $global_consumer->getExtConsumerId(),
162 $active =
new ilCheckboxInputGUI(
$GLOBALS[
'lng']->txt(
'lti_obj_active'),
'lti_active_' . $global_consumer->getExtConsumerId());
164 $active->setValue(1);
165 $form->addItem($active);
167 if ($active_consumer->getEnabled()) {
168 $active->setChecked(
true);
171 $url->setValue(ILIAS_HTTP_PATH .
'/lti.php?client_id=' . CLIENT_ID);
172 $active->addSubItem(
$url);
175 $key->setValue($active_consumer->getKey());
176 $active->addSubItem(
$key);
179 $secret->setValue($active_consumer->getSecret());
183 if ($this->custom_roles) {
185 $this->lng->txt(
'lti_admin'),
186 'lti_admin_' . $global_consumer->getExtConsumerId()
189 $admin->setValue($object_info->getAdminRole() ? $object_info->getAdminRole() : 0);
190 $active->addSubItem($admin);
193 $this->lng->txt(
'lti_tutor'),
194 'lti_tutor_' . $global_consumer->getExtConsumerId()
197 $tutor->setValue($object_info->getTutorRole() ? $object_info->getTutorRole() : 0);
198 $active->addSubItem($tutor);
201 $this->lng->txt(
'lti_member'),
202 'lti_member_' . $global_consumer->getExtConsumerId()
205 $member->setValue($object_info->getMemberRole() ? $object_info->getMemberRole() : 0);
206 $active->addSubItem($member);
210 $form->addCommandButton(
'updateSettings', $this->lng->txt(
'save'));
220 if (!
$form->checkInput()) {
221 $form->setValuesByPost();
227 foreach (ilObjLTIAdministration::getEnabledConsumersForType(
ilObject::_lookupType($this->ref_id,
true)) as $global_consumer) {
231 $global_consumer->getExtConsumerId(),
235 if (!
$form->getInput(
'lti_active_' . $global_consumer->getExtConsumerId())) {
237 if ($consumer->getEnabled()) {
238 $this->logger->info(
'Deleting lti consumer for object reference: ' . $this->ref_id);
243 if (!$consumer->getEnabled()) {
244 $this->logger->info(
'Created new lti release for: ' . $this->ref_id);
245 $consumer->setExtConsumerId($global_consumer->getExtConsumerId());
246 $consumer->createSecret();
247 $consumer->setRefId($this->ref_id);
248 $consumer->setEnabled(
true);
249 $consumer->saveLTI($connector);
255 $this->ctrl->redirect($this,
'settings');
267 $admin_role = $form->
getInput(
'lti_admin_' . $global_consumer_id);
268 if ($admin_role > 0) {
269 $object_info->setAdminRole($admin_role);
271 $tutor_role = $form->
getInput(
'lti_tutor_' . $global_consumer_id);
272 if ($tutor_role > 0) {
273 $object_info->setTutorRole($tutor_role);
275 $member_role = $form->
getInput(
'lti_member_' . $global_consumer_id);
276 if ($member_role > 0) {
277 $object_info->setMemberRole($member_role);
279 $object_info->save();
290 $options[0] = $this->lng->txt(
'select_one');
291 foreach ($this->custom_roles as $role_id) {
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
saveRoleSelection(ilPropertyFormGUI $form, $global_consumer_id)
Save role selection for consumer.
getRoleSelection()
Get role selection.
Class to represent an LTI Data Connector for ILIAS.
offerLTIRolesForSelection($a_stat)
Offer LTI roles for mapping.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static _lookupTitle($a_id)
lookup object title
setCustomRolesForSelection($a_roles)
Set custom roles for mapping to LTI roles.
if(isset($_POST['submit'])) $form
GUI class for LTI provider object settings.
static lookupLTISettingsRefId()
Lookup ref_id.
hasSettingsAccess()
Check if user has access to lti settings.
settings(ilPropertyFormGUI $form=null)
Show settings.
static _getTranslation($a_role_title)
static _lookupType($a_id, $a_reference=false)
lookup object type
initObjectSettingsForm()
Init object settings form.
executeCommand()
Ctrl execute command.
updateSettings()
Update settings (activate deactivate lti access)
This class represents a non editable value in a property form.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options