ILIAS  trunk Revision v11.0_alpha-1851-ga8564da6fed
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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)
 
 view ()
 view object content (repository/workspace switch) More...
 
 getType ()
 Functions that must be overwritten. More...
 
 create ()
 CRUD. More...
 
 save ()
 
 edit ()
 
 update ()
 
 cancel ()
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
- Public Member Functions inherited from ilObjectGUI
 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)
 
 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 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
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 

Protected Member Functions

 initCreateForm (string $a_new_type)
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $forms)
 
 initNewForm (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...
 
 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...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 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...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 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...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Protected Attributes

ilLTIConsumerAccess $ltiAccess
 
LOMServices $lom_services
 
- 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
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
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 41 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 64 of file class.ilObjLTIConsumerGUI.php.

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

65  {
66  global $DIC;
67  /* @var \ILIAS\DI\Container $DIC */
68 
69  parent::__construct($a_id, $a_id_type, $a_parent_node_id);
70  $this->parent_node_id = $a_parent_node_id;
71  if ($this->object instanceof ilObjLTIConsumer) {
72  $this->ltiAccess = new ilLTIConsumerAccess($this->object);
73  }
74  $this->lom_services = $DIC->learningObjectMetadata();
75 
76  $DIC->language()->loadLanguageModule("lti");
77  $DIC->language()->loadLanguageModule("rep");
78  }
global $DIC
Definition: shib_login.php:22
__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 662 of file class.ilObjLTIConsumerGUI.php.

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

662  : void
663  {
664  global $DIC;
665  $main_tpl = $DIC->ui()->mainTemplate();
666  /* @var \ILIAS\DI\Container $DIC */
667  $err = $DIC['ilErr'];
668  /* @var ilErrorHandling $err */
669  $ctrl = $DIC->ctrl();
670  $request = $DIC->http()->request();
671  $access = $DIC->access();
672  $lng = $DIC->language();
673 
674  $targetParameters = explode('_', $a_target);
675  $id = (int) $targetParameters[0];
676 
677  if ($id <= 0) {
678  $err->raiseError($lng->txt('msg_no_perm_read'), $err->FATAL);
679  }
680 
681  if ($access->checkAccess('read', '', $id)) {
682  $ctrl->setTargetScript('ilias.php');
683  $ctrl->setParameterByClass(ilObjLTIConsumerGUI::class, 'ref_id', $id);
684  $ctrl->redirectByClass([ilRepositoryGUI::class, ilObjLTIConsumerGUI::class]);
685  } elseif ($access->checkAccess('visible', '', $id)) {
686  ilObjectGUI::_gotoRepositoryNode($id, 'infoScreen');
687  } elseif ($access->checkAccess('read', '', ROOT_FOLDER_ID)) {
688  $main_tpl->setOnScreenMessage(
689  'info',
690  sprintf(
691  $DIC->language()->txt('msg_no_perm_read_item'),
693  ),
694  true
695  );
696 
698  }
699 
700  $err->raiseError($DIC->language()->txt("msg_no_perm_read_lm"), $err->FATAL);
701  }
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)
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
ServerRequestInterface $request
global $DIC
Definition: shib_login.php:22
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 309 of file class.ilObjLTIConsumerGUI.php.

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

309  : void
310  {
311  global $DIC;
313  throw new ilLtiConsumerException('permission denied!');
314  }
315  $new_type = $this->getRequestValue("new_type");
316 
317  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
318 
319  $DIC->language()->loadLanguageModule($new_type);
320  $form = $this->initDynRegForm($new_type);
321  $error = ($this->getRequestValue('error') != null) ? $this->getRequestValue('error') : "";
322  $form->setValuesByPost();
323  if (!empty($error)) {
324  $DIC->ctrl()->setParameter($this, "new_type", "");
325  $DIC->ui()->mainTemplate()->setOnScreenMessage('failure', base64_decode($error));
326  $DIC->ui()->mainTemplate()->setContent($form->getDynRegError());
327  return;
328  }
329  if ($form->checkInput()) {
330  $DIC->ctrl()->setParameter($this, "new_type", "");
331  $DIC->ui()->mainTemplate()->setContent($form->getDynRegRequest());
332  return;
333  }
334  $DIC->ui()->mainTemplate()->setContent($form->getHTML());
335  }
ilErrorHandling $error
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
initDynRegForm(string $a_new_type)
+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjLTIConsumerGUI::addLocatorItems ( )
protected

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

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

1005  : void
1006  {
1007  global $DIC;
1008  /* @var \ILIAS\DI\Container $DIC */
1009 
1010  $locator = $DIC['ilLocator'];
1011  /* @var ilLocatorGUI $locator */
1012  $locator->addItem(
1013  $this->object->getTitle(),
1014  $this->ctrl->getLinkTarget($this, self::DEFAULT_CMD),
1015  "",
1016  $this->object->getRefId()
1017  );
1018  }
global $DIC
Definition: shib_login.php:22
ilLocatorGUI $locator
+ Here is the call graph for this function:

◆ afterSave()

ilObjLTIConsumerGUI::afterSave ( \ilObject  $newObject)
protected

Definition at line 552 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().

552  : void
553  {
554  global $DIC; //check
555 
556  if ($DIC->http()->wrapper()->query()->has('provider_id')) {
557  $newObject->setProviderId((int) $DIC->http()->wrapper()->query()->retrieve('provider_id', $DIC->refinery()->kindlyTo()->int()));
558  $newObject->initProvider();
559  $newObject->save();
560 
561  $newObject->setTitle($newObject->getProvider()->getTitle());
562  $newObject->setMasteryScore($newObject->getProvider()->getMasteryScore());
563  $newObject->update();
564 
565  $this->initMetadata($newObject);
566 
567  $DIC->ctrl()->redirectByClass(ilLTIConsumerSettingsGUI::class);
568  }
569 
571  throw new ilLtiConsumerException('permission denied!');
572  }
573 
574  $form = $this->initCustomCreateForm($newObject->getType());
575 
576  if ($form->checkInput()) {
578  $form->initProvider($provider);
580  $provider->setIsGlobal(false);
581  $provider->setCreator($DIC->user()->getId());
582  $provider->save();
583 
584  $newObject->setProviderId($provider->getId());
585  $newObject->setProvider($provider);
586  $newObject->save();
587 
588  $newObject->setTitle($provider->getTitle());
589  $newObject->setMasteryScore($newObject->getProvider()->getMasteryScore());
590  $newObject->update();
591 
592  $this->initMetadata($newObject);
593 
594  $DIC->ctrl()->redirectByClass(ilObjLTIConsumerGUI::class);
595  }
596 
597  throw new ilLtiConsumerException(
598  'form validation seems to not have worked in ilObjLTIConsumer::saveCustom()!'
599  );
600  }
$provider
Definition: ltitoken.php:80
initCustomCreateForm(string $a_new_type)
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyProviderFilter()

ilObjLTIConsumerGUI::applyProviderFilter ( )
protected

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

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

239  : void
240  {
241  $form = $this->buildProviderSelectionForm('');
242  $form->applyFilter();
243  $this->createObject();
244  }
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 228 of file class.ilObjLTIConsumerGUI.php.

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

229  {
231  $a_new_type,
232  $this,
233  'create',
234  'applyProviderFilter',
235  'resetProviderFilter'
236  );
237  }
+ Here is the caller graph for this function:

◆ cancelContentSelection()

ilObjLTIConsumerGUI::cancelContentSelection ( )

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

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

493  : void
494  {
495  global $DIC;
497  throw new ilLtiConsumerException('permission denied!');
498  }
499  $new_type = $this->getRequestValue("new_type");
500  $DIC->ctrl()->setParameterByClass(ilRepositoryGUI::class, 'new_type', $new_type);
501  $DIC->ctrl()->redirectByClass(ilRepositoryGUI::class, 'create');
502  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ cancelDynReg()

ilObjLTIConsumerGUI::cancelDynReg ( )

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

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

337  : void
338  {
339  global $DIC;
341  throw new ilLtiConsumerException('permission denied!');
342  }
343  $new_type = $this->getRequestValue("new_type");
344  //$provider_id = $this->getRequestValue("provider_id");
345  if (ilSession::has('lti_dynamic_registration_client_id')) {
346  $providerId = ilLTIConsumeProvider::getProviderIdFromClientId(ilSession::get('lti_dynamic_registration_client_id'));
347  if ($providerId > 0) {
348  try {
350  //ToDo: check if provider is in use? should never happen...
351  $provider->delete();
352  } catch (\ILIAS\Filesystem\Exception\IOException $e) {
353  //ToDo: error handling
354  }
355  }
356  }
357  $DIC->ctrl()->setParameterByClass(ilRepositoryGUI::class, 'new_type', $new_type);
358  $DIC->ctrl()->redirectByClass(ilRepositoryGUI::class, 'create');
359  }
static get(string $a_var)
Interface Observer Contains several chained tasks and infos about them.
if(empty($clientId)) $providerId
Definition: ltitoken.php:79
static getProviderIdFromClientId(string $clientId)
$provider
Definition: ltitoken.php:80
global $DIC
Definition: shib_login.php:22
static has($a_var)
+ Here is the call graph for this function:

◆ checkContentSelection()

ilObjLTIConsumerGUI::checkContentSelection ( )
protected

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

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

Referenced by _goto().

841  : void
842  {
843  global $DIC;
844  $providerId = $this->getRequestValue('provider_id');
845  $newType = $this->getRequestValue('new_type');
846  $refId = $this->getRequestValue('ref_id');
847  if ($providerId !== null && $newType == 'lti' && $refId != null) {
849  // check if post variables from contentSelectionResponse
850  if ($DIC->http()->wrapper()->post()->has('JWT')) {
851  // ToDo:
852  } else {
853  if ($provider->isContentItem() && !empty($provider->getContentItemUrl())) {
854  $this->contentSelection($providerId, $newType, $refId, $provider);
855  } else {
856  $this->save();
857  }
858  }
859  } else {
860  $this->save();
861  }
862  }
contentSelection(string $providerId, string $newType, string $refId, ilLTIConsumeProvider $provider)
$refId
Definition: xapitoken.php:58
if(empty($clientId)) $providerId
Definition: ltitoken.php:79
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$provider
Definition: ltitoken.php:80
global $DIC
Definition: shib_login.php:22
+ 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 404 of file class.ilObjLTIConsumerGUI.php.

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

Referenced by checkContentSelection().

404  : void
405  {
406  global $DIC;
408  throw new ilLtiConsumerException('permission denied!');
409  }
410  $DIC->ctrl()->setParameter($this, "new_type", $newType);
411  $DIC->ctrl()->setParameter($this, "provider_id", $providerId);
412  $DIC->ctrl()->setParameter($this, "ref_id", $refId);
413 
414  $form = new ilLTIConsumeProviderFormGUI($provider);
415  $formaction = $this->ctrl->getFormAction($this, "cancelContentSelection");
416  $DIC->ui()->mainTemplate()->setContent($form->getContentSelectionFrame($formaction));
417  }
$refId
Definition: xapitoken.php:58
if(empty($clientId)) $providerId
Definition: ltitoken.php:79
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ contentSelectionRequest()

ilObjLTIConsumerGUI::contentSelectionRequest ( )

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

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

419  : void
420  {
421  global $DIC;
423  throw new ilLtiConsumerException('permission denied!');
424  }
425  $new_type = $this->getRequestValue("new_type");
426  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
427  $provider_id = $this->getRequestValue("provider_id");
428  $DIC->ctrl()->setParameter($this, "provider_id", $provider_id);
429  $ref_id = $this->getRequestValue("ref_id");
430  $DIC->ctrl()->setParameter($this, "ref_id", $ref_id);
431  $DIC->language()->loadLanguageModule($new_type);
432  $provider = new ilLTIConsumeProvider((int) $provider_id);
433  $redirectUrl = $DIC->ctrl()->getLinkTarget($this, 'contentSelectionRequest');
434 
435  if (!ilSession::has('lti13_login_data')) {
436  $userIdLTI = ilCmiXapiUser::getIdentAsId($provider->getPrivacyIdent(), $DIC->user());
437  //$emailPrimary = ilCmiXapiUser::getIdent($provider->getPrivacyIdent(), $DIC->user());
438  $ltiMessageHint = (string) $ref_id . ":" . CLIENT_ID . ":" . base64_encode($redirectUrl);
439  $tplLogin = new ilTemplate("tpl.lti_initial_login.html", true, true, "components/ILIAS/LTIConsumer");
440  $tplLogin->setVariable("LTI_INITIAL_LOGIN_ACTION", $provider->getInitiateLogin());
441  $tplLogin->setVariable("ISS", ilObjLTIConsumer::getIliasHttpPath());
442  $tplLogin->setVariable("TARGET_LINK_URL", $provider->getProviderUrl());
443  $tplLogin->setVariable("LOGIN_HINT", $userIdLTI);
444  $tplLogin->setVariable("LTI_MESSAGE_HINT", $ltiMessageHint);
445  $tplLogin->setVariable("CLIENT_ID", $provider->getClientId());
446  $tplLogin->setVariable("LTI_DEPLOYMENT_ID", (string) $provider->getId());
447  echo $tplLogin->get();
448  exit; //TODO: no exit
449  } else {
450  $loginData = ilSession::get('lti13_login_data');
451  // ToDo: correct Link!! replace ILIAS_HTTP_PATH
452  $data = ilObjLTIConsumer::buildContentSelectionParameters($provider, (int) $ref_id, ilObjLTIConsumer::getIliasHttpPath() . "/" . $DIC->ctrl()->getLinkTarget($this, 'contentSelectionResponse'), $loginData['nonce']);
453  $tplContentSelection = new ilTemplate("tpl.lti_jwt_autosubmit.html", true, true, "components/ILIAS/LTIConsumer");
454  $tplContentSelection->setVariable("LTI_JWT_FORM_ACTION", $provider->getContentItemUrl());
455  $tplContentSelection->setVariable("LTI_JWT_ID_TOKEN", $data['id_token']);
456  $tplContentSelection->setVariable("LTI_JWT_STATE", $loginData['state']);
457  ilSession::clear('lti13_login_data');
458  echo $tplContentSelection->get();
459  exit; //TODO: no exit
460  }
461  }
static getIdentAsId(int $userIdentMode, ilObjUser $user)
static get(string $a_var)
static buildContentSelectionParameters(ilLTIConsumeProvider $provider, int $refId, string $returnUrl, string $nonce)
$provider
Definition: ltitoken.php:80
const CLIENT_ID
Definition: constants.php:41
global $DIC
Definition: shib_login.php:22
static has($a_var)
$ltiMessageHint
Definition: ltiauth.php:49
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static clear(string $a_var)
+ Here is the call graph for this function:

◆ contentSelectionResponse()

ilObjLTIConsumerGUI::contentSelectionResponse ( )

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

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

463  : void
464  {
465  global $DIC;
467  throw new ilLtiConsumerException('permission denied!');
468  }
469  $new_type = $this->getRequestValue("new_type");
470  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
471  $provider_id = $this->getRequestValue("provider_id");
472  $DIC->ctrl()->setParameter($this, "provider_id", $provider_id);
473  $ref_id = $this->getRequestValue("ref_id");
474  $DIC->ctrl()->setParameter($this, "ref_id", $ref_id);
475  $DIC->language()->loadLanguageModule($new_type);
476  $token = '';
477  if ($DIC->http()->wrapper()->post()->has('JWT')) {
478  $token = $DIC->http()->wrapper()->post()->retrieve('JWT', $DIC->refinery()->kindlyTo()->string());
479  }
480  if ($DIC->http()->wrapper()->post()->has('jwt')) {
481  $token = $DIC->http()->wrapper()->post()->retrieve('jwt', $DIC->refinery()->kindlyTo()->string());
482  }
483  if (!empty($token)) {
484  $provider = new ilLTIConsumeProvider((int) $provider_id);
486  } else {
487  echo "no token";
488  exit;
489  //ToDo:
490  }
491  }
saveContentSelection(ilLTIConsumeProvider $provider, string $token)
$provider
Definition: ltitoken.php:80
$token
Definition: xapitoken.php:70
global $DIC
Definition: shib_login.php:22
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ createNewObject()

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

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

References ilObject2GUI\putObjectInTree().

Referenced by saveCustom().

253  : ilObject
254  {
255  $classname = "ilObj" . $this->obj_definition->getClassName($newType);
256 
257  $newObj = new $classname();
258  $newObj->setType($newType);
259  $newObj->setTitle($title);
260  $newObj->setDescription($description);
261  $newObj->create();
262  $this->putObjectInTree($newObj);
263  return $newObj;
264  }
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:

◆ getCreationFormsHTML()

ilObjLTIConsumerGUI::getCreationFormsHTML ( StandardForm|ilPropertyFormGUI|array  $forms)
protected

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

References ilAccordionGUI\FIRST_OPEN, ilPropertyFormGUI\getHTML(), and ilPropertyFormGUI\getTitle().

102  : string
103  {
104  if (!is_array($forms)) {
105  throw new Exception('We only deal with arrays here.');
106  }
107 
108  $acc = new ilAccordionGUI();
109  $acc->setBehaviour(ilAccordionGUI::FIRST_OPEN);
110  array_walk(
111  $forms,
112  function (ilPropertyFormGUI $v, string $k) use ($acc): void {
113  $acc->addItem(
114  $v->getTitle(),
115  $v->getHTML()
116  );
117  }
118  );
119 
120  return $acc->getHTML();
121  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getRequestValue()

ilObjLTIConsumerGUI::getRequestValue ( string  $key)
protected

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

References null, and ILIAS\Repository\refinery().

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

1154  : ?string
1155  {
1156  if ($this->request_wrapper->has($key)) {
1157  return $this->request_wrapper->retrieve($key, $this->refinery->kindlyTo()->string());
1158  }
1159  return null;
1160  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

ilObjLTIConsumerGUI::getType ( )

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

Referenced by _goto().

80  : string
81  {
82  return 'lti';
83  }
+ Here is the caller graph for this function:

◆ handleAvailablityMessage()

ilObjLTIConsumerGUI::handleAvailablityMessage ( )
protected

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

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

Referenced by infoScreenForward().

1143  : void
1144  {
1145  global $DIC;
1146  /* @var \ILIAS\DI\Container $DIC */
1147  if ($this->object->getProvider()->getProviderUrl() == '') {
1148  $this->tpl->setOnScreenMessage('failure', $DIC->language()->txt('lti_provider_not_set_msg'));
1149  } elseif ($this->object->getProvider()->getAvailability() == ilLTIConsumeProvider::AVAILABILITY_NONE) {
1150  $this->tpl->setOnScreenMessage('failure', $DIC->language()->txt('lti_provider_not_avail_msg'));
1151  }
1152  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoScreen()

ilObjLTIConsumerGUI::infoScreen ( )
protected

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

References $DIC, and infoScreenForward().

Referenced by _goto().

1044  : void
1045  {
1046  global $DIC;
1047  /* @var \ILIAS\DI\Container $DIC */
1048 
1049  $DIC->tabs()->activateTab(self::TAB_ID_INFO);
1050 
1051  // @todo: removed deprecated ilCtrl methods, this needs inspection by a maintainer.
1052  // $DIC->ctrl()->setCmd("showSummary");
1053  // $DIC->ctrl()->setCmdClass("ilinfoscreengui");
1054  $this->infoScreenForward();
1055  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoScreenForward()

ilObjLTIConsumerGUI::infoScreenForward ( )
protected

Definition at line 1057 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().

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

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

References ilLTIConsumerAccess\hasCustomProviderCreationAccess(), initCustomCreateForm(), initDynRegForm(), and initNewForm().

88  : array
89  {
90  $forms = array(
91  self::CFORM_NEW => $this->initNewForm($a_new_type)
92  );
93 
95  $forms[self::CFORM_DYNAMIC_REGISTRATION] = $this->initDynRegForm($a_new_type);
96  $forms[self::CFORM_CUSTOM_NEW] = $this->initCustomCreateForm($a_new_type);
97  }
98 
99  return $forms;
100  }
initNewForm(string $a_new_type)
initCustomCreateForm(string $a_new_type)
initDynRegForm(string $a_new_type)
+ Here is the call graph for this function:

◆ initCustomCreateForm()

ilObjLTIConsumerGUI::initCustomCreateForm ( string  $a_new_type)

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

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

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

209  {
210  global $DIC;
211  /* @var \ILIAS\DI\Container $DIC */
212 
214 
216 
217  $form->initForm($this->ctrl->getFormAction($this, "save"), '', '');
218 
219  $form->clearCommandButtons();
220  $form->addCommandButton("saveCustom", $this->lng->txt($a_new_type . "_add_own_provider"));
221  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
222 
223  $form->setTitle($DIC->language()->txt($a_new_type . '_custom_new'));
224 
225  return $form;
226  }
$provider
Definition: ltitoken.php:80
global $DIC
Definition: shib_login.php:22
+ 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 177 of file class.ilObjLTIConsumerGUI.php.

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

Referenced by addDynReg(), and initCreateForm().

178  {
179  global $DIC;
180  /* @var \ILIAS\DI\Container $DIC */
183  $form->initDynRegForm($this->ctrl->getFormAction($this, "cancelDynReg"));
184  $form->setTitle($DIC->language()->txt($a_new_type . '_dynamic_registration'));
185  return $form;
186  }
$provider
Definition: ltitoken.php:80
global $DIC
Definition: shib_login.php:22
+ 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 627 of file class.ilObjLTIConsumerGUI.php.

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

628  {
629  global $DIC;
630  /* @var \ILIAS\DI\Container $DIC */
631 
632  $return = parent::initHeaderAction($a_sub_type, $a_sub_id);
633 
634  if ($this->creation_mode) {
635  return $return;
636  }
637 
638  $validator = new ilCertificateDownloadValidator();
639  if ($validator->isCertificateDownloadable($DIC->user()->getId(), $this->object->getId())) {
640  $certLink = $DIC->ctrl()->getLinkTargetByClass(
641  [ilObjLTIConsumerGUI::class, ilLTIConsumerSettingsGUI::class],
643  );
644 
645  $DIC->language()->loadLanguageModule('certificate');
646 
647  $return->addCustomCommand($certLink, 'download_certificate');
648 
649  $return->addHeaderIcon(
650  'cert_icon',
651  ilUtil::getImagePath('standard/icon_cert.svg'),
652  $DIC->language()->txt('download_certificate'),
653  null,
654  null,
655  $certLink
656  );
657  }
658 
659  return $return;
660  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Validates if an active certificate is stored in the database and can be downloaded by the user...
global $DIC
Definition: shib_login.php:22
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ initMetadata()

ilObjLTIConsumerGUI::initMetadata ( \ilObject  $object)

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

References ilObject\getId(), ilObject\getTitle(), and ilObject\getType().

Referenced by afterSave(), and saveContentSelection().

602  : void
603  {
604  // create LOM set from scratch
605  $this->lom_services->derive()
606  ->fromBasicProperties($object->getTitle())
607  ->forObject($object->getId(), $object->getId(), $object->getType());
608 
609  // in a second step, set the keywords
610  $keywords = [];
611  foreach ($object->getProvider()->getKeywordsArray() as $keyword) {
612  if ($keyword !== '') {
613  $keywords[] = $keyword;
614  }
615  }
616  $this->lom_services->manipulate($object->getId(), $object->getId(), $object->getType())
617  ->prepareCreateOrUpdate(
618  $this->lom_services->paths()->keywords(),
619  ...$keywords
620  )->execute();
621  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initNewForm()

ilObjLTIConsumerGUI::initNewForm ( string  $a_new_type)
protected

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

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

Referenced by initCreateForm().

124  {
125  global $DIC;
126  /* @var \ILIAS\DI\Container $DIC */
127 
128  $form = $this->buildProviderSelectionForm($a_new_type);
129 
130  $globalProviderList = new ilLTIConsumeProviderList();
131  $globalProviderList->setAvailabilityFilter((string) ilLTIConsumeProvider::AVAILABILITY_CREATE);
132  $globalProviderList->setScopeFilter(ilLTIConsumeProviderList::SCOPE_GLOBAL);
133 
134  $userProviderList = new ilLTIConsumeProviderList();
135  $userProviderList->setAvailabilityFilter((string) ilLTIConsumeProvider::AVAILABILITY_CREATE);
136  $userProviderList->setScopeFilter(ilLTIConsumeProviderList::SCOPE_USER);
137  $userProviderList->setCreatorFilter($DIC->user()->getId());
138 
139  if ($form->getFilter('title')) {
140  $globalProviderList->setTitleFilter($form->getFilter('title'));
141  $userProviderList->setTitleFilter($form->getFilter('title'));
142  }
143 
144  if ($form->getFilter('category')) {
145  $globalProviderList->setCategoryFilter($form->getFilter('category'));
146  $userProviderList->setCategoryFilter($form->getFilter('category'));
147  }
148 
149  if ($form->getFilter('keyword')) {
150  $globalProviderList->setKeywordFilter($form->getFilter('keyword'));
151  $userProviderList->setKeywordFilter($form->getFilter('keyword'));
152  }
153 
154  if ($form->getFilter('outcome')) {
155  $globalProviderList->setHasOutcomeFilter(true);
156  $userProviderList->setHasOutcomeFilter(true);
157  }
158 
159  if ($form->getFilter('internal')) {
160  $globalProviderList->setIsExternalFilter(false);
161  $userProviderList->setIsExternalFilter(false);
162  }
163 
164  if ($form->getFilter('with_key')) {
165  $globalProviderList->setIsProviderKeyCustomizableFilter(false);
166  $userProviderList->setIsProviderKeyCustomizableFilter(false);
167  }
168 
169  $globalProviderList->load();
170  $userProviderList->load();
171 
172  $form->setData([...$globalProviderList->getTableData(), ...$userProviderList->getTableData()]);
173 
174  return $form;
175  }
buildProviderSelectionForm(string $a_new_type)
global $DIC
Definition: shib_login.php:22
+ 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 188 of file class.ilObjLTIConsumerGUI.php.

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

Referenced by saveDynReg(), and showToolConfig().

189  {
190  global $DIC;
191 
192  //ToDo: Error Handling
193  $provider = new ilLTIConsumeProvider($a_provider_id);
194 
196 
197  $form->initToolConfigForm($this->ctrl->getFormAction($this, "cancelDynReg"), '', '');
198 
199  $form->clearCommandButtons();
200  $form->addCommandButton("saveDynReg", $this->lng->txt('save'));
201  $form->addCommandButton("cancelDynReg", $this->lng->txt("cancel"));
202 
203  $form->setTitle($DIC->language()->txt($a_new_type . '_custom_new'));
204 
205  return $form;
206  }
$provider
Definition: ltitoken.php:80
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetProviderFilter()

ilObjLTIConsumerGUI::resetProviderFilter ( )
protected

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

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

246  : void
247  {
248  $form = $this->buildProviderSelectionForm('');
249  $form->resetFilter();
250  $this->createObject();
251  }
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 504 of file class.ilObjLTIConsumerGUI.php.

References ilObjectGUI\$data, $provider, $refId, ilObject2GUI\$type, exit, ilObjLTIConsumer\getIliasHttpPath(), ilLTIConsumeProvider\getKeyType(), ilLTIConsumeProvider\getPublicKey(), ilLTIConsumeProvider\getPublicKeyset(), getRequestValue(), ilObjectFactory\getTypeByRefId(), and initMetadata().

Referenced by contentSelectionResponse().

504  : void
505  {
506  if ($provider->getKeyType() == 'RSA_KEY') {
507  $key = $provider->getPublicKey();
508  $keys = new Firebase\JWT\Key($key, "RS256");
509  } else {
510  $jwks = file_get_contents($provider->getPublicKeyset());
511  //ToDo: Errorhandling
512  $keyset = json_decode($jwks, true);
513  $keys = Firebase\JWT\JWK::parseKeySet($keyset);
514  }
515  $data = Firebase\JWT\JWT::decode($token, $keys);
516  //ilObjLTIConsumer::getLogger()->debug(var_export($data,TRUE));
517  $refId = $this->getRequestValue('ref_id');
518 
519  foreach ($data->{'https://purl.imsglobal.org/spec/lti-dl/claim/content_items'} as $item) {
520  $gui = new ilObjLTIConsumerGUI(0, self::REPOSITORY_NODE_ID, (int) $refId);
521  $description = "";
522  if (isset($item->description)) {
523  $description = $item->description;
524  }
525  $newObj = $gui->createNewObject('lti', $item->title, $description);
526  $dtpl = $gui->getDidacticTemplateVar("dtpl");
527  if ($dtpl) {
528  $newObj->applyDidacticTemplate($dtpl);
529  }
530 
531  $newObj->setProviderId($provider->getId());
532  $newObj->setProvider($provider);
533  // custom params
534  $customParams = [];
535  foreach ($item->{'custom'} as $key => $value) {
536  $customParams[] = $key . "=" . $value;
537  }
538  if (count($customParams) > 0) {
539  $newObj->setCustomParams(implode(";", $customParams));
540  }
541  $newObj->save();
542  $this->initMetadata($newObj);
543  }
545  $template = new ilTemplate('tpl.lti_content_selection_finished.html', true, true, 'components/ILIAS/LTIConsumer');
546  $redirect = ilObjLTIConsumer::getIliasHttpPath() . "/" . "goto.php?target=" . $type . "_" . $refId;
547  $template->setVariable("CONTENT_SELECTION_REDIRECT", $redirect);
548  echo $template->get();
549  exit;
550  }
$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
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCustom()

ilObjLTIConsumerGUI::saveCustom ( )

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

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

266  : void
267  {
269  throw new ilLtiConsumerException('permission denied!');
270  }
271 
272  global $DIC;
273  /* @var \ILIAS\DI\Container $DIC */
274 
275  $new_type = $this->getRequestValue("new_type");
276 
277  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
278 
279  $DIC->language()->loadLanguageModule($new_type);
280 
281  $form = $this->initCustomCreateForm($new_type);
282 
283  if ($form->checkInput()) {
284  $DIC->ctrl()->setParameter($this, "new_type", "");
285 
286  // create object
287  $newObj = $this->createNewObject(
288  $new_type,
289  $form->getInput('title'),
290  $form->getInput('desc')
291  );
292 
293  // apply didactic template?
294  $dtpl = $this->getDidacticTemplateVar("dtpl");
295  if ($dtpl) {
296  $newObj->applyDidacticTemplate($dtpl);
297  }
298 
299  $this->afterSave($newObj);
300 
301  return;
302  }
303 
304  $form->setValuesByPost();
305 
306  $DIC->ui()->mainTemplate()->setContent($form->getHtml());
307  }
createNewObject(string $newType, string $title, string $description)
getDidacticTemplateVar(string $type)
Get didactic template setting from creation screen.
initCustomCreateForm(string $a_new_type)
afterSave(\ilObject $newObject)
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ saveDynReg()

ilObjLTIConsumerGUI::saveDynReg ( )

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

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

376  : void
377  {
378  global $DIC;
380  throw new ilLtiConsumerException('permission denied!');
381  }
382  $new_type = $this->getRequestValue("new_type");
383  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
384  $provider_id = $this->getRequestValue("provider_id");
385  $DIC->ctrl()->setParameter($this, "provider_id", $provider_id);
386  $DIC->language()->loadLanguageModule($new_type);
387  ilSession::clear('lti_dynamic_registration_client_id');
388  ilSession::clear('lti_dynamic_registration_custom_params');
389  $form = $this->initShowToolConfig($new_type, (int) $provider_id);
390  $form->setValuesByPost();
391  if ($form->checkInput()) { // update only overridable fields
392  $provider = $form->getProvider();
393  $form->initProvider($provider);
394  $provider->update();
395  // jump to provider selection is one option:
396  // $DIC->ctrl()->redirectByClass([ilRepositoryGUI::class, ilObjLTIConsumerGUI::class],"create");
397  // direct redirection to save is onle less click (there is a switch for save | contentSelection in GUI class):
398  $DIC->ctrl()->redirectByClass([ilRepositoryGUI::class, ilObjLTIConsumerGUI::class], "save");
399  return;
400  }
401  $DIC->ui()->mainTemplate()->setContent($form->getHTML());
402  }
initShowToolConfig(string $a_new_type, int $a_provider_id)
$provider
Definition: ltitoken.php:80
global $DIC
Definition: shib_login.php:22
static clear(string $a_var)
+ Here is the call graph for this function:

◆ setTabs()

ilObjLTIConsumerGUI::setTabs ( )
protected

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

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

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

◆ showToolConfig()

ilObjLTIConsumerGUI::showToolConfig ( )

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

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

361  : void
362  {
363  global $DIC;
365  throw new ilLtiConsumerException('permission denied!');
366  }
367  $new_type = $this->getRequestValue("new_type");
368  $DIC->ctrl()->setParameter($this, "new_type", $new_type);
369  $provider_id = $this->getRequestValue("provider_id");
370  $DIC->ctrl()->setParameter($this, "provider_id", $provider_id);
371  $DIC->language()->loadLanguageModule($new_type);
372  $form = $this->initShowToolConfig($new_type, (int) $provider_id);
373  $DIC->ui()->mainTemplate()->setContent($form->getHTML());
374  }
initShowToolConfig(string $a_new_type, int $a_provider_id)
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ trackObjectReadEvent()

ilObjLTIConsumerGUI::trackObjectReadEvent ( )
protected

Definition at line 1020 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().

1020  : void
1021  {
1022  global $DIC;
1023  /* @var \ILIAS\DI\Container $DIC */
1024 
1026  $this->object->getType(),
1027  $this->object->getRefId(),
1028  $this->object->getId(),
1029  $DIC->user()->getId()
1030  );
1031 
1032  ilLPStatusWrapper::_updateStatus($this->object->getId(), $DIC->user()->getId());
1033  }
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)
global $DIC
Definition: shib_login.php:22
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

◆ $lom_services

LOMServices ilObjLTIConsumerGUI::$lom_services
protected

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

◆ $ltiAccess

ilLTIConsumerAccess ilObjLTIConsumerGUI::$ltiAccess
protected

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

◆ $object

ilObject ilObjLTIConsumerGUI::$object = null

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

Referenced by _goto(), and trackObjectReadEvent().

◆ $parent_node_id

int ilObjLTIConsumerGUI::$parent_node_id = 0

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

◆ CFORM_CUSTOM_NEW

const ilObjLTIConsumerGUI::CFORM_CUSTOM_NEW = 99

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

◆ CFORM_DYNAMIC_REGISTRATION

const ilObjLTIConsumerGUI::CFORM_DYNAMIC_REGISTRATION = 98

Definition at line 44 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 47 of file class.ilObjLTIConsumerGUI.php.

◆ TAB_ID_GRADE_SYNCHRONIZATION

const ilObjLTIConsumerGUI::TAB_ID_GRADE_SYNCHRONIZATION = 'tab_grade_synchronization'

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

◆ TAB_ID_INFO

const ilObjLTIConsumerGUI::TAB_ID_INFO = 'tab_info'

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

◆ TAB_ID_LEARNING_PROGRESS

const ilObjLTIConsumerGUI::TAB_ID_LEARNING_PROGRESS = 'learning_progress'

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

◆ TAB_ID_METADATA

const ilObjLTIConsumerGUI::TAB_ID_METADATA = 'tab_metadata'

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

◆ TAB_ID_PERMISSIONS

const ilObjLTIConsumerGUI::TAB_ID_PERMISSIONS = 'perm_settings'

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

◆ TAB_ID_SCORING

const ilObjLTIConsumerGUI::TAB_ID_SCORING = 'tab_scoring'

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

◆ TAB_ID_SETTINGS

const ilObjLTIConsumerGUI::TAB_ID_SETTINGS = 'tab_settings'

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

◆ TAB_ID_STATEMENTS

const ilObjLTIConsumerGUI::TAB_ID_STATEMENTS = 'tab_statements'

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


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