4 require_once
'Services/Object/classes/class.ilObjectGUI.php';
6 require_once
'Services/LTI/classes/InternalProvider/class.ilLTIToolConsumer.php';
7 require_once
'Services/LTI/classes/class.ilLTIDataConnector.php';
29 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
35 $GLOBALS[
'DIC']->language()->loadLanguageModule(
'lti');
40 $next_class = $this->ctrl->getNextClass($this);
41 $cmd = $this->ctrl->getCmd();
45 switch ($next_class) {
46 case 'ilpermissiongui':
47 $GLOBALS[
'ilTabs']->activateTab(
'perm_settings');
48 require_once
'Services/AccessControl/classes/class.ilPermissionGUI.php';
50 $this->ctrl->forwardCommand($perm_gui);
53 case 'illticonsumeradministrationgui':
54 $this->tabs_gui->activateTab(
'lti_consuming');
56 $this->ctrl->forwardCommand($gui);
60 $this->tabs_gui->activateTab(
'lti_providing');
61 if (!$cmd || $cmd ==
'view') {
62 $cmd =
'listConsumers';
63 } elseif ($cmd ==
'createconsumer') {
64 $cmd =
"initConsumerForm";
81 $DIC->help()->setScreenIdComponent(
"ltis");
83 if ($rbacsystem->checkAccess(
"visible,read", $this->object->getRefId())) {
84 $this->tabs_gui->addTab(
86 $this->lng->txt(
"lti_providing_tab"),
87 $this->ctrl->getLinkTarget($this,
"listConsumers")
90 $this->tabs_gui->addTab(
92 $this->lng->txt(
"lti_consuming_tab"),
93 $this->ctrl->getLinkTargetByClass(
'ilLTIConsumerAdministrationGUI')
96 if ($DIC->ctrl()->getCmdClass() ==
'ilobjltiadministrationgui') {
101 if ($rbacsystem->checkAccess(
'edit_permission', $this->object->getRefId())) {
102 $this->tabs_gui->addTab(
104 $this->lng->txt(
"perm_settings"),
105 $this->ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm")
115 if (
$rbacsystem->checkAccess(
"visible,read", $this->object->getRefId())) {
121 $this->tabs_gui->addSubTab(
123 $this->lng->txt(
"consumers"),
124 $this->ctrl->getLinkTarget($this,
"listConsumers")
127 if (
$rbacsystem->checkAccess(
"visible,read", $this->object->getRefId())) {
128 $this->tabs_gui->addSubTab(
130 $this->lng->txt(
"lti_released_objects"),
131 $this->ctrl->getLinkTarget($this,
"releasedObjects")
141 $this->tabs_gui->activateSubTab(
"settings");
142 $this->tpl->setContent($form->getHTML());
148 require_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
211 $rbacadmin = $DIC[
'rbacadmin'];
214 $role->setTitle(
"il_lti_global_role");
215 $role->setDescription(
"This global role should only contain the permission 'read' for repository and categories.");
217 $rbacadmin->assignRoleToFolder($role->getId(), 8,
'y');
218 $rbacadmin->setProtected(8, $role->getId(),
'y');
219 $rbacadmin->setRolePermission($role->getId(),
'root', [3], 8);
220 $rbacadmin->setRolePermission($role->getId(),
'cat', [3], 8);
222 $role->changeExistingObjects(
229 ilUtil::sendSuccess($this->lng->txt(
"lti_user_role_created"),
true);
241 $this->tpl->setContent($form->getHTML());
250 $this->tabs_gui->activateSubTab(
"consumers");
252 require_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
256 $ti_title =
new ilTextInputGUI($this->lng->txt(
"title"),
'title');
257 $ti_title->setRequired(
true);
258 $ti_description =
new ilTextInputGUI($this->lng->txt(
"description"),
'description');
259 $ti_prefix =
new ilTextInputGUI($this->lng->txt(
"prefix"),
'prefix');
261 #$ti_key = new ilTextInputGUI($this->lng->txt("lti_consumer_key"), 'key'); 262 #$ti_key->setRequired(true); 263 #$ti_secret = new ilTextInputGUI($this->lng->txt("lti_consumer_secret"), 'secret'); 264 #$ti_secret->setRequired(true); 266 $languages = $this->lng->getInstalledLanguages();
267 $array_lang = array();
268 foreach ($languages as $lang_key) {
272 $si_language =
new ilSelectInputGUI($this->lng->txt(
"language"),
"language");
273 $si_language->setOptions($array_lang);
277 $form->addItem($cb_active);
278 $form->addItem($ti_title);
279 $form->addItem($ti_description);
280 $form->addItem($ti_prefix);
281 #$form->addItem($ti_key); 282 #$form->addItem($ti_secret); 283 $form->addItem($si_language);
288 $valid_obj_types = $this->
object->getLTIObjectTypes();
289 foreach ($valid_obj_types as $obj_type) {
290 $object_name =
$GLOBALS[
'DIC']->language()->txt(
'objs_' . $obj_type);
293 $form->addItem($cb_obj_types);
296 $roles = $this->
object->getLTIRoles();
297 foreach ($roles as $role_id => $role_name) {
298 $options[$role_id] = $role_name;
300 $si_roles =
new ilSelectInputGUI($this->lng->txt(
"gbl_roles_to_users"),
'role');
301 $si_roles->setOptions($options);
302 $form->addItem($si_roles);
304 if ($a_mode ==
'edit') {
305 $form->setFormAction($this->ctrl->getFormAction($this,
'editLTIConsumer'));
306 $form->setTitle($this->lng->txt(
"lti_edit_consumer"));
307 $form->addCommandButton(
"updateLTIConsumer", $this->lng->txt(
"save"));
309 $form->setFormAction($this->ctrl->getFormAction($this,
'createLTIConsumer'));
310 $form->setTitle($this->lng->txt(
"lti_create_consumer"));
311 $form->addCommandButton(
"createLTIConsumer", $this->lng->txt(
"save"));
312 $form->addCommandButton(
'listConsumers', $this->lng->txt(
'cancel'));
326 global $ilCtrl,
$tpl;
327 $consumer_id = $_REQUEST[
"cid"];
328 $ilCtrl->setParameter($this,
"cid", $consumer_id);
331 $ilCtrl->redirect($this,
"listConsumers");
337 $a_form->getItemByPostVar(
"title")->setValue($consumer->getTitle());
338 $a_form->getItemByPostVar(
"description")->setValue($consumer->getDescription());
339 $a_form->getItemByPostVar(
"prefix")->setValue($consumer->getPrefix());
340 $a_form->getItemByPostVar(
"language")->setValue($consumer->getLanguage());
341 $a_form->getItemByPostVar(
"active")->setChecked($consumer->getActive());
342 $a_form->getItemByPostVar(
"role")->setValue($consumer->getRole());
343 $a_form->getItemByPostVar(
"types")->setValue($this->object->getActiveObjectTypes($consumer_id));
345 $tpl->setContent($a_form->getHTML());
357 if ($form->checkInput()) {
361 $consumer->setTitle($form->getInput(
'title'));
362 $consumer->setDescription($form->getInput(
'description'));
363 $consumer->setPrefix($form->getInput(
'prefix'));
364 $consumer->setLanguage($form->getInput(
'language'));
365 $consumer->setActive($form->getInput(
'active'));
366 $consumer->setRole($form->getInput(
'role'));
367 $consumer->saveGlobalToolConsumerSettings($this->dataConnector);
369 $this->
object->saveConsumerObjectTypes(
370 $consumer->getExtConsumerId(),
371 $form->getInput(
'types')
373 ilUtil::sendSuccess($this->lng->txt(
"lti_consumer_created"),
true);
374 $GLOBALS[
'DIC']->ctrl()->redirect($this,
'listConsumers');
377 $form->setValuesByPost();
392 $consumer_id = $_REQUEST[
"cid"];
394 $ilCtrl->redirect($this,
"listConsumers");
397 $ilCtrl->setParameter($this,
"cid", $consumer_id);
401 if ($form->checkInput()) {
402 $consumer->setTitle($form->getInput(
'title'));
403 $consumer->setDescription($form->getInput(
'description'));
404 $consumer->setPrefix($form->getInput(
'prefix'));
405 $consumer->setLanguage($form->getInput(
'language'));
406 $consumer->setActive($form->getInput(
'active'));
407 $consumer->setRole($form->getInput(
'role'));
408 $consumer->saveGlobalToolConsumerSettings($this->dataConnector);
409 $this->
object->saveConsumerObjectTypes($consumer_id, $form->getInput(
'types'));
411 ilUtil::sendSuccess($this->lng->txt(
"lti_consumer_updated"),
true);
424 $consumer_id = $_REQUEST[
'cid'];
427 $ilCtrl->redirect($this,
"listConsumers");
430 $consumer->deleteGlobalToolConsumerSettings($this->dataConnector);
431 ilUtil::sendSuccess($this->lng->txt(
"lti_consumer_deleted"),
true);
432 $GLOBALS[
'DIC']->ctrl()->redirect($this,
'listConsumers');
443 global $ilAccess, $ilToolbar;
446 $ilToolbar->addButton(
447 $this->lng->txt(
'lti_create_consumer'),
448 $this->ctrl->getLinkTarget($this,
'createconsumer')
451 $ilToolbar->addButton(
452 $this->lng->txt(
'lti_create_lti_user_role'),
453 $this->ctrl->getLinkTarget($this,
'createLtiUserRole')
455 $ilToolbar->addText($this->lng->txt(
'lti_user_role_info'));
459 $this->tabs_gui->activateSubTab(
"consumers");
461 include_once
"Services/LTI/classes/Consumer/class.ilLTIConsumerTableGUI.php";
467 $this->tpl->setContent($tbl->getHTML());
478 $consumer_id = $_REQUEST[
"cid"];
481 $ilCtrl->redirect($this,
"listConsumers");
485 if ($consumer->getActive()) {
486 $consumer->setActive(0);
487 $msg =
"lti_consumer_set_inactive";
489 $consumer->setActive(1);
490 $msg =
"lti_consumer_set_active";
492 $consumer->saveGlobalToolConsumerSettings($this->dataConnector);
493 ilUtil::sendSuccess($this->lng->txt($msg),
true);
495 $GLOBALS[
'DIC']->ctrl()->redirect($this,
'listConsumers');
503 $GLOBALS[
'DIC']->tabs()->activateSubTab(
'releasedObjects');
509 $GLOBALS[
'DIC']->ui()->mainTemplate()->setContent($table->getHTML());
editConsumer(ilPropertyFormGUI $a_form=null)
Edit consumer type $ilCtrl type $tpl.
changeStatusLTIConsumer()
Change activation status type $ilCtrl.
This class represents an option in a checkbox group.
Class ilObjLTIAdministrationGUI.
createLTIConsumer()
Create new lti consumer.
Class to represent an LTI Data Connector for ILIAS.
$dataConnector
Data connector object or string.
deleteLTIConsumer()
Delete consumers type $ilCtrl.
updateLTIConsumer()
Update lti consumer settings ilCtrl $ilCtrl.
static _lookupEntry($a_lang_key, $a_mod, $a_id)
initSettingsForm(ilPropertyFormGUI $form=null)
initConsumerForm(ilPropertyFormGUI $form=null)
getConsumerForm($a_mode='')
prepareOutput($a_show_subobjects=true)
prepare output
TableGUI class for LTI consumer listing.
Class ilObjectGUI Basic methods of all Output classes.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Description of class class.
listConsumers()
List consumers type $ilAccess type $ilToolbar.
__construct(Container $dic, ilPlugin $plugin)
const MODE_UNPROTECTED_KEEP_LOCAL_POLICIES
releasedObjects()
Show relases objects.
static _getIdsForTitle($title, $type='', $partialmatch=false)
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.