ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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)
 
 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] does belong to the parent 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...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 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="")
 
 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...
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 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...
 
 addAdoptContentLinkToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 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...
 
 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...
 

Protected Attributes

ilLTIConsumerAccess $ltiAccess
 
- Protected Attributes inherited from ilObject2GUI
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
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 = []
 
 $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
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
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\MetaData\Repository\Validation\Data\__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(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

static ilObjLTIConsumerGUI::_goto ( string  $a_target)
static

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

References ilObject2GUI\$access, ilObject2GUI\$ctrl, $DIC, ilObjectGUI\$id, $ilErr, ilObject2GUI\$lng, $object, ilObjectGUI\$request, 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().

642  : void
643  {
644  global $DIC;
645  $main_tpl = $DIC->ui()->mainTemplate();
646  /* @var \ILIAS\DI\Container $DIC */
647  $err = $DIC['ilErr'];
648  /* @var ilErrorHandling $err */
649  $ctrl = $DIC->ctrl();
650  $request = $DIC->http()->request();
651  $access = $DIC->access();
652  $lng = $DIC->language();
653 
654  $targetParameters = explode('_', $a_target);
655  $id = (int) $targetParameters[0];
656 
657  if ($id <= 0) {
658  $err->raiseError($lng->txt('msg_no_perm_read'), $err->FATAL);
659  }
660 
661  if ($access->checkAccess('read', '', $id)) {
662  $ctrl->setTargetScript('ilias.php');
663  $ctrl->setParameterByClass(ilObjLTIConsumerGUI::class, 'ref_id', $id);
664  $ctrl->redirectByClass([ilRepositoryGUI::class, ilObjLTIConsumerGUI::class]);
665  } elseif ($access->checkAccess('visible', '', $id)) {
666  ilObjectGUI::_gotoRepositoryNode($id, 'infoScreen');
667  } elseif ($access->checkAccess('read', '', ROOT_FOLDER_ID)) {
668  $main_tpl->setOnScreenMessage(
669  'info',
670  sprintf(
671  $DIC->language()->txt('msg_no_perm_read_item'),
673  ),
674  true
675  );
676 
678  }
679 
680  $err->raiseError($DIC->language()->txt("msg_no_perm_read_lm"), $err->FATAL);
681  }
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 283 of file class.ilObjLTIConsumerGUI.php.

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

283  : void
284  {
285  global $DIC;
287  throw new ilLtiConsumerException('permission denied!');
288  }
289  $new_type = $this->getRequestValue("new_type");
290 
291  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
292 
293  $DIC->language()->loadLanguageModule($new_type);
294  $form = $this->initDynRegForm($new_type);
295  $error = ($this->getRequestValue('error') != null) ? $this->getRequestValue('error') : "";
296  $form->setValuesByPost();
297  if (!empty($error)) {
298  $DIC->ctrl()->setParameter($this, "new_type", "");
299  $DIC->ui()->mainTemplate()->setOnScreenMessage('failure', base64_decode($error));
300  $DIC->ui()->mainTemplate()->setContent($form->getDynRegError());
301  return;
302  }
303  if ($form->checkInput()) {
304  $DIC->ctrl()->setParameter($this, "new_type", "");
305  $DIC->ui()->mainTemplate()->setContent($form->getDynRegRequest());
306  return;
307  }
308  $DIC->ui()->mainTemplate()->setContent($form->getHTML());
309  }
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 1017 of file class.ilObjLTIConsumerGUI.php.

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

1017  : void
1018  {
1019  global $DIC;
1020  /* @var \ILIAS\DI\Container $DIC */
1021 
1022  $locator = $DIC['ilLocator'];
1023  /* @var ilLocatorGUI $locator */
1024  $locator->addItem(
1025  $this->object->getTitle(),
1026  $this->ctrl->getLinkTarget($this, self::DEFAULT_CMD),
1027  "",
1028  $this->object->getRefId()
1029  );
1030  }
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 526 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().

526  : void
527  {
528  global $DIC; //check
529 
530  if ($DIC->http()->wrapper()->query()->has('provider_id')) {
531  $newObject->setProviderId((int) $DIC->http()->wrapper()->query()->retrieve('provider_id', $DIC->refinery()->kindlyTo()->int()));
532  $newObject->initProvider();
533  $newObject->save();
534 
535  $newObject->setTitle($newObject->getProvider()->getTitle());
536  $newObject->setMasteryScore($newObject->getProvider()->getMasteryScore());
537  $newObject->update();
538 
539  $this->initMetadata($newObject);
540 
541  $DIC->ctrl()->redirectByClass(ilLTIConsumerSettingsGUI::class);
542  }
543 
545  throw new ilLtiConsumerException('permission denied!');
546  }
547 
548  $form = $this->initCustomCreateForm($newObject->getType());
549 
550  if ($form->checkInput()) {
552  $form->initProvider($provider);
554  $provider->setIsGlobal(false);
555  $provider->setCreator($DIC->user()->getId());
556  $provider->save();
557 
558  $newObject->setProviderId($provider->getId());
559  $newObject->setProvider($provider);
560  $newObject->save();
561 
562  $newObject->setTitle($provider->getTitle());
563  $newObject->setMasteryScore($newObject->getProvider()->getMasteryScore());
564  $newObject->update();
565 
566  $this->initMetadata($newObject);
567 
568  $DIC->ctrl()->redirectByClass(ilObjLTIConsumerGUI::class);
569  }
570 
571  throw new ilLtiConsumerException(
572  'form validation seems to not have worked in ilObjLTIConsumer::saveCustom()!'
573  );
574  }
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 213 of file class.ilObjLTIConsumerGUI.php.

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

213  : void
214  {
215  $form = $this->buildProviderSelectionForm('');
216  $form->applyFilter();
217  $this->createObject();
218  }
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 202 of file class.ilObjLTIConsumerGUI.php.

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

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

◆ cancelContentSelection()

ilObjLTIConsumerGUI::cancelContentSelection ( )

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

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

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

◆ cancelDynReg()

ilObjLTIConsumerGUI::cancelDynReg ( )

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

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

311  : void
312  {
313  global $DIC;
315  throw new ilLtiConsumerException('permission denied!');
316  }
317  $new_type = $this->getRequestValue("new_type");
318  //$provider_id = $this->getRequestValue("provider_id");
319  if (ilSession::has('lti_dynamic_registration_client_id')) {
320  $providerId = ilLTIConsumeProvider::getProviderIdFromClientId(ilSession::get('lti_dynamic_registration_client_id'));
321  if ($providerId > 0) {
322  try {
324  //ToDo: check if provider is in use? should never happen...
325  $provider->delete();
326  } catch (\ILIAS\Filesystem\Exception\IOException $e) {
327  //ToDo: error handling
328  }
329  }
330  }
331  $DIC->ctrl()->setParameterByClass(ilRepositoryGUI::class, 'new_type', $new_type);
332  $DIC->ctrl()->redirectByClass(ilRepositoryGUI::class, 'create');
333  }
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)
+ Here is the call graph for this function:

◆ checkContentSelection()

ilObjLTIConsumerGUI::checkContentSelection ( )
protected

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

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

Referenced by _goto().

850  : void
851  {
852  global $DIC;
853  $providerId = $this->getRequestValue('provider_id');
854  $newType = $this->getRequestValue('new_type');
855  $refId = $this->getRequestValue('ref_id');
856  if ($providerId !== null && $newType == 'lti' && $refId != null) {
858  // check if post variables from contentSelectionResponse
859  if ($DIC->http()->wrapper()->post()->has('JWT')) {
860  // ToDo:
861  } else {
862  if ($provider->isContentItem() && !empty($provider->getContentItemUrl())) {
863  $this->contentSelection($providerId, $newType, $refId, $provider);
864  } else {
865  $this->save();
866  }
867  }
868  } else {
869  $this->save();
870  }
871  }
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 378 of file class.ilObjLTIConsumerGUI.php.

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

Referenced by checkContentSelection().

378  : void
379  {
380  global $DIC;
382  throw new ilLtiConsumerException('permission denied!');
383  }
384  $DIC->ctrl()->setParameter($this, "new_type", $newType);
385  $DIC->ctrl()->setParameter($this, "provider_id", $providerId);
386  $DIC->ctrl()->setParameter($this, "ref_id", $refId);
387 
388  $form = new ilLTIConsumeProviderFormGUI($provider);
389  $formaction = $this->ctrl->getFormAction($this, "cancelContentSelection");
390  $DIC->ui()->mainTemplate()->setContent($form->getContentSelectionFrame($formaction));
391  }
$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 393 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().

393  : void
394  {
395  global $DIC;
397  throw new ilLtiConsumerException('permission denied!');
398  }
399  $new_type = $this->getRequestValue("new_type");
400  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
401  $provider_id = $this->getRequestValue("provider_id");
402  $DIC->ctrl()->setParameter($this, "provider_id", $provider_id);
403  $ref_id = $this->getRequestValue("ref_id");
404  $DIC->ctrl()->setParameter($this, "ref_id", $ref_id);
405  $DIC->language()->loadLanguageModule($new_type);
406  $provider = new ilLTIConsumeProvider((int) $provider_id);
407  $redirectUrl = $DIC->ctrl()->getLinkTarget($this, 'contentSelectionRequest');
408 
409  if (!ilSession::has('lti13_login_data')) {
410  $userIdLTI = ilCmiXapiUser::getIdent($provider->getPrivacyIdent(), $DIC->user()); //was: getIdentAsId
411  //$emailPrimary = ilCmiXapiUser::getIdent($provider->getPrivacyIdent(), $DIC->user());
412  $ltiMessageHint = (string) $ref_id . ":" . CLIENT_ID . ":" . base64_encode($redirectUrl);
413  $tplLogin = new ilTemplate("tpl.lti_initial_login.html", true, true, "Modules/LTIConsumer");
414  $tplLogin->setVariable("LTI_INITIAL_LOGIN_ACTION", $provider->getInitiateLogin());
415  $tplLogin->setVariable("ISS", ilObjLTIConsumer::getIliasHttpPath());
416  $tplLogin->setVariable("TARGET_LINK_URL", $provider->getProviderUrl());
417  $tplLogin->setVariable("LOGIN_HINT", $userIdLTI);
418  $tplLogin->setVariable("LTI_MESSAGE_HINT", $ltiMessageHint);
419  $tplLogin->setVariable("CLIENT_ID", $provider->getClientId());
420  $tplLogin->setVariable("LTI_DEPLOYMENT_ID", (string) $provider->getId());
421  echo $tplLogin->get();
422  exit; //TODO: no exit
423  } else {
424  $loginData = ilSession::get('lti13_login_data');
425  // ToDo: correct Link!! replace ILIAS_HTTP_PATH
426  $data = ilObjLTIConsumer::buildContentSelectionParameters($provider, (int) $ref_id, ilObjLTIConsumer::getIliasHttpPath() . "/" . $DIC->ctrl()->getLinkTarget($this, 'contentSelectionResponse'), $loginData['nonce']);
427  $tplContentSelection = new ilTemplate("tpl.lti_jwt_autosubmit.html", true, true, "Modules/LTIConsumer");
428  $tplContentSelection->setVariable("LTI_JWT_FORM_ACTION", $provider->getContentItemUrl());
429  $tplContentSelection->setVariable("LTI_JWT_ID_TOKEN", $data['id_token']);
430  $tplContentSelection->setVariable("LTI_JWT_STATE", $loginData['state']);
431  ilSession::clear('lti13_login_data');
432  echo $tplContentSelection->get();
433  exit; //TODO: no exit
434  }
435  }
static get(string $a_var)
exit
Definition: login.php:29
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 437 of file class.ilObjLTIConsumerGUI.php.

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

437  : void
438  {
439  global $DIC;
441  throw new ilLtiConsumerException('permission denied!');
442  }
443  $new_type = $this->getRequestValue("new_type");
444  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
445  $provider_id = $this->getRequestValue("provider_id");
446  $DIC->ctrl()->setParameter($this, "provider_id", $provider_id);
447  $ref_id = $this->getRequestValue("ref_id");
448  $DIC->ctrl()->setParameter($this, "ref_id", $ref_id);
449  $DIC->language()->loadLanguageModule($new_type);
450  $token = '';
451  if ($DIC->http()->wrapper()->post()->has('JWT')) {
452  $token = $DIC->http()->wrapper()->post()->retrieve('JWT', $DIC->refinery()->kindlyTo()->string());
453  }
454  if ($DIC->http()->wrapper()->post()->has('jwt')) {
455  $token = $DIC->http()->wrapper()->post()->retrieve('jwt', $DIC->refinery()->kindlyTo()->string());
456  }
457  if (!empty($token)) {
458  $provider = new ilLTIConsumeProvider((int) $provider_id);
460  } else {
461  echo "no token";
462  exit;
463  //ToDo:
464  }
465  }
exit
Definition: login.php:29
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 227 of file class.ilObjLTIConsumerGUI.php.

References ilObject2GUI\putObjectInTree().

Referenced by saveCustom().

227  : ilObject
228  {
229  $classname = "ilObj" . $this->obj_definition->getClassName($newType);
230 
231  $newObj = new $classname();
232  $newObj->setType($newType);
233  $newObj->setTitle($title);
234  $newObj->setDescription($description);
235  $newObj->create();
236  $this->putObjectInTree($newObj);
237  return $newObj;
238  }
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 1165 of file class.ilObjLTIConsumerGUI.php.

References ILIAS\Repository\refinery().

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

1165  : ?string
1166  {
1167  if ($this->request_wrapper->has($key)) {
1168  return $this->request_wrapper->retrieve($key, $this->refinery->kindlyTo()->string());
1169  }
1170  return null;
1171  }
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 1154 of file class.ilObjLTIConsumerGUI.php.

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

Referenced by infoScreenForward().

1154  : void
1155  {
1156  global $DIC;
1157  /* @var \ILIAS\DI\Container $DIC */
1158  if ($this->object->getProvider()->getProviderUrl() == '') {
1159  $this->tpl->setOnScreenMessage('failure', $DIC->language()->txt('lti_provider_not_set_msg'));
1160  } elseif ($this->object->getProvider()->getAvailability() == ilLTIConsumeProvider::AVAILABILITY_NONE) {
1161  $this->tpl->setOnScreenMessage('failure', $DIC->language()->txt('lti_provider_not_avail_msg'));
1162  }
1163  }
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 1056 of file class.ilObjLTIConsumerGUI.php.

References $DIC, and infoScreenForward().

Referenced by _goto().

1056  : void
1057  {
1058  global $DIC;
1059  /* @var \ILIAS\DI\Container $DIC */
1060 
1061  $DIC->tabs()->activateTab(self::TAB_ID_INFO);
1062 
1063  $DIC->ctrl()->setCmd("showSummary");
1064  $DIC->ctrl()->setCmdClass("ilinfoscreengui");
1065  $this->infoScreenForward();
1066  }
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 1068 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().

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

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

Referenced by initCreationForms().

98  {
99  global $DIC;
100  /* @var \ILIAS\DI\Container $DIC */
101 
102  $form = $this->buildProviderSelectionForm($a_new_type);
103 
104  $globalProviderList = new ilLTIConsumeProviderList();
105  $globalProviderList->setAvailabilityFilter((string) ilLTIConsumeProvider::AVAILABILITY_CREATE);
106  $globalProviderList->setScopeFilter(ilLTIConsumeProviderList::SCOPE_GLOBAL);
107 
108  $userProviderList = new ilLTIConsumeProviderList();
109  $userProviderList->setAvailabilityFilter((string) ilLTIConsumeProvider::AVAILABILITY_CREATE);
110  $userProviderList->setScopeFilter(ilLTIConsumeProviderList::SCOPE_USER);
111  $userProviderList->setCreatorFilter($DIC->user()->getId());
112 
113  if ($form->getFilter('title')) {
114  $globalProviderList->setTitleFilter($form->getFilter('title'));
115  $userProviderList->setTitleFilter($form->getFilter('title'));
116  }
117 
118  if ($form->getFilter('category')) {
119  $globalProviderList->setCategoryFilter($form->getFilter('category'));
120  $userProviderList->setCategoryFilter($form->getFilter('category'));
121  }
122 
123  if ($form->getFilter('keyword')) {
124  $globalProviderList->setKeywordFilter($form->getFilter('keyword'));
125  $userProviderList->setKeywordFilter($form->getFilter('keyword'));
126  }
127 
128  if ($form->getFilter('outcome')) {
129  $globalProviderList->setHasOutcomeFilter(true);
130  $userProviderList->setHasOutcomeFilter(true);
131  }
132 
133  if ($form->getFilter('internal')) {
134  $globalProviderList->setIsExternalFilter(false);
135  $userProviderList->setIsExternalFilter(false);
136  }
137 
138  if ($form->getFilter('with_key')) {
139  $globalProviderList->setIsProviderKeyCustomizableFilter(false);
140  $userProviderList->setIsProviderKeyCustomizableFilter(false);
141  }
142 
143  $globalProviderList->load();
144  $userProviderList->load();
145 
146  $form->setData([...$globalProviderList->getTableData(), ...$userProviderList->getTableData()]);
147 
148  return $form;
149  }
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 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  return $forms;
95  }
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 182 of file class.ilObjLTIConsumerGUI.php.

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

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

183  {
184  global $DIC;
185  /* @var \ILIAS\DI\Container $DIC */
186 
188 
190 
191  $form->initForm($this->ctrl->getFormAction($this, "save"), '', '');
192 
193  $form->clearCommandButtons();
194  $form->addCommandButton("saveCustom", $this->lng->txt($a_new_type . "_add_own_provider"));
195  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
196 
197  $form->setTitle($DIC->language()->txt($a_new_type . '_custom_new'));
198 
199  return $form;
200  }
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 151 of file class.ilObjLTIConsumerGUI.php.

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

Referenced by addDynReg(), and initCreationForms().

152  {
153  global $DIC;
154  /* @var \ILIAS\DI\Container $DIC */
157  $form->initDynRegForm($this->ctrl->getFormAction($this, "cancelDynReg"));
158  $form->setTitle($DIC->language()->txt($a_new_type . '_dynamic_registration'));
159  return $form;
160  }
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 607 of file class.ilObjLTIConsumerGUI.php.

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

608  {
609  global $DIC;
610  /* @var \ILIAS\DI\Container $DIC */
611 
612  $return = parent::initHeaderAction($a_sub_type, $a_sub_id);
613 
614  if ($this->creation_mode) {
615  return $return;
616  }
617 
618  $validator = new ilCertificateDownloadValidator();
619  if ($validator->isCertificateDownloadable($DIC->user()->getId(), $this->object->getId())) {
620  $certLink = $DIC->ctrl()->getLinkTargetByClass(
621  [ilObjLTIConsumerGUI::class, ilLTIConsumerSettingsGUI::class],
623  );
624 
625  $DIC->language()->loadLanguageModule('certificate');
626 
627  $return->addCustomCommand($certLink, 'download_certificate');
628 
629  $return->addHeaderIcon(
630  'cert_icon',
631  ilUtil::getImagePath('standard/icon_cert.svg'),
632  $DIC->language()->txt('download_certificate'),
633  null,
634  null,
635  $certLink
636  );
637  }
638 
639  return $return;
640  }
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 576 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().

576  : void
577  {
578  $metadata = new ilMD($object->getId(), $object->getId(), $object->getType());
579 
580  $generalMetadata = $metadata->getGeneral();
581 
582  if (!$generalMetadata) {
583  $generalMetadata = $metadata->addGeneral();
584  }
585 
586  $generalMetadata->setTitle($object->getTitle());
587  $generalMetadata->save();
588 
589  $id = $generalMetadata->addIdentifier();
590  $id->setCatalog('ILIAS');
591  $id->setEntry('il__' . $object->getType() . '_' . $object->getId());
592  $id->save();
593 
594  $keywords = $object->getProvider()->getKeywordsArray();
595 
596  // language needed now
597  $ulang = $this->user->getLanguage();
598  $keywords = array($ulang => $keywords);
599 
600  ilMDKeyword::updateKeywords($generalMetadata, $keywords);
601  }
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 162 of file class.ilObjLTIConsumerGUI.php.

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

Referenced by saveDynReg(), and showToolConfig().

163  {
164  global $DIC;
165 
166  //ToDo: Error Handling
167  $provider = new ilLTIConsumeProvider($a_provider_id);
168 
170 
171  $form->initToolConfigForm($this->ctrl->getFormAction($this, "cancelDynReg"), '', '');
172 
173  $form->clearCommandButtons();
174  $form->addCommandButton("saveDynReg", $this->lng->txt('save'));
175  $form->addCommandButton("cancelDynReg", $this->lng->txt("cancel"));
176 
177  $form->setTitle($DIC->language()->txt($a_new_type . '_custom_new'));
178 
179  return $form;
180  }
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 220 of file class.ilObjLTIConsumerGUI.php.

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

220  : void
221  {
222  $form = $this->buildProviderSelectionForm('');
223  $form->resetFilter();
224  $this->createObject();
225  }
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 478 of file class.ilObjLTIConsumerGUI.php.

References ilObjectGUI\$data, ILIAS\LTI\ToolProvider\$key, $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().

478  : void
479  {
480  if ($provider->getKeyType() == 'RSA_KEY') {
481  $key = $provider->getPublicKey();
482  $keys = new Firebase\JWT\Key($key, "RS256");
483  } else {
484  $jwks = file_get_contents($provider->getPublicKeyset());
485  //ToDo: Errorhandling
486  $keyset = json_decode($jwks, true);
487  $keys = Firebase\JWT\JWK::parseKeySet($keyset);
488  }
490  //ilObjLTIConsumer::getLogger()->debug(var_export($data,TRUE));
491  $refId = $this->getRequestValue('ref_id');
492 
493  foreach ($data->{'https://purl.imsglobal.org/spec/lti-dl/claim/content_items'} as $item) {
494  $gui = new ilObjLTIConsumerGUI(0, self::REPOSITORY_NODE_ID, (int) $refId);
495  $description = "";
496  if (isset($item->description)) {
497  $description = $item->description;
498  }
499  $newObj = $gui->createNewObject('lti', $item->title, $description);
500  $dtpl = $gui->getDidacticTemplateVar("dtpl");
501  if ($dtpl) {
502  $newObj->applyDidacticTemplate($dtpl);
503  }
504 
505  $newObj->setProviderId($provider->getId());
506  $newObj->setProvider($provider);
507  // custom params
508  $customParams = [];
509  foreach ($item->{'custom'} as $key => $value) {
510  $customParams[] = $key . "=" . $value;
511  }
512  if (count($customParams) > 0) {
513  $newObj->setCustomParams(implode(";", $customParams));
514  }
515  $newObj->save();
516  $this->initMetadata($newObj);
517  }
519  $template = new ilTemplate('tpl.lti_content_selection_finished.html', true, true, 'Modules/LTIConsumer');
520  $redirect = ilObjLTIConsumer::getIliasHttpPath() . "/" . "goto.php?target=" . $type . "_" . $refId;
521  $template->setVariable("CONTENT_SELECTION_REDIRECT", $redirect);
522  echo $template->get();
523  exit;
524  }
exit
Definition: login.php:29
$refId
Definition: xapitoken.php:58
static getTypeByRefId(int $ref_id, bool $stop_on_error=true)
get object type by reference id
$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 240 of file class.ilObjLTIConsumerGUI.php.

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

240  : void
241  {
243  throw new ilLtiConsumerException('permission denied!');
244  }
245 
246  global $DIC;
247  /* @var \ILIAS\DI\Container $DIC */
248 
249  $new_type = $this->getRequestValue("new_type");
250 
251  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
252 
253  $DIC->language()->loadLanguageModule($new_type);
254 
255  $form = $this->initCustomCreateForm($new_type);
256 
257  if ($form->checkInput()) {
258  $DIC->ctrl()->setParameter($this, "new_type", "");
259 
260  // create object
261  $newObj = $this->createNewObject(
262  $new_type,
263  $form->getInput('title'),
264  $form->getInput('desc')
265  );
266 
267  // apply didactic template?
268  $dtpl = $this->getDidacticTemplateVar("dtpl");
269  if ($dtpl) {
270  $newObj->applyDidacticTemplate($dtpl);
271  }
272 
273  $this->afterSave($newObj);
274 
275  return;
276  }
277 
278  $form->setValuesByPost();
279 
280  $DIC->ui()->mainTemplate()->setContent($form->getHtml());
281  }
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 350 of file class.ilObjLTIConsumerGUI.php.

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

350  : void
351  {
352  global $DIC;
354  throw new ilLtiConsumerException('permission denied!');
355  }
356  $new_type = $this->getRequestValue("new_type");
357  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
358  $provider_id = $this->getRequestValue("provider_id");
359  $DIC->ctrl()->setParameter($this, "provider_id", $provider_id);
360  $DIC->language()->loadLanguageModule($new_type);
361  ilSession::clear('lti_dynamic_registration_client_id');
362  ilSession::clear('lti_dynamic_registration_custom_params');
363  $form = $this->initShowToolConfig($new_type, (int) $provider_id);
364  $form->setValuesByPost();
365  if ($form->checkInput()) { // update only overridable fields
366  $provider = $form->getProvider();
367  $form->initProvider($provider);
368  $provider->update();
369  // jump to provider selection is one option:
370  // $DIC->ctrl()->redirectByClass([ilRepositoryGUI::class, ilObjLTIConsumerGUI::class],"create");
371  // direct redirection to save is onle less click (there is a switch for save | contentSelection in GUI class):
372  $DIC->ctrl()->redirectByClass([ilRepositoryGUI::class, ilObjLTIConsumerGUI::class], "save");
373  return;
374  }
375  $DIC->ui()->mainTemplate()->setContent($form->getHTML());
376  }
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 873 of file class.ilObjLTIConsumerGUI.php.

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

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

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

335  : void
336  {
337  global $DIC;
339  throw new ilLtiConsumerException('permission denied!');
340  }
341  $new_type = $this->getRequestValue("new_type");
342  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
343  $provider_id = $this->getRequestValue("provider_id");
344  $DIC->ctrl()->setParameter($this, "provider_id", $provider_id);
345  $DIC->language()->loadLanguageModule($new_type);
346  $form = $this->initShowToolConfig($new_type, (int) $provider_id);
347  $DIC->ui()->mainTemplate()->setContent($form->getHTML());
348  }
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 1032 of file class.ilObjLTIConsumerGUI.php.

References $DIC, $object, ilChangeEvent\_recordReadEvent(), ilLPStatusWrapper\_updateStatus(), ILIAS\Repository\ctrl(), ILIAS\UI\examples\Symbol\Glyph\Launch\launch(), and ILIAS\Repository\object().

Referenced by _goto().

1032  : void
1033  {
1034  global $DIC;
1035  /* @var \ILIAS\DI\Container $DIC */
1036 
1038  $this->object->getType(),
1039  $this->object->getRefId(),
1040  $this->object->getId(),
1041  $DIC->user()->getId()
1042  );
1043 
1044  ilLPStatusWrapper::_updateStatus($this->object->getId(), $DIC->user()->getId());
1045  }
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: