ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjLTIConsumerGUI Class Reference
+ Inheritance diagram for ilObjLTIConsumerGUI:
+ Collaboration diagram for ilObjLTIConsumerGUI:

Public Member Functions

 __construct (int $a_id=0, int $a_id_type=self::REPOSITORY_NODE_ID, int $a_parent_node_id=0)
 
 getType ()
 
 initDynRegForm (string $a_new_type)
 
 initShowToolConfig (string $a_new_type, int $a_provider_id)
 
 initCustomCreateForm (string $a_new_type)
 
 saveCustom ()
 
 addDynReg ()
 
 cancelDynReg ()
 
 showToolConfig ()
 
 saveDynReg ()
 
 contentSelection (string $providerId, string $newType, string $refId, ilLTIConsumeProvider $provider)
 
 contentSelectionRequest ()
 
 contentSelectionResponse ()
 
 cancelContentSelection ()
 
 saveContentSelection (ilLTIConsumeProvider $provider, string $token)
 
 initMetadata (\ilObject $object)
 
- Public Member Functions inherited from ilObject2GUI
 __construct (int $id=0, int $id_type=self::REPOSITORY_NODE_ID, int $parent_node_id=0)
 
 executeCommand ()
 execute command More...
 
 getIdType ()
 
 delete ()
 Display delete confirmation form (repository/workspace switch) More...
 
 confirmedDelete ()
 Delete objects (repository/workspace switch) More...
 
 getHTML ()
 
 withReferences ()
 Final/Private declaration of unchanged parent methods. More...
 
 setCreationMode (bool $mode=true)
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 isVisible (int $ref_id, string $type)
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 cancelDelete ()
 
 view ()
 view object content (repository/workspace switch) More...
 
 getType ()
 Functions that must be overwritten. More...
 
 create ()
 CRUD. More...
 
 save ()
 
 edit ()
 
 update ()
 
 cancel ()
 
 importFile ()
 
 putObjectInTree (ilObject $obj, int $parent_node_id=null)
 Add object to tree at given position. More...
 
- Public Member Functions inherited from ilObjectGUI
 __construct ($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
 
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 if true, a creation screen is displayed the current [ref_id] don't belong to the current class! The mode is determined in ilRepositoryGUI More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html Should be overwritten and redirect to settings screen. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Static Public Member Functions

static _goto (string $a_target)
 
- Static Public Member Functions inherited from ilObject2GUI
static handleAfterSaveCallback (ilObject $obj, ?int $callback_ref_id)
 After creation callback. More...
 
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 

Data Fields

const CFORM_CUSTOM_NEW = 99
 
const CFORM_DYNAMIC_REGISTRATION = 98
 
const TAB_ID_INFO = 'tab_info'
 
const TAB_ID_CONTENT = 'tab_content'
 
const TAB_ID_SETTINGS = 'tab_settings'
 
const TAB_ID_STATEMENTS = 'tab_statements'
 
const TAB_ID_SCORING = 'tab_scoring'
 
const TAB_ID_GRADE_SYNCHRONIZATION = 'tab_grade_synchronization'
 
const TAB_ID_METADATA = 'tab_metadata'
 
const TAB_ID_LEARNING_PROGRESS = 'learning_progress'
 
const TAB_ID_PERMISSIONS = 'perm_settings'
 
const DEFAULT_CMD = 'launch'
 
ilObject $object = null
 
int $parent_node_id = 0
 
- Data Fields inherited from ilObject2GUI
const OBJECT_ID = 0
 
const REPOSITORY_NODE_ID = 1
 
const WORKSPACE_NODE_ID = 2
 
const REPOSITORY_OBJECT_ID = 3
 
const WORKSPACE_OBJECT_ID = 4
 
const PORTFOLIO_OBJECT_ID = 5
 
- Data Fields inherited from ilObjectGUI
const ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Protected Member Functions

 initCreationForms (string $a_new_type)
 
 initCreateForm (string $a_new_type)
 
 buildProviderSelectionForm (string $a_new_type)
 
 applyProviderFilter ()
 
 resetProviderFilter ()
 
 createNewObject (string $newType, string $title, string $description)
 
 afterSave (\ilObject $newObject)
 
 initHeaderAction (?string $a_sub_type=null, ?int $a_sub_id=null)
 
 checkContentSelection ()
 
 setTabs ()
 
 addLocatorItems ()
 
 trackObjectReadEvent ()
 
 infoScreen ()
 
 infoScreenForward ()
 
 handleAvailablityMessage ()
 
 getRequestValue (string $key)
 
- Protected Member Functions inherited from ilObject2GUI
 afterConstructor ()
 Do anything that should be done after constructor in here. More...
 
 assignObject ()
 create object instance as internal property (repository/workspace switch) More...
 
 getAccessHandler ()
 
 setLocator ()
 set Locator More...
 
 deleteConfirmedObjects ()
 Delete objects (workspace specific) This should probably be moved elsewhere as done with RepUtil. More...
 
 setTitleAndDescription ()
 
 omitLocator (bool $omit=true)
 
 getTargetFrame (string $cmd, string $target_frame="")
 
 setTargetFrame (string $cmd, string $target_frame)
 
 getCenterColumnHTML ()
 
 getRightColumnHTML ()
 
 checkPermission (string $perm, string $cmd="", string $type="", int $ref_id=null)
 
 showPossibleSubObjects ()
 
 redirectToRefId (int $ref_id, string $cmd="")
 
 fillCloneTemplate (?string $tpl_varname, string $type)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 getReturnLocation (string $cmd, string $location="")
 Deprecated functions. More...
 
 setReturnLocation (string $cmd, string $location)
 
 showActions ()
 
 getTabs ()
 
 addLocatorItems ()
 Functions to be overwritten. More...
 
 initCreationForms (string $new_type)
 Init creation forms. More...
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $node_id=null)
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 redrawHeaderAction ()
 Updating icons after ajax call. More...
 
 getPermanentLinkWidget (string $append=null, bool $center=false)
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms (string $new_type)
 Init creation forms. More...
 
 getCreationFormsHTML (array $forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm (string $new_type)
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm (string $new_type)
 
 importFileObject (int $parent_id=null)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current ["ref_id"] value of the request More...
 
 fillCloneTemplate (?string $tpl_name, string $type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 showCustomIconsEditing ( $input_colspan=1, ilPropertyFormGUI $form=null, $as_section=true)
 show edit section of custom icons for container More...
 

Protected Attributes

ilLTIConsumerAccess $ltiAccess
 
- Protected Attributes inherited from ilObject2GUI
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ilObjectService $object_service
 
ilFavouritesManager $favourites
 
ilErrorHandling $error
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilToolbarGUI $toolbar
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Factory $refinery
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
int $request_ref_id
 
int $id_type
 
int $parent_id
 
string $type
 
string $html
 
int $object_id
 
int $node_id = null
 
array $creation_forms = array()
 
 $access_handler
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Factory $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilObjLTIConsumerGUI::__construct ( int  $a_id = 0,
int  $a_id_type = self::REPOSITORY_NODE_ID,
int  $a_parent_node_id = 0 
)

Definition at line 60 of file class.ilObjLTIConsumerGUI.php.

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

61  {
62  global $DIC;
63  /* @var \ILIAS\DI\Container $DIC */
64 
65  parent::__construct($a_id, $a_id_type, $a_parent_node_id);
66  $this->parent_node_id = $a_parent_node_id;
67  if ($this->object instanceof ilObjLTIConsumer) {
68  $this->ltiAccess = new ilLTIConsumerAccess($this->object);
69  }
70 
71  $DIC->language()->loadLanguageModule("lti");
72  $DIC->language()->loadLanguageModule("rep");
73  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

static ilObjLTIConsumerGUI::_goto ( string  $a_target)
static

Definition at line 645 of file class.ilObjLTIConsumerGUI.php.

References ilObject2GUI\$access, ilObject2GUI\$ctrl, $DIC, ilObjectGUI\$id, ilObject2GUI\$lng, $object, ilObjectGUI\$request, ilLink\_getLink(), ilObjectGUI\_gotoRepositoryNode(), ilObjectGUI\_gotoRepositoryRoot(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObjectGUI\addHeaderAction(), ilRBACAccessHandler\checkAccess(), checkContentSelection(), ilObject2GUI\executeCommand(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), getType(), infoScreen(), ILIAS\Repository\int(), ilLTIConsumerContentGUI\isEmbeddedLaunchRequest(), ilLearningProgressBaseGUI\LP_CONTEXT_REPOSITORY, ILIAS\Repository\object(), ilObject2GUI\prepareOutput(), ilCtrl\redirectByClass(), ROOT_FOLDER_ID, ilCtrl\setParameterByClass(), ilCtrl\setTargetScript(), trackObjectReadEvent(), and ilLanguage\txt().

645  : void
646  {
647  global $DIC;
648  $main_tpl = $DIC->ui()->mainTemplate();
649  /* @var \ILIAS\DI\Container $DIC */
650  $err = $DIC['ilErr'];
651  /* @var ilErrorHandling $err */
652  $ctrl = $DIC->ctrl();
653  $request = $DIC->http()->request();
654  $access = $DIC->access();
655  $lng = $DIC->language();
656 
657  $targetParameters = explode('_', $a_target);
658  $id = (int) $targetParameters[0];
659 
660  if ($id <= 0) {
661  $err->raiseError($lng->txt('msg_no_perm_read'), $err->FATAL);
662  }
663 
664  if ($access->checkAccess('read', '', $id)) {
665  $ctrl->setTargetScript('ilias.php');
666  $ctrl->setParameterByClass(ilObjLTIConsumerGUI::class, 'ref_id', $id);
667  $ctrl->redirectByClass([ilRepositoryGUI::class, ilObjLTIConsumerGUI::class]);
668  } elseif ($access->checkAccess('visible', '', $id)) {
669  ilObjectGUI::_gotoRepositoryNode($id, 'infoScreen');
670  } elseif ($access->checkAccess('read', '', ROOT_FOLDER_ID)) {
671  $main_tpl->setOnScreenMessage(
672  'info',
673  sprintf(
674  $DIC->language()->txt('msg_no_perm_read_item'),
676  ),
677  true
678  );
679 
681  }
682 
683  $err->raiseError($DIC->language()->txt("msg_no_perm_read_lm"), $err->FATAL);
684  }
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
const ROOT_FOLDER_ID
Definition: constants.php:32
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
static _gotoRepositoryNode(int $ref_id, string $cmd="")
setParameterByClass(string $a_class, string $a_parameter, $a_value)
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
static _lookupTitle(int $obj_id)
ServerRequestInterface $request
setTargetScript(string $a_target_script)
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
ilAccessHandler $access
+ Here is the call graph for this function:

◆ addDynReg()

ilObjLTIConsumerGUI::addDynReg ( )

Definition at line 286 of file class.ilObjLTIConsumerGUI.php.

References $DIC, ilObject2GUI\$error, getRequestValue(), ilLTIConsumerAccess\hasCustomProviderCreationAccess(), and initDynRegForm().

286  : void
287  {
288  global $DIC;
290  throw new ilLtiConsumerException('permission denied!');
291  }
292  $new_type = $this->getRequestValue("new_type");
293 
294  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
295 
296  $DIC->language()->loadLanguageModule($new_type);
297  $form = $this->initDynRegForm($new_type);
298  $error = ($this->getRequestValue('error') != null) ? $this->getRequestValue('error') : "";
299  $form->setValuesByPost();
300  if (!empty($error)) {
301  $DIC->ctrl()->setParameter($this, "new_type", "");
302  $DIC->ui()->mainTemplate()->setOnScreenMessage('failure', base64_decode($error));
303  $DIC->ui()->mainTemplate()->setContent($form->getDynRegError());
304  return;
305  }
306  if ($form->checkInput()) {
307  $DIC->ctrl()->setParameter($this, "new_type", "");
308  $DIC->ui()->mainTemplate()->setContent($form->getDynRegRequest());
309  return;
310  }
311  $DIC->ui()->mainTemplate()->setContent($form->getHTML());
312  }
ilErrorHandling $error
global $DIC
Definition: feed.php:28
initDynRegForm(string $a_new_type)
+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjLTIConsumerGUI::addLocatorItems ( )
protected

Definition at line 1016 of file class.ilObjLTIConsumerGUI.php.

References $DIC, ilObject2GUI\$locator, ilLocatorGUI\addItem(), ILIAS\Repository\ctrl(), and ILIAS\Repository\object().

1016  : void
1017  {
1018  global $DIC;
1019  /* @var \ILIAS\DI\Container $DIC */
1020 
1021  $locator = $DIC['ilLocator'];
1022  /* @var ilLocatorGUI $locator */
1023  $locator->addItem(
1024  $this->object->getTitle(),
1025  $this->ctrl->getLinkTarget($this, self::DEFAULT_CMD),
1026  "",
1027  $this->object->getRefId()
1028  );
1029  }
global $DIC
Definition: feed.php:28
addItem(string $a_title, string $a_link, string $a_frame="", int $a_ref_id=0, ?string $type=null)
ilLocatorGUI $locator
+ Here is the call graph for this function:

◆ afterSave()

ilObjLTIConsumerGUI::afterSave ( \ilObject  $newObject)
protected

Definition at line 529 of file class.ilObjLTIConsumerGUI.php.

References $DIC, $provider, ilLTIConsumeProvider\AVAILABILITY_CREATE, ilObject\getTitle(), ilObject\getType(), ilLTIConsumerAccess\hasCustomProviderCreationAccess(), initCustomCreateForm(), initMetadata(), ilObject\setTitle(), and ilObject\update().

Referenced by saveCustom().

529  : void
530  {
531  global $DIC; //check
532 
533  if ($DIC->http()->wrapper()->query()->has('provider_id')) {
534  $newObject->setProviderId((int) $DIC->http()->wrapper()->query()->retrieve('provider_id', $DIC->refinery()->kindlyTo()->int()));
535  $newObject->initProvider();
536  $newObject->save();
537 
538  $newObject->setTitle($newObject->getProvider()->getTitle());
539  $newObject->setMasteryScore($newObject->getProvider()->getMasteryScore());
540  $newObject->update();
541 
542  $this->initMetadata($newObject);
543 
544  $DIC->ctrl()->redirectByClass(ilLTIConsumerSettingsGUI::class);
545  }
546 
548  throw new ilLtiConsumerException('permission denied!');
549  }
550 
551  $form = $this->initCustomCreateForm($newObject->getType());
552 
553  if ($form->checkInput()) {
555  $form->initProvider($provider);
557  $provider->setIsGlobal(false);
558  $provider->setCreator($DIC->user()->getId());
559  $provider->save();
560 
561  $newObject->setProviderId($provider->getId());
562  $newObject->setProvider($provider);
563  $newObject->save();
564 
565  $newObject->setTitle($provider->getTitle());
566  $newObject->setMasteryScore($newObject->getProvider()->getMasteryScore());
567  $newObject->update();
568 
569  $this->initMetadata($newObject);
570 
571  $DIC->ctrl()->redirectByClass(ilObjLTIConsumerGUI::class);
572  }
573 
574  throw new ilLtiConsumerException(
575  'form validation seems to not have worked in ilObjLTIConsumer::saveCustom()!'
576  );
577  }
global $DIC
Definition: feed.php:28
$provider
Definition: ltitoken.php:83
initCustomCreateForm(string $a_new_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyProviderFilter()

ilObjLTIConsumerGUI::applyProviderFilter ( )
protected

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

References buildProviderSelectionForm(), and ilObjectGUI\createObject().

216  : void
217  {
218  $form = $this->buildProviderSelectionForm('');
219  $form->applyFilter();
220  $this->createObject();
221  }
createObject()
create new object form
buildProviderSelectionForm(string $a_new_type)
+ Here is the call graph for this function:

◆ buildProviderSelectionForm()

ilObjLTIConsumerGUI::buildProviderSelectionForm ( string  $a_new_type)
protected

Definition at line 205 of file class.ilObjLTIConsumerGUI.php.

Referenced by applyProviderFilter(), initCreateForm(), and resetProviderFilter().

206  {
208  $a_new_type,
209  $this,
210  'create',
211  'applyProviderFilter',
212  'resetProviderFilter'
213  );
214  }
+ Here is the caller graph for this function:

◆ cancelContentSelection()

ilObjLTIConsumerGUI::cancelContentSelection ( )

Definition at line 470 of file class.ilObjLTIConsumerGUI.php.

References $DIC, getRequestValue(), and ilLTIConsumerAccess\hasCustomProviderCreationAccess().

470  : void
471  {
472  global $DIC;
474  throw new ilLtiConsumerException('permission denied!');
475  }
476  $new_type = $this->getRequestValue("new_type");
477  $DIC->ctrl()->setParameterByClass(ilRepositoryGUI::class, 'new_type', $new_type);
478  $DIC->ctrl()->redirectByClass(ilRepositoryGUI::class, 'create');
479  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ cancelDynReg()

ilObjLTIConsumerGUI::cancelDynReg ( )

Definition at line 314 of file class.ilObjLTIConsumerGUI.php.

References $DIC, Vendor\Package\$e, $provider, $providerId, ilSession\get(), ilLTIConsumeProvider\getProviderIdFromClientId(), getRequestValue(), ilSession\has(), and ilLTIConsumerAccess\hasCustomProviderCreationAccess().

314  : void
315  {
316  global $DIC;
318  throw new ilLtiConsumerException('permission denied!');
319  }
320  $new_type = $this->getRequestValue("new_type");
321  //$provider_id = $this->getRequestValue("provider_id");
322  if (ilSession::has('lti_dynamic_registration_client_id')) {
323  $providerId = ilLTIConsumeProvider::getProviderIdFromClientId(ilSession::get('lti_dynamic_registration_client_id'));
324  if ($providerId > 0) {
325  try {
327  //ToDo: check if provider is in use? should never happen...
328  $provider->delete();
329  } catch (\ILIAS\Filesystem\Exception\IOException $e) {
330  //ToDo: error handling
331  }
332  }
333  }
334  $DIC->ctrl()->setParameterByClass(ilRepositoryGUI::class, 'new_type', $new_type);
335  $DIC->ctrl()->redirectByClass(ilRepositoryGUI::class, 'create');
336  }
static get(string $a_var)
Class ChatMainBarProvider .
if(empty($clientId)) $providerId
Definition: ltitoken.php:82
static getProviderIdFromClientId(string $clientId)
global $DIC
Definition: feed.php:28
$provider
Definition: ltitoken.php:83
static has($a_var)
Class FlySystemFileAccessTest disabled disabled disabled.
+ Here is the call graph for this function:

◆ checkContentSelection()

ilObjLTIConsumerGUI::checkContentSelection ( )
protected

Definition at line 852 of file class.ilObjLTIConsumerGUI.php.

References $DIC, $provider, $providerId, $refId, contentSelection(), getRequestValue(), and ilObject2GUI\save().

Referenced by _goto().

852  : void
853  {
854  global $DIC;
855  $providerId = $this->getRequestValue('provider_id');
856  $newType = $this->getRequestValue('new_type');
857  $refId = $this->getRequestValue('ref_id');
858  if ($providerId !== null && $newType == 'lti' && $refId != null) {
860  // check if post variables from contentSelectionResponse
861  if ($DIC->http()->wrapper()->post()->has('JWT')) {
862  // ToDo:
863  } else {
864  if ($provider->isContentItem() && !empty($provider->getContentItemUrl())) {
865  $this->contentSelection($providerId, $newType, $refId, $provider);
866  } else {
867  $this->save();
868  }
869  }
870  } else {
871  $this->save();
872  }
873  }
contentSelection(string $providerId, string $newType, string $refId, ilLTIConsumeProvider $provider)
$refId
Definition: xapitoken.php:58
if(empty($clientId)) $providerId
Definition: ltitoken.php:82
global $DIC
Definition: feed.php:28
$provider
Definition: ltitoken.php:83
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ contentSelection()

ilObjLTIConsumerGUI::contentSelection ( string  $providerId,
string  $newType,
string  $refId,
ilLTIConsumeProvider  $provider 
)

Definition at line 381 of file class.ilObjLTIConsumerGUI.php.

References $DIC, ILIAS\Repository\ctrl(), and ilLTIConsumerAccess\hasCustomProviderCreationAccess().

Referenced by checkContentSelection().

381  : void
382  {
383  global $DIC;
385  throw new ilLtiConsumerException('permission denied!');
386  }
387  $DIC->ctrl()->setParameter($this, "new_type", $newType);
388  $DIC->ctrl()->setParameter($this, "provider_id", $providerId);
389  $DIC->ctrl()->setParameter($this, "ref_id", $refId);
390 
391  $form = new ilLTIConsumeProviderFormGUI($provider);
392  $formaction = $this->ctrl->getFormAction($this, "cancelContentSelection");
393  $DIC->ui()->mainTemplate()->setContent($form->getContentSelectionFrame($formaction));
394  }
$refId
Definition: xapitoken.php:58
if(empty($clientId)) $providerId
Definition: ltitoken.php:82
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ contentSelectionRequest()

ilObjLTIConsumerGUI::contentSelectionRequest ( )

Definition at line 396 of file class.ilObjLTIConsumerGUI.php.

References ilObjectGUI\$data, $DIC, $ltiMessageHint, $provider, ilObjectGUI\$ref_id, ilObjLTIConsumer\buildContentSelectionParameters(), ilSession\clear(), CLIENT_ID, exit, ilSession\get(), ilCmiXapiUser\getIdent(), ilObjLTIConsumer\getIliasHttpPath(), getRequestValue(), ilSession\has(), and ilLTIConsumerAccess\hasCustomProviderCreationAccess().

396  : void
397  {
398  global $DIC;
400  throw new ilLtiConsumerException('permission denied!');
401  }
402  $new_type = $this->getRequestValue("new_type");
403  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
404  $provider_id = $this->getRequestValue("provider_id");
405  $DIC->ctrl()->setParameter($this, "provider_id", $provider_id);
406  $ref_id = $this->getRequestValue("ref_id");
407  $DIC->ctrl()->setParameter($this, "ref_id", $ref_id);
408  $DIC->language()->loadLanguageModule($new_type);
409  $provider = new ilLTIConsumeProvider((int) $provider_id);
410  $redirectUrl = $DIC->ctrl()->getLinkTarget($this, 'contentSelectionRequest');
411 
412  if (!ilSession::has('lti13_login_data')) {
413  $userIdLTI = ilCmiXapiUser::getIdent($provider->getPrivacyIdent(), $DIC->user()); //was: getIdentAsId
414  //$emailPrimary = ilCmiXapiUser::getIdent($provider->getPrivacyIdent(), $DIC->user());
415  $ltiMessageHint = (string) $ref_id . ":" . CLIENT_ID . ":" . base64_encode($redirectUrl);
416  $tplLogin = new ilTemplate("tpl.lti_initial_login.html", true, true, "Modules/LTIConsumer");
417  $tplLogin->setVariable("LTI_INITIAL_LOGIN_ACTION", $provider->getInitiateLogin());
418  $tplLogin->setVariable("ISS", ilObjLTIConsumer::getIliasHttpPath());
419  $tplLogin->setVariable("TARGET_LINK_URL", $provider->getProviderUrl());
420  $tplLogin->setVariable("LOGIN_HINT", $userIdLTI);
421  $tplLogin->setVariable("LTI_MESSAGE_HINT", $ltiMessageHint);
422  $tplLogin->setVariable("CLIENT_ID", $provider->getClientId());
423  $tplLogin->setVariable("LTI_DEPLOYMENT_ID", (string) $provider->getId());
424  echo $tplLogin->get();
425  exit; //TODO: no exit
426  } else {
427  $loginData = ilSession::get('lti13_login_data');
428  // ToDo: correct Link!! replace ILIAS_HTTP_PATH
429  $data = ilObjLTIConsumer::buildContentSelectionParameters($provider, (int) $ref_id, ilObjLTIConsumer::getIliasHttpPath() . "/" . $DIC->ctrl()->getLinkTarget($this, 'contentSelectionResponse'), $loginData['nonce']);
430  $tplContentSelection = new ilTemplate("tpl.lti_jwt_autosubmit.html", true, true, "Modules/LTIConsumer");
431  $tplContentSelection->setVariable("LTI_JWT_FORM_ACTION", $provider->getContentItemUrl());
432  $tplContentSelection->setVariable("LTI_JWT_ID_TOKEN", $data['id_token']);
433  $tplContentSelection->setVariable("LTI_JWT_STATE", $loginData['state']);
434  ilSession::clear('lti13_login_data');
435  echo $tplContentSelection->get();
436  exit; //TODO: no exit
437  }
438  }
static get(string $a_var)
exit
Definition: login.php:28
static buildContentSelectionParameters(ilLTIConsumeProvider $provider, int $refId, string $returnUrl, string $nonce)
static getIdent(int $userIdentMode, ilObjUser $user)
global $DIC
Definition: feed.php:28
$provider
Definition: ltitoken.php:83
const CLIENT_ID
Definition: constants.php:41
static has($a_var)
$ltiMessageHint
Definition: ltiauth.php:51
static clear(string $a_var)
+ Here is the call graph for this function:

◆ contentSelectionResponse()

ilObjLTIConsumerGUI::contentSelectionResponse ( )

Definition at line 440 of file class.ilObjLTIConsumerGUI.php.

References $DIC, $provider, ilObjectGUI\$ref_id, $token, exit, getRequestValue(), ilLTIConsumerAccess\hasCustomProviderCreationAccess(), and saveContentSelection().

440  : void
441  {
442  global $DIC;
444  throw new ilLtiConsumerException('permission denied!');
445  }
446  $new_type = $this->getRequestValue("new_type");
447  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
448  $provider_id = $this->getRequestValue("provider_id");
449  $DIC->ctrl()->setParameter($this, "provider_id", $provider_id);
450  $ref_id = $this->getRequestValue("ref_id");
451  $DIC->ctrl()->setParameter($this, "ref_id", $ref_id);
452  $DIC->language()->loadLanguageModule($new_type);
453  $token = '';
454  if ($DIC->http()->wrapper()->post()->has('JWT')) {
455  $token = $DIC->http()->wrapper()->post()->retrieve('JWT', $DIC->refinery()->kindlyTo()->string());
456  }
457  if ($DIC->http()->wrapper()->post()->has('jwt')) {
458  $token = $DIC->http()->wrapper()->post()->retrieve('jwt', $DIC->refinery()->kindlyTo()->string());
459  }
460  if (!empty($token)) {
461  $provider = new ilLTIConsumeProvider((int) $provider_id);
463  } else {
464  echo "no token";
465  exit;
466  //ToDo:
467  }
468  }
exit
Definition: login.php:28
saveContentSelection(ilLTIConsumeProvider $provider, string $token)
global $DIC
Definition: feed.php:28
$provider
Definition: ltitoken.php:83
$token
Definition: xapitoken.php:70
+ Here is the call graph for this function:

◆ createNewObject()

ilObjLTIConsumerGUI::createNewObject ( string  $newType,
string  $title,
string  $description 
)
protected

Definition at line 230 of file class.ilObjLTIConsumerGUI.php.

References ilObject2GUI\putObjectInTree().

Referenced by saveCustom().

230  : ilObject
231  {
232  $classname = "ilObj" . $this->obj_definition->getClassName($newType);
233 
234  $newObj = new $classname();
235  $newObj->setType($newType);
236  $newObj->setTitle($title);
237  $newObj->setDescription($description);
238  $newObj->create();
239  $this->putObjectInTree($newObj);
240  return $newObj;
241  }
putObjectInTree(ilObject $obj, int $parent_node_id=null)
Add object to tree at given position.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRequestValue()

ilObjLTIConsumerGUI::getRequestValue ( string  $key)
protected

Definition at line 1164 of file class.ilObjLTIConsumerGUI.php.

References ILIAS\Repository\refinery().

Referenced by addDynReg(), cancelContentSelection(), cancelDynReg(), checkContentSelection(), contentSelectionRequest(), contentSelectionResponse(), saveContentSelection(), saveCustom(), saveDynReg(), and showToolConfig().

1164  : ?string
1165  {
1166  if ($this->request_wrapper->has($key)) {
1167  return $this->request_wrapper->retrieve($key, $this->refinery->kindlyTo()->string());
1168  }
1169  return null;
1170  }
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

ilObjLTIConsumerGUI::getType ( )

Definition at line 75 of file class.ilObjLTIConsumerGUI.php.

Referenced by _goto().

75  : string
76  {
77  return 'lti';
78  }
+ Here is the caller graph for this function:

◆ handleAvailablityMessage()

ilObjLTIConsumerGUI::handleAvailablityMessage ( )
protected

Definition at line 1153 of file class.ilObjLTIConsumerGUI.php.

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

Referenced by infoScreenForward().

1153  : void
1154  {
1155  global $DIC;
1156  /* @var \ILIAS\DI\Container $DIC */
1157  if ($this->object->getProvider()->getProviderUrl() == '') {
1158  $this->tpl->setOnScreenMessage('failure', $DIC->language()->txt('lti_provider_not_set_msg'));
1159  } elseif ($this->object->getProvider()->getAvailability() == ilLTIConsumeProvider::AVAILABILITY_NONE) {
1160  $this->tpl->setOnScreenMessage('failure', $DIC->language()->txt('lti_provider_not_avail_msg'));
1161  }
1162  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoScreen()

ilObjLTIConsumerGUI::infoScreen ( )
protected

Definition at line 1055 of file class.ilObjLTIConsumerGUI.php.

References $DIC, and infoScreenForward().

Referenced by _goto().

1055  : void
1056  {
1057  global $DIC;
1058  /* @var \ILIAS\DI\Container $DIC */
1059 
1060  $DIC->tabs()->activateTab(self::TAB_ID_INFO);
1061 
1062  $DIC->ctrl()->setCmd("showSummary");
1063  $DIC->ctrl()->setCmdClass("ilinfoscreengui");
1064  $this->infoScreenForward();
1065  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoScreenForward()

ilObjLTIConsumerGUI::infoScreenForward ( )
protected

Definition at line 1067 of file class.ilObjLTIConsumerGUI.php.

References $DIC, $ilErr, ilLPObjSettings\_lookupDBMode(), ilObject2GUI\checkPermissionBool(), ILIAS\Repository\ctrl(), ilObjCmiXapiGUI\getPrivacyIdentString(), ilObjCmiXapiGUI\getPrivacyNameString(), handleAvailablityMessage(), and ILIAS\Repository\object().

Referenced by infoScreen().

1067  : void
1068  {
1069  global $DIC;
1070  /* @var \ILIAS\DI\Container $DIC */
1071  $ilErr = $DIC['ilErr'];
1072  /* @var ilErrorHandling $ilErr */
1073 
1074  if (!$this->checkPermissionBool("visible") && !$this->checkPermissionBool("read")) {
1075  $ilErr->raiseError($DIC->language()->txt("msg_no_perm_read"));
1076  }
1077 
1078  $this->handleAvailablityMessage();
1079 
1080  $info = new ilInfoScreenGUI($this);
1081 
1082  $info->enablePrivateNotes();
1083 
1084  if ($this->checkPermissionBool("read")) {
1085  $info->enableNews();
1086  }
1087 
1088  $info->enableNewsEditing(false);
1089 
1090  if ($this->checkPermissionBool("write")) {
1091  $news_set = new ilSetting("news");
1092  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1093 
1094  if ($enable_internal_rss) {
1095  //todo check
1096  $info->setBlockProperty("news", "settings", "true");
1097  $info->setBlockProperty("news", "public_notifications_option", "true");
1098  }
1099  }
1100 
1101  // standard meta data
1102  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1103 
1104  if (DEVMODE) {
1105  // Development Info
1106  $info->addSection('DEVMODE Info');
1107  $info->addProperty('Local Object ID', (string) $this->object->getId());
1108  $info->addProperty('Current User ID', (string) $DIC->user()->getId());
1109  }
1110  if ($this->object->getProvider()->getHasOutcome() && ilLPObjSettings::_lookupDBMode($this->object->getId()) != 0) {
1111  $info->addSection($DIC->language()->txt("lti_info_learning_progress_section"));
1112  $info->addProperty(
1113  $DIC->language()->txt("mastery_score"),
1114  ($this->object->getMasteryScorePercent()) . ' %'
1115  );
1116  }
1117 
1118  // LTI Ressource Info about privacy
1119  $info->addSection($DIC->language()->txt("lti_info_privacy_section"));
1120 
1121  $info->addProperty(
1122  $DIC->language()->txt("lti_con_prov_url"),
1123  $this->object->getProvider()->getProviderUrl()
1124  );
1125 
1126  $info->addProperty(
1127  $DIC->language()->txt("conf_privacy_name"),
1128  $DIC->language()->txt('conf_privacy_name_' . ilObjCmiXapiGUI::getPrivacyNameString($this->object->getProvider()->getPrivacyName()))
1129  );
1130 
1131  $info->addProperty(
1132  $DIC->language()->txt("conf_privacy_ident"),
1133  $DIC->language()->txt('conf_privacy_ident_' . ilObjCmiXapiGUI::getPrivacyIdentString($this->object->getProvider()->getPrivacyIdent()))
1134  );
1135  if ($this->object->getProvider()->isExternalProvider()) {
1136  $info->addProperty(
1137  $DIC->language()->txt("lti_info_external_provider_label"),
1138  $DIC->language()->txt('lti_info_external_provider_info')
1139  );
1140  }
1141 
1142  if ($this->object->getProvider()->getUseXapi()) {
1143  $info->addProperty(
1144  $DIC->language()->txt("lti_con_prov_xapi_launch_url"),
1145  $this->object->getProvider()->getXapiLaunchUrl()
1146  );
1147  }
1148 
1149  // FINISHED INFO SCREEN, NOW FORWARD
1150  $this->ctrl->forwardCommand($info);
1151  }
Class ilInfoScreenGUI.
$ilErr
Definition: raiseError.php:17
global $DIC
Definition: feed.php:28
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
static getPrivacyIdentString(int $ident)
static getPrivacyNameString(int $ident)
static _lookupDBMode(int $a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreateForm()

ilObjLTIConsumerGUI::initCreateForm ( string  $a_new_type)
protected

Definition at line 100 of file class.ilObjLTIConsumerGUI.php.

References $DIC, ilLTIConsumeProvider\AVAILABILITY_CREATE, buildProviderSelectionForm(), ilLTIConsumeProviderList\SCOPE_GLOBAL, and ilLTIConsumeProviderList\SCOPE_USER.

Referenced by initCreationForms().

101  {
102  global $DIC;
103  /* @var \ILIAS\DI\Container $DIC */
104 
105  $form = $this->buildProviderSelectionForm($a_new_type);
106 
107  $globalProviderList = new ilLTIConsumeProviderList();
108  $globalProviderList->setAvailabilityFilter((string) ilLTIConsumeProvider::AVAILABILITY_CREATE);
109  $globalProviderList->setScopeFilter(ilLTIConsumeProviderList::SCOPE_GLOBAL);
110 
111  $userProviderList = new ilLTIConsumeProviderList();
112  $userProviderList->setAvailabilityFilter((string) ilLTIConsumeProvider::AVAILABILITY_CREATE);
113  $userProviderList->setScopeFilter(ilLTIConsumeProviderList::SCOPE_USER);
114  $userProviderList->setCreatorFilter($DIC->user()->getId());
115 
116  if ($form->getFilter('title')) {
117  $globalProviderList->setTitleFilter($form->getFilter('title'));
118  $userProviderList->setTitleFilter($form->getFilter('title'));
119  }
120 
121  if ($form->getFilter('category')) {
122  $globalProviderList->setCategoryFilter($form->getFilter('category'));
123  $userProviderList->setCategoryFilter($form->getFilter('category'));
124  }
125 
126  if ($form->getFilter('keyword')) {
127  $globalProviderList->setKeywordFilter($form->getFilter('keyword'));
128  $userProviderList->setKeywordFilter($form->getFilter('keyword'));
129  }
130 
131  if ($form->getFilter('outcome')) {
132  $globalProviderList->setHasOutcomeFilter(true);
133  $userProviderList->setHasOutcomeFilter(true);
134  }
135 
136  if ($form->getFilter('internal')) {
137  $globalProviderList->setIsExternalFilter(false);
138  $userProviderList->setIsExternalFilter(false);
139  }
140 
141  if ($form->getFilter('with_key')) {
142  $globalProviderList->setIsProviderKeyCustomizableFilter(false);
143  $userProviderList->setIsProviderKeyCustomizableFilter(false);
144  }
145 
146  $globalProviderList->load();
147  $userProviderList->load();
148 
149  $form->setData([...$globalProviderList->getTableData(), ...$userProviderList->getTableData()]);
150 
151  return $form;
152  }
global $DIC
Definition: feed.php:28
buildProviderSelectionForm(string $a_new_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreationForms()

ilObjLTIConsumerGUI::initCreationForms ( string  $a_new_type)
protected
Returns
[]|null[]

Definition at line 83 of file class.ilObjLTIConsumerGUI.php.

References ilObject2GUI\fillCloneTemplate(), ilLTIConsumerAccess\hasCustomProviderCreationAccess(), initCreateForm(), initCustomCreateForm(), and initDynRegForm().

83  : array
84  {
85  $forms = array(
86  self::CFORM_NEW => $this->initCreateForm($a_new_type)
87  );
88 
90  $forms[self::CFORM_DYNAMIC_REGISTRATION] = $this->initDynRegForm($a_new_type);
91  $forms[self::CFORM_CUSTOM_NEW] = $this->initCustomCreateForm($a_new_type);
92  }
93 
94  //$forms[self::CFORM_IMPORT] = $this->initImportForm($a_new_type), // no import yet
95  $forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, $a_new_type);
96 
97  return $forms;
98  }
fillCloneTemplate(?string $tpl_varname, string $type)
initCustomCreateForm(string $a_new_type)
initDynRegForm(string $a_new_type)
initCreateForm(string $a_new_type)
+ Here is the call graph for this function:

◆ initCustomCreateForm()

ilObjLTIConsumerGUI::initCustomCreateForm ( string  $a_new_type)

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

References $DIC, $provider, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by afterSave(), initCreationForms(), and saveCustom().

186  {
187  global $DIC;
188  /* @var \ILIAS\DI\Container $DIC */
189 
191 
193 
194  $form->initForm($this->ctrl->getFormAction($this, "save"), '', '');
195 
196  $form->clearCommandButtons();
197  $form->addCommandButton("saveCustom", $this->lng->txt($a_new_type . "_add_own_provider"));
198  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
199 
200  $form->setTitle($DIC->language()->txt($a_new_type . '_custom_new'));
201 
202  return $form;
203  }
global $DIC
Definition: feed.php:28
$provider
Definition: ltitoken.php:83
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initDynRegForm()

ilObjLTIConsumerGUI::initDynRegForm ( string  $a_new_type)

Definition at line 154 of file class.ilObjLTIConsumerGUI.php.

References $DIC, $provider, and ILIAS\Repository\ctrl().

Referenced by addDynReg(), and initCreationForms().

155  {
156  global $DIC;
157  /* @var \ILIAS\DI\Container $DIC */
160  $form->initDynRegForm($this->ctrl->getFormAction($this, "cancelDynReg"));
161  $form->setTitle($DIC->language()->txt($a_new_type . '_dynamic_registration'));
162  return $form;
163  }
global $DIC
Definition: feed.php:28
$provider
Definition: ltitoken.php:83
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initHeaderAction()

ilObjLTIConsumerGUI::initHeaderAction ( ?string  $a_sub_type = null,
?int  $a_sub_id = null 
)
protected
Returns
ilObjectListGUI
Exceptions
ilCtrlException

Definition at line 610 of file class.ilObjLTIConsumerGUI.php.

References $DIC, ilLTIConsumerSettingsGUI\CMD_DELIVER_CERTIFICATE, and ilUtil\getImagePath().

611  {
612  global $DIC;
613  /* @var \ILIAS\DI\Container $DIC */
614 
615  $return = parent::initHeaderAction($a_sub_type, $a_sub_id);
616 
617  if ($this->creation_mode) {
618  return $return;
619  }
620 
621  $validator = new ilCertificateDownloadValidator();
622  if ($validator->isCertificateDownloadable($DIC->user()->getId(), $this->object->getId())) {
623  $certLink = $DIC->ctrl()->getLinkTargetByClass(
624  [ilObjLTIConsumerGUI::class, ilLTIConsumerSettingsGUI::class],
626  );
627 
628  $DIC->language()->loadLanguageModule('certificate');
629 
630  $return->addCustomCommand($certLink, 'download_certificate');
631 
632  $return->addHeaderIcon(
633  'cert_icon',
634  ilUtil::getImagePath('icon_cert.svg'),
635  $DIC->language()->txt('download_certificate'),
636  null,
637  null,
638  $certLink
639  );
640  }
641 
642  return $return;
643  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: feed.php:28
Validates if an active certificate is stored in the database and can be downloaded by the user...
+ Here is the call graph for this function:

◆ initMetadata()

ilObjLTIConsumerGUI::initMetadata ( \ilObject  $object)

Definition at line 579 of file class.ilObjLTIConsumerGUI.php.

References ilObjectGUI\$id, ilMD\addGeneral(), ilMD\getGeneral(), ilObject\getId(), ilObject\getTitle(), ilObject\getType(), ilMDBase\save(), ilMDKeyword\updateKeywords(), and ILIAS\Repository\user().

Referenced by afterSave(), and saveContentSelection().

579  : void
580  {
581  $metadata = new ilMD($object->getId(), $object->getId(), $object->getType());
582 
583  $generalMetadata = $metadata->getGeneral();
584 
585  if (!$generalMetadata) {
586  $generalMetadata = $metadata->addGeneral();
587  }
588 
589  $generalMetadata->setTitle($object->getTitle());
590  $generalMetadata->save();
591 
592  $id = $generalMetadata->addIdentifier();
593  $id->setCatalog('ILIAS');
594  $id->setEntry('il__' . $object->getType() . '_' . $object->getId());
595  $id->save();
596 
597  $keywords = $object->getProvider()->getKeywordsArray();
598 
599  // language needed now
600  $ulang = $this->user->getLanguage();
601  $keywords = array($ulang => $keywords);
602 
603  ilMDKeyword::updateKeywords($generalMetadata, $keywords);
604  }
addGeneral()
Definition: class.ilMD.php:44
static updateKeywords(ilMDGeneral $a_md_section, array $a_keywords)
getGeneral()
Definition: class.ilMD.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initShowToolConfig()

ilObjLTIConsumerGUI::initShowToolConfig ( string  $a_new_type,
int  $a_provider_id 
)

Definition at line 165 of file class.ilObjLTIConsumerGUI.php.

References $DIC, $provider, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by saveDynReg(), and showToolConfig().

166  {
167  global $DIC;
168 
169  //ToDo: Error Handling
170  $provider = new ilLTIConsumeProvider($a_provider_id);
171 
173 
174  $form->initToolConfigForm($this->ctrl->getFormAction($this, "cancelDynReg"), '', '');
175 
176  $form->clearCommandButtons();
177  $form->addCommandButton("saveDynReg", $this->lng->txt('save'));
178  $form->addCommandButton("cancelDynReg", $this->lng->txt("cancel"));
179 
180  $form->setTitle($DIC->language()->txt($a_new_type . '_custom_new'));
181 
182  return $form;
183  }
global $DIC
Definition: feed.php:28
$provider
Definition: ltitoken.php:83
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetProviderFilter()

ilObjLTIConsumerGUI::resetProviderFilter ( )
protected

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

References buildProviderSelectionForm(), and ilObjectGUI\createObject().

223  : void
224  {
225  $form = $this->buildProviderSelectionForm('');
226  $form->resetFilter();
227  $this->createObject();
228  }
createObject()
create new object form
buildProviderSelectionForm(string $a_new_type)
+ Here is the call graph for this function:

◆ saveContentSelection()

ilObjLTIConsumerGUI::saveContentSelection ( ilLTIConsumeProvider  $provider,
string  $token 
)

Definition at line 481 of file class.ilObjLTIConsumerGUI.php.

References ilObjectGUI\$data, ILIAS\LTI\ToolProvider\$key, $keys, $provider, $refId, ilObject2GUI\$type, Firebase\JWT\JWT\decode(), exit, ilObjLTIConsumer\getIliasHttpPath(), ilLTIConsumeProvider\getKeyType(), ilLTIConsumeProvider\getPublicKey(), ilLTIConsumeProvider\getPublicKeyset(), getRequestValue(), ilObjectFactory\getTypeByRefId(), initMetadata(), and Firebase\JWT\JWK\parseKeySet().

Referenced by contentSelectionResponse().

481  : void
482  {
483  if ($provider->getKeyType() == 'RSA_KEY') {
484  $key = $provider->getPublicKey();
485  $keys = new Firebase\JWT\Key($key, "RS256");
486  } else {
487  $jwks = file_get_contents($provider->getPublicKeyset());
488  //ToDo: Errorhandling
489  $keyset = json_decode($jwks, true);
491  }
493  //ilObjLTIConsumer::getLogger()->debug(var_export($data,TRUE));
494  $refId = $this->getRequestValue('ref_id');
495 
496  foreach ($data->{'https://purl.imsglobal.org/spec/lti-dl/claim/content_items'} as $item) {
497  $gui = new ilObjLTIConsumerGUI(0, self::REPOSITORY_NODE_ID, (int) $refId);
498  $description = "";
499  if (isset($item->description)) {
500  $description = $item->description;
501  }
502  $newObj = $gui->createNewObject('lti', $item->title, $description);
503  $dtpl = $gui->getDidacticTemplateVar("dtpl");
504  if ($dtpl) {
505  $newObj->applyDidacticTemplate($dtpl);
506  }
507 
508  $newObj->setProviderId($provider->getId());
509  $newObj->setProvider($provider);
510  // custom params
511  $customParams = [];
512  foreach ($item->{'custom'} as $key => $value) {
513  $customParams[] = $key . "=" . $value;
514  }
515  if (count($customParams) > 0) {
516  $newObj->setCustomParams(implode(";", $customParams));
517  }
518  $newObj->save();
519  $this->initMetadata($newObj);
520  }
522  $template = new ilTemplate('tpl.lti_content_selection_finished.html', true, true, 'Modules/LTIConsumer');
523  $redirect = ilObjLTIConsumer::getIliasHttpPath() . "/" . "goto.php?target=" . $type . "_" . $refId;
524  $template->setVariable("CONTENT_SELECTION_REDIRECT", $redirect);
525  echo $template->get();
526  exit;
527  }
exit
Definition: login.php:28
$refId
Definition: xapitoken.php:58
static getTypeByRefId(int $ref_id, bool $stop_on_error=true)
get object type by reference id
$keys
Definition: metadata.php:204
$token
Definition: xapitoken.php:70
static array static decode(string $jwt, $keyOrKeyArray, stdClass &$headers=null)
Decodes a JWT string into a PHP object.
Definition: JWT.php:96
string $key
Consumer key/client ID value.
Definition: System.php:193
const const static parseKeySet(array $jwks, string $defaultAlg=null)
Parse a set of JWK keys.
Definition: JWK.php:55
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCustom()

ilObjLTIConsumerGUI::saveCustom ( )

Definition at line 243 of file class.ilObjLTIConsumerGUI.php.

References $DIC, afterSave(), createNewObject(), ilObjectGUI\getDidacticTemplateVar(), getRequestValue(), ilLTIConsumerAccess\hasCustomProviderCreationAccess(), and initCustomCreateForm().

243  : void
244  {
246  throw new ilLtiConsumerException('permission denied!');
247  }
248 
249  global $DIC;
250  /* @var \ILIAS\DI\Container $DIC */
251 
252  $new_type = $this->getRequestValue("new_type");
253 
254  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
255 
256  $DIC->language()->loadLanguageModule($new_type);
257 
258  $form = $this->initCustomCreateForm($new_type);
259 
260  if ($form->checkInput()) {
261  $DIC->ctrl()->setParameter($this, "new_type", "");
262 
263  // create object
264  $newObj = $this->createNewObject(
265  $new_type,
266  $form->getInput('title'),
267  $form->getInput('desc')
268  );
269 
270  // apply didactic template?
271  $dtpl = $this->getDidacticTemplateVar("dtpl");
272  if ($dtpl) {
273  $newObj->applyDidacticTemplate($dtpl);
274  }
275 
276  $this->afterSave($newObj);
277 
278  return;
279  }
280 
281  $form->setValuesByPost();
282 
283  $DIC->ui()->mainTemplate()->setContent($form->getHtml());
284  }
createNewObject(string $newType, string $title, string $description)
getDidacticTemplateVar(string $type)
Get didactic template setting from creation screen.
global $DIC
Definition: feed.php:28
initCustomCreateForm(string $a_new_type)
afterSave(\ilObject $newObject)
+ Here is the call graph for this function:

◆ saveDynReg()

ilObjLTIConsumerGUI::saveDynReg ( )

Definition at line 353 of file class.ilObjLTIConsumerGUI.php.

References $DIC, $provider, ilSession\clear(), getRequestValue(), ilLTIConsumerAccess\hasCustomProviderCreationAccess(), and initShowToolConfig().

353  : void
354  {
355  global $DIC;
357  throw new ilLtiConsumerException('permission denied!');
358  }
359  $new_type = $this->getRequestValue("new_type");
360  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
361  $provider_id = $this->getRequestValue("provider_id");
362  $DIC->ctrl()->setParameter($this, "provider_id", $provider_id);
363  $DIC->language()->loadLanguageModule($new_type);
364  ilSession::clear('lti_dynamic_registration_client_id');
365  ilSession::clear('lti_dynamic_registration_custom_params');
366  $form = $this->initShowToolConfig($new_type, (int) $provider_id);
367  $form->setValuesByPost();
368  if ($form->checkInput()) { // update only overridable fields
369  $provider = $form->getProvider();
370  $form->initProvider($provider);
371  $provider->update();
372  // jump to provider selection is one option:
373  // $DIC->ctrl()->redirectByClass([ilRepositoryGUI::class, ilObjLTIConsumerGUI::class],"create");
374  // direct redirection to save is onle less click (there is a switch for save | contentSelection in GUI class):
375  $DIC->ctrl()->redirectByClass([ilRepositoryGUI::class, ilObjLTIConsumerGUI::class], "save");
376  return;
377  }
378  $DIC->ui()->mainTemplate()->setContent($form->getHTML());
379  }
initShowToolConfig(string $a_new_type, int $a_provider_id)
global $DIC
Definition: feed.php:28
$provider
Definition: ltitoken.php:83
static clear(string $a_var)
+ Here is the call graph for this function:

◆ setTabs()

ilObjLTIConsumerGUI::setTabs ( )
protected

Definition at line 875 of file class.ilObjLTIConsumerGUI.php.

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

875  : void
876  {
877  global $DIC;
878 
879  /* @var \ILIAS\DI\Container $DIC */
880  $DIC->language()->loadLanguageModule('lti');
881 
882  if (!$this->object->getOfflineStatus() &&
883  $this->object->getProvider()->getAvailability() != ilLTIConsumeProvider::AVAILABILITY_NONE
884  ) {
885  $DIC->tabs()->addTab(
886  self::TAB_ID_CONTENT,
887  $DIC->language()->txt(self::TAB_ID_CONTENT),
888  $DIC->ctrl()->getLinkTargetByClass(ilLTIConsumerContentGUI::class)
889  );
890  }
891 
892  $DIC->tabs()->addTab(
893  self::TAB_ID_INFO,
894  $DIC->language()->txt(self::TAB_ID_INFO),
895  $this->ctrl->getLinkTargetByClass(ilInfoScreenGUI::class)
896  );
897 
898  if ($this->ltiAccess->hasWriteAccess()) {
899  $DIC->tabs()->addTab(
900  self::TAB_ID_SETTINGS,
901  $DIC->language()->txt(self::TAB_ID_SETTINGS),
902  $DIC->ctrl()->getLinkTargetByClass(ilLTIConsumerSettingsGUI::class)
903  );
904  }
905 
906  if ($this->ltiAccess->hasStatementsAccess()) {
907  $DIC->tabs()->addTab(
908  self::TAB_ID_STATEMENTS,
909  $DIC->language()->txt(self::TAB_ID_STATEMENTS),
910  $DIC->ctrl()->getLinkTargetByClass(ilLTIConsumerXapiStatementsGUI::class)
911  );
912  }
913 
914  if ($this->ltiAccess->hasHighscoreAccess()) {
915  //$DIC->language()->loadLanguageModule('lti');
916  $DIC->tabs()->addTab(
917  self::TAB_ID_SCORING,
918  $DIC->language()->txt(self::TAB_ID_SCORING),
919  $DIC->ctrl()->getLinkTargetByClass(ilLTIConsumerScoringGUI::class)
920  );
921  }
922 
923  if ($this->object->getProvider()->isGradeSynchronization()) {
924  $DIC->tabs()->addTab(
925  self::TAB_ID_GRADE_SYNCHRONIZATION,
926  $DIC->language()->txt(self::TAB_ID_GRADE_SYNCHRONIZATION),
927  $DIC->ctrl()->getLinkTargetByClass(ilLTIConsumerGradeSynchronizationGUI::class)
928  );
929  }
930 
931  if ($this->ltiAccess->hasLearningProgressAccess() && $this->object->getProvider()->getHasOutcome()) {
932  $DIC->tabs()->addTab(
933  self::TAB_ID_LEARNING_PROGRESS,
934  $DIC->language()->txt(self::TAB_ID_LEARNING_PROGRESS),
935  $DIC->ctrl()->getLinkTargetByClass(ilLearningProgressGUI::class)
936  );
937  }
938 
939  if ($this->ltiAccess->hasWriteAccess()) {
940  $gui = new ilObjectMetaDataGUI($this->object);
941  $link = $gui->getTab();
942 
943  if (strlen($link)) {
944  $DIC->tabs()->addTab(
945  self::TAB_ID_METADATA,
946  $DIC->language()->txt('meta_data'),
947  $link
948  );
949  }
950  }
951 
952  if ($this->ltiAccess->hasEditPermissionsAccess()) {
953  $DIC->tabs()->addTab(
954  self::TAB_ID_PERMISSIONS,
955  $DIC->language()->txt(self::TAB_ID_PERMISSIONS),
956  $DIC->ctrl()->getLinkTargetByClass(ilPermissionGUI::class, 'perm')
957  );
958  }
959 
960  // if (defined('DEVMODE') && DEVMODE) {
961  // $DIC->tabs()->addTab(
962  // 'debug',
963  // 'DEBUG',
964  // $DIC->ctrl()->getLinkTarget($this, 'debug')
965  // );
966  // }
967  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ showToolConfig()

ilObjLTIConsumerGUI::showToolConfig ( )

Definition at line 338 of file class.ilObjLTIConsumerGUI.php.

References $DIC, getRequestValue(), ilLTIConsumerAccess\hasCustomProviderCreationAccess(), and initShowToolConfig().

338  : void
339  {
340  global $DIC;
342  throw new ilLtiConsumerException('permission denied!');
343  }
344  $new_type = $this->getRequestValue("new_type");
345  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
346  $provider_id = $this->getRequestValue("provider_id");
347  $DIC->ctrl()->setParameter($this, "provider_id", $provider_id);
348  $DIC->language()->loadLanguageModule($new_type);
349  $form = $this->initShowToolConfig($new_type, (int) $provider_id);
350  $DIC->ui()->mainTemplate()->setContent($form->getHTML());
351  }
initShowToolConfig(string $a_new_type, int $a_provider_id)
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ trackObjectReadEvent()

ilObjLTIConsumerGUI::trackObjectReadEvent ( )
protected

Definition at line 1031 of file class.ilObjLTIConsumerGUI.php.

References $DIC, $object, ilChangeEvent\_recordReadEvent(), ilLPStatusWrapper\_updateStatus(), ILIAS\Repository\ctrl(), and ILIAS\Repository\object().

Referenced by _goto().

1031  : void
1032  {
1033  global $DIC;
1034  /* @var \ILIAS\DI\Container $DIC */
1035 
1037  $this->object->getType(),
1038  $this->object->getRefId(),
1039  $this->object->getId(),
1040  $DIC->user()->getId()
1041  );
1042 
1043  ilLPStatusWrapper::_updateStatus($this->object->getId(), $DIC->user()->getId());
1044  }
global $DIC
Definition: feed.php:28
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ltiAccess

ilLTIConsumerAccess ilObjLTIConsumerGUI::$ltiAccess
protected

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

◆ $object

ilObject ilObjLTIConsumerGUI::$object = null

Definition at line 55 of file class.ilObjLTIConsumerGUI.php.

Referenced by _goto(), and trackObjectReadEvent().

◆ $parent_node_id

int ilObjLTIConsumerGUI::$parent_node_id = 0

Definition at line 58 of file class.ilObjLTIConsumerGUI.php.

◆ CFORM_CUSTOM_NEW

const ilObjLTIConsumerGUI::CFORM_CUSTOM_NEW = 99

Definition at line 40 of file class.ilObjLTIConsumerGUI.php.

◆ CFORM_DYNAMIC_REGISTRATION

const ilObjLTIConsumerGUI::CFORM_DYNAMIC_REGISTRATION = 98

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

◆ DEFAULT_CMD

const ilObjLTIConsumerGUI::DEFAULT_CMD = 'launch'

◆ TAB_ID_CONTENT

const ilObjLTIConsumerGUI::TAB_ID_CONTENT = 'tab_content'

Definition at line 44 of file class.ilObjLTIConsumerGUI.php.

◆ TAB_ID_GRADE_SYNCHRONIZATION

const ilObjLTIConsumerGUI::TAB_ID_GRADE_SYNCHRONIZATION = 'tab_grade_synchronization'

Definition at line 48 of file class.ilObjLTIConsumerGUI.php.

◆ TAB_ID_INFO

const ilObjLTIConsumerGUI::TAB_ID_INFO = 'tab_info'

Definition at line 43 of file class.ilObjLTIConsumerGUI.php.

◆ TAB_ID_LEARNING_PROGRESS

const ilObjLTIConsumerGUI::TAB_ID_LEARNING_PROGRESS = 'learning_progress'

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

◆ TAB_ID_METADATA

const ilObjLTIConsumerGUI::TAB_ID_METADATA = 'tab_metadata'

Definition at line 49 of file class.ilObjLTIConsumerGUI.php.

◆ TAB_ID_PERMISSIONS

const ilObjLTIConsumerGUI::TAB_ID_PERMISSIONS = 'perm_settings'

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

◆ TAB_ID_SCORING

const ilObjLTIConsumerGUI::TAB_ID_SCORING = 'tab_scoring'

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

◆ TAB_ID_SETTINGS

const ilObjLTIConsumerGUI::TAB_ID_SETTINGS = 'tab_settings'

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

◆ TAB_ID_STATEMENTS

const ilObjLTIConsumerGUI::TAB_ID_STATEMENTS = 'tab_statements'

Definition at line 46 of file class.ilObjLTIConsumerGUI.php.


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