ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 Functions that must be overwritten. More...
 
 saveObject ()
 
 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)
 
 isContentTabAvailable ()
 
- 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)
 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)
 
 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)
 
 createNewObject (string $newType, string $title, string $description)
 
 afterSave (\ilObject $newObject)
 
 initHeaderAction (?string $a_sub_type=null, ?int $a_sub_id=null)
 
 checkContentSelection ()
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 addLocatorItems ()
 Functions to be overwritten. More...
 
 trackObjectReadEvent ()
 
 infoScreen ()
 
 configureInfoScreen (ilInfoScreenGUI $info)
 
 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="")
 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...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) 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...
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 getReturnLocation (string $cmd, string $location="")
 Deprecated functions. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 showActions ()
 
 getTabs ()
 @abstract overwrite in derived GUI class of your object type More...
 
 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 ()
 @abstract 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
 
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
 
GlobalHttpState $http
 
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
 
CustomIconFactory $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 
)

Reimplemented from ilObject2GUI.

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

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 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

static ilObjLTIConsumerGUI::_goto ( string  $a_target)
static

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

640 : void
641 {
642 global $DIC;
643 $main_tpl = $DIC->ui()->mainTemplate();
644 /* @var \ILIAS\DI\Container $DIC */
645 $err = $DIC['ilErr'];
646 /* @var ilErrorHandling $err */
647 $ctrl = $DIC->ctrl();
648 $request = $DIC->http()->request();
649 $access = $DIC->access();
650 $lng = $DIC->language();
651
652 $targetParameters = explode('_', $a_target);
653 $id = (int) $targetParameters[0];
654
655 if ($id <= 0) {
656 $err->raiseError($lng->txt('msg_no_perm_read'), $err->FATAL);
657 }
658
659 if ($access->checkAccess('read', '', $id)) {
660 $ctrl->setTargetScript('ilias.php');
661 $ctrl->setParameterByClass(ilObjLTIConsumerGUI::class, 'ref_id', $id);
662 $ctrl->redirectByClass([ilRepositoryGUI::class, ilObjLTIConsumerGUI::class]);
663 } elseif ($access->checkAccess('visible', '', $id)) {
665 } elseif ($access->checkAccess('read', '', ROOT_FOLDER_ID)) {
666 $main_tpl->setOnScreenMessage(
667 'info',
668 sprintf(
669 $DIC->language()->txt('msg_no_perm_read_item'),
671 ),
672 true
673 );
674
676 }
677
678 $err->raiseError($DIC->language()->txt("msg_no_perm_read_lm"), $err->FATAL);
679 }
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
setTargetScript(string $a_target_script)
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
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...
ilAccessHandler $access
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
ServerRequestInterface $request
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
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)

References $DIC, $id, $lng, ilObjectGUI\_gotoRepositoryNode(), ilObjectGUI\_gotoRepositoryRoot(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ILIAS\Repository\int(), and ROOT_FOLDER_ID.

+ Here is the call graph for this function:

◆ addDynReg()

ilObjLTIConsumerGUI::addDynReg ( )

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

284 : void
285 {
286 global $DIC;
288 throw new ilLtiConsumerException('permission denied!');
289 }
290 $new_type = $this->getRequestValue("new_type");
291
292 $DIC->ctrl()->setParameter($this, "new_type", $new_type);
293
294 $DIC->language()->loadLanguageModule($new_type);
295 $form = $this->initDynRegForm($new_type);
296 $error = ($this->getRequestValue('error') != null) ? $this->getRequestValue('error') : "";
297 $form->setValuesByPost();
298 if (!empty($error)) {
299 $DIC->ctrl()->setParameter($this, "new_type", "");
300 $DIC->ui()->mainTemplate()->setOnScreenMessage('failure', base64_decode($error));
301 $DIC->ui()->mainTemplate()->setContent($form->getDynRegError());
302 return;
303 }
304 if ($form->checkInput()) {
305 $DIC->ctrl()->setParameter($this, "new_type", "");
306 $DIC->ui()->mainTemplate()->setContent($form->getDynRegRequest());
307 return;
308 }
309 $DIC->ui()->mainTemplate()->setContent($form->getHTML());
310 }
initDynRegForm(string $a_new_type)
ilErrorHandling $error

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

+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjLTIConsumerGUI::addLocatorItems ( )
protected

Functions to be overwritten.

Reimplemented from ilObject2GUI.

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

994 : void
995 {
996 global $DIC;
997 /* @var \ILIAS\DI\Container $DIC */
998
999 $locator = $DIC['ilLocator'];
1000 /* @var ilLocatorGUI $locator */
1001 $locator->addItem(
1002 $this->object->getTitle(),
1003 $this->ctrl->getLinkTarget($this, self::DEFAULT_CMD),
1004 "",
1005 $this->object->getRefId()
1006 );
1007 }
ilLocatorGUI $locator

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

+ Here is the call graph for this function:

◆ afterSave()

ilObjLTIConsumerGUI::afterSave ( \ilObject  $newObject)
protected
Exceptions

ILIAS\Filesystem\Exception\FileNotFoundException

Exceptions
ilCtrlException

ILIAS\FileUpload\Exception\IllegalStateException

Exceptions
ilLtiConsumerException

ILIAS\Filesystem\Exception\IOException

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

534 : void
535 {
536 global $DIC; //check
537 if ($DIC->http()->wrapper()->query()->has('provider_id')) {
538 $newObject->setProviderId((int) $DIC->http()->wrapper()->query()->retrieve('provider_id', $DIC->refinery()->kindlyTo()->int()));
539 $newObject->initProvider();
540 $newObject->save();
541
542 $newObject->setTitle($newObject->getProvider()->getTitle());
543 $newObject->setMasteryScore($newObject->getProvider()->getMasteryScore());
544 $newObject->update();
545
546 $this->initMetadata($newObject);
547 $DIC->ctrl()->redirectByClass(ilLTIConsumerSettingsGUI::class);
548 }
549
551 throw new ilLtiConsumerException('permission denied!');
552 }
553
554 $form = $this->initCustomCreateForm($newObject->getType());
555
556 if ($form->checkInput()) {
558 $form->initProvider($provider);
560 $provider->setIsGlobal(false);
561 $provider->setCreator($DIC->user()->getId());
562 $provider->save();
563
564 $newObject->setProviderId($provider->getId());
565 $newObject->setProvider($provider);
566 $newObject->save();
567
568 $newObject->setTitle($provider->getTitle());
569 $newObject->setMasteryScore($newObject->getProvider()->getMasteryScore());
570 $newObject->update();
571
572 $this->initMetadata($newObject);
573 $DIC->ctrl()->redirectByClass([ilLTIConsumerSettingsGUI::class, ilLTIConsumeProviderSettingsGUI::class]);
574 }
575 throw new ilLtiConsumerException(
576 'form validation seems to not have worked in ilObjLTIConsumer::saveCustom()!'
577 );
578 }
initCustomCreateForm(string $a_new_type)
$provider
Definition: ltitoken.php:80

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

Referenced by saveCustom(), and saveObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildProviderSelectionForm()

ilObjLTIConsumerGUI::buildProviderSelectionForm ( string  $a_new_type)
protected

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

Referenced by initNewForm().

+ Here is the caller graph for this function:

◆ cancelContentSelection()

ilObjLTIConsumerGUI::cancelContentSelection ( )

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

468 : void
469 {
470 global $DIC;
472 throw new ilLtiConsumerException('permission denied!');
473 }
474 $new_type = $this->getRequestValue("new_type");
475 $DIC->ctrl()->setParameterByClass(ilRepositoryGUI::class, 'new_type', $new_type);
476 $DIC->ctrl()->redirectByClass(ilRepositoryGUI::class, 'create');
477 }

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

+ Here is the call graph for this function:

◆ cancelDynReg()

ilObjLTIConsumerGUI::cancelDynReg ( )

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

312 : void
313 {
314 global $DIC;
316 throw new ilLtiConsumerException('permission denied!');
317 }
318 $new_type = $this->getRequestValue("new_type");
319 //$provider_id = $this->getRequestValue("provider_id");
320 if (ilSession::has('lti_dynamic_registration_client_id')) {
321 $providerId = ilLTIConsumeProvider::getProviderIdFromClientId(ilSession::get('lti_dynamic_registration_client_id'));
322 if ($providerId > 0) {
323 try {
325 //ToDo: check if provider is in use? should never happen...
326 $provider->delete();
327 } catch (\ILIAS\Filesystem\Exception\IOException $e) {
328 //ToDo: error handling
329 }
330 }
331 }
332 $DIC->ctrl()->setParameterByClass(ilRepositoryGUI::class, 'new_type', $new_type);
333 $DIC->ctrl()->redirectByClass(ilRepositoryGUI::class, 'create');
334 }
static getProviderIdFromClientId(string $clientId)
static get(string $a_var)
static has($a_var)
if(empty($clientId)) $providerId
Definition: ltitoken.php:79
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

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

+ Here is the call graph for this function:

◆ checkContentSelection()

ilObjLTIConsumerGUI::checkContentSelection ( )
protected

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

823 : void
824 {
825 global $DIC;
826 $providerId = $this->getRequestValue('provider_id');
827 $newType = $this->getRequestValue('new_type');
828 $refId = $this->getRequestValue('ref_id');
829 if ($providerId !== null && $newType == 'lti' && $refId != null) {
831 // check if post variables from contentSelectionResponse
832 if ($DIC->http()->wrapper()->post()->has('JWT')) {
833 // ToDo:
834 } else {
835 if ($provider->isContentItem() && !empty($provider->getContentItemUrl())) {
836 $this->contentSelection($providerId, $newType, $refId, $provider);
837 } else {
838 $this->saveObject();
839 }
840 }
841 } else {
842 $this->saveObject();
843 }
844 }
contentSelection(string $providerId, string $newType, string $refId, ilLTIConsumeProvider $provider)
$refId
Definition: xapitoken.php:58

References $DIC, $provider, $providerId, and $refId.

◆ configureInfoScreen()

ilObjLTIConsumerGUI::configureInfoScreen ( ilInfoScreenGUI  $info)
protected

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

1038 : void
1039 {
1040 global $DIC;
1041 /* @var \ILIAS\DI\Container $DIC */
1042 $ilErr = $DIC['ilErr'];
1043 /* @var ilErrorHandling $ilErr */
1044
1045 if (!$this->checkPermissionBool("visible") && !$this->checkPermissionBool("read")) {
1046 $ilErr->raiseError($DIC->language()->txt("msg_no_perm_read"), $ilErr->MESSAGE);
1047 }
1048
1049 $this->handleAvailablityMessage();
1050
1051
1052 $info->enablePrivateNotes();
1053
1054 if ($this->checkPermissionBool("read")) {
1055 $info->enableNews();
1056 }
1057
1058 $info->enableNewsEditing(false);
1059
1060 if ($this->checkPermissionBool("write")) {
1061 $news_set = new ilSetting("news");
1062 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1063
1064 if ($enable_internal_rss) {
1065 //todo check
1066 $info->setBlockProperty("news", "settings", "true");
1067 $info->setBlockProperty("news", "public_notifications_option", "true");
1068 }
1069 }
1070
1071 // standard meta data
1072 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1073
1074 if (DEVMODE) {
1075 // Development Info
1076 $info->addSection('DEVMODE Info');
1077 $info->addProperty('Local Object ID', (string) $this->object->getId());
1078 $info->addProperty('Current User ID', (string) $DIC->user()->getId());
1079 }
1080 if ($this->object->getProvider()->getHasOutcome() && ilLPObjSettings::_lookupDBMode($this->object->getId()) != 0) {
1081 $info->addSection($DIC->language()->txt("lti_info_learning_progress_section"));
1082 $info->addProperty(
1083 $DIC->language()->txt("mastery_score"),
1084 ($this->object->getMasteryScorePercent()) . ' %'
1085 );
1086 }
1087
1088 // LTI Ressource Info about privacy
1089 $info->addSection($DIC->language()->txt("lti_info_privacy_section"));
1090
1091 $info->addProperty(
1092 $DIC->language()->txt("lti_con_prov_url"),
1093 $this->object->getProvider()->getProviderUrl()
1094 );
1095
1096 $info->addProperty(
1097 $DIC->language()->txt("conf_privacy_name"),
1098 $DIC->language()->txt('conf_privacy_name_' . ilObjCmiXapiGUI::getPrivacyNameString($this->object->getProvider()->getPrivacyName()))
1099 );
1100
1101 $info->addProperty(
1102 $DIC->language()->txt("conf_privacy_ident"),
1103 $DIC->language()->txt('conf_privacy_ident_' . ilObjCmiXapiGUI::getPrivacyIdentString($this->object->getProvider()->getPrivacyIdent()))
1104 );
1105 if ($this->object->getProvider()->isExternalProvider()) {
1106 $info->addProperty(
1107 $DIC->language()->txt("lti_info_external_provider_label"),
1108 $DIC->language()->txt('lti_info_external_provider_info')
1109 );
1110 }
1111
1112 if ($this->object->getProvider()->getUseXapi()) {
1113 $info->addProperty(
1114 $DIC->language()->txt("lti_con_prov_xapi_launch_url"),
1115 $this->object->getProvider()->getXapiLaunchUrl()
1116 );
1117 }
1118
1119 }
enableNews(bool $a_enable=true)
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section
enablePrivateNotes(bool $a_enable=true)
static _lookupDBMode(int $a_obj_id)
static getPrivacyNameString(int $ident)
static getPrivacyIdentString(int $ident)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
ILIAS Setting Class.
$info
Definition: entry_point.php:21
$ilErr
Definition: raiseError.php:33

References $DIC, $ilErr, $info, ilLPObjSettings\_lookupDBMode(), ilInfoScreenGUI\addProperty(), ilObjCmiXapiGUI\getPrivacyIdentString(), ilObjCmiXapiGUI\getPrivacyNameString(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ contentSelection()

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

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

379 : void
380 {
381 global $DIC;
383 throw new ilLtiConsumerException('permission denied!');
384 }
385 $DIC->ctrl()->setParameter($this, "new_type", $newType);
386 $DIC->ctrl()->setParameter($this, "provider_id", $providerId);
387 $DIC->ctrl()->setParameter($this, "ref_id", $refId);
388
390 $formaction = $this->ctrl->getFormAction($this, "cancelContentSelection");
391 $DIC->ui()->mainTemplate()->setContent($form->getContentSelectionFrame($formaction));
392 }

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

+ Here is the call graph for this function:

◆ contentSelectionRequest()

ilObjLTIConsumerGUI::contentSelectionRequest ( )

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

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

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().

+ Here is the call graph for this function:

◆ contentSelectionResponse()

ilObjLTIConsumerGUI::contentSelectionResponse ( )

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

438 : void
439 {
440 global $DIC;
442 throw new ilLtiConsumerException('permission denied!');
443 }
444 $new_type = $this->getRequestValue("new_type");
445 $DIC->ctrl()->setParameter($this, "new_type", $new_type);
446 $provider_id = $this->getRequestValue("provider_id");
447 $DIC->ctrl()->setParameter($this, "provider_id", $provider_id);
448 $ref_id = $this->getRequestValue("ref_id");
449 $DIC->ctrl()->setParameter($this, "ref_id", $ref_id);
450 $DIC->language()->loadLanguageModule($new_type);
451 $token = '';
452 if ($DIC->http()->wrapper()->post()->has('JWT')) {
453 $token = $DIC->http()->wrapper()->post()->retrieve('JWT', $DIC->refinery()->kindlyTo()->string());
454 }
455 if ($DIC->http()->wrapper()->post()->has('jwt')) {
456 $token = $DIC->http()->wrapper()->post()->retrieve('jwt', $DIC->refinery()->kindlyTo()->string());
457 }
458 if (!empty($token)) {
459 $provider = new ilLTIConsumeProvider((int) $provider_id);
461 } else {
462 echo "no token";
463 exit;
464 //ToDo:
465 }
466 }
saveContentSelection(ilLTIConsumeProvider $provider, string $token)
$token
Definition: xapitoken.php:70

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

+ Here is the call graph for this function:

◆ createNewObject()

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

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

228 : ilObject
229 {
230 $classname = "ilObj" . $this->obj_definition->getClassName($newType);
231
232 $newObj = new $classname();
233 $newObj->setType($newType);
234 $newObj->setTitle($title);
235 $newObj->setDescription($description);
236 $newObj->create();
237 $this->putObjectInTree($newObj);
238 return $newObj;
239 }
putObjectInTree(ilObject $obj, ?int $parent_node_id=null)
Add object to tree at given position.
Class ilObject Basic functions for all objects.

References ilObject2GUI\putObjectInTree().

Referenced by saveCustom().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCreationFormsHTML()

ilObjLTIConsumerGUI::getCreationFormsHTML ( StandardForm|ilPropertyFormGUI|array  $form)
protected
Parameters
StandardForm|ilPropertyFormGUI|array<ilPropertyFormGUI>$form

Reimplemented from ilObjectGUI.

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

142 : string
143 {
144 if (!is_array($forms)) {
145 throw new Exception('We only deal with arrays here.');
146 }
147
148 $acc = new ilAccordionGUI();
149 $acc->setBehaviour(ilAccordionGUI::FIRST_OPEN);
150 array_walk(
151 $forms,
152 function (ilPropertyFormGUI $v, string $k) use ($acc): void {
153 $acc->addItem(
154 $v->getTitle(),
155 $v->getHTML()
156 );
157 }
158 );
159
160 return $acc->getHTML();
161 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property form user interface.

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

+ Here is the call graph for this function:

◆ getRequestValue()

ilObjLTIConsumerGUI::getRequestValue ( string  $key)
protected

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

1132 : ?string
1133 {
1134 if ($this->request_wrapper->has($key)) {
1135 return $this->request_wrapper->retrieve($key, $this->refinery->kindlyTo()->string());
1136 }
1137 return null;
1138 }

References ILIAS\Repository\refinery().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

ilObjLTIConsumerGUI::getType ( )

Functions that must be overwritten.

Reimplemented from ilObject2GUI.

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

80 : string
81 {
82 return 'lti';
83 }

◆ handleAvailablityMessage()

ilObjLTIConsumerGUI::handleAvailablityMessage ( )
protected

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

1121 : void
1122 {
1123 global $DIC;
1124 /* @var \ILIAS\DI\Container $DIC */
1125 if ($this->object->getProvider()->getProviderUrl() == '') {
1126 $this->tpl->setOnScreenMessage('failure', $DIC->language()->txt('lti_provider_not_set_msg'));
1127 } elseif ($this->object->getProvider()->getAvailability() == ilLTIConsumeProvider::AVAILABILITY_NONE) {
1128 $this->tpl->setOnScreenMessage('failure', $DIC->language()->txt('lti_provider_not_avail_msg'));
1129 }
1130 }

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

+ Here is the call graph for this function:

◆ infoScreen()

ilObjLTIConsumerGUI::infoScreen ( )
protected

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

1033 : void
1034 {
1035 $this->ctrl->redirectByClass(ilInfoScreenGUI::class, "showSummary");
1036 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ initCreateForm()

ilObjLTIConsumerGUI::initCreateForm ( string  $a_new_type)
protected
Returns
array<ilPropertyFormGUI>

Reimplemented from ilObjectGUI.

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

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)

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

Referenced by saveObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCustomCreateForm()

ilObjLTIConsumerGUI::initCustomCreateForm ( string  $a_new_type)

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

200 {
201 global $DIC;
202 /* @var \ILIAS\DI\Container $DIC */
203
205
207
208 $form->initForm($this->ctrl->getFormAction($this, "save"), '', '');
209
210 $form->clearCommandButtons();
211 $form->addCommandButton("saveCustom", $this->lng->txt($a_new_type . "_add_own_provider"));
212 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
213
214 $form->setTitle($DIC->language()->txt($a_new_type . '_custom_new'));
215
216 return $form;
217 }

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

Referenced by initCreateForm(), and saveCustom().

+ 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 168 of file class.ilObjLTIConsumerGUI.php.

169 {
170 global $DIC;
171 /* @var \ILIAS\DI\Container $DIC */
174 $form->initDynRegForm($this->ctrl->getFormAction($this, "cancelDynReg"));
175 $form->setTitle($DIC->language()->txt($a_new_type . '_dynamic_registration'));
176 return $form;
177 }

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

Referenced by addDynReg(), and initCreateForm().

+ 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

Reimplemented from ilObject2GUI.

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

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

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

+ Here is the call graph for this function:

◆ initMetadata()

ilObjLTIConsumerGUI::initMetadata ( \ilObject  $object)

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

580 : void
581 {
582 // create LOM set from scratch
583 $this->lom_services->derive()
584 ->fromBasicProperties($object->getTitle())
585 ->forObject($object->getId(), $object->getId(), $object->getType());
586
587 // in a second step, set the keywords
588 $keywords = [];
589 foreach ($object->getProvider()->getKeywordsArray() as $keyword) {
590 if ($keyword !== '') {
591 $keywords[] = $keyword;
592 }
593 }
594 $this->lom_services->manipulate($object->getId(), $object->getId(), $object->getType())
595 ->prepareCreateOrUpdate(
596 $this->lom_services->paths()->keywords(),
597 ...$keywords
598 )->execute();
599 }

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

+ Here is the call graph for this function:

◆ initNewForm()

ilObjLTIConsumerGUI::initNewForm ( string  $a_new_type)
protected

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

164 {
165 return $this->buildProviderSelectionForm($a_new_type);
166 }
buildProviderSelectionForm(string $a_new_type)

References buildProviderSelectionForm().

Referenced by initCreateForm().

+ 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 179 of file class.ilObjLTIConsumerGUI.php.

180 {
181 global $DIC;
182
183 //ToDo: Error Handling
184 $provider = new ilLTIConsumeProvider($a_provider_id);
185
187
188 $form->initToolConfigForm($this->ctrl->getFormAction($this, "cancelDynReg"), '', '');
189
190 $form->clearCommandButtons();
191 $form->addCommandButton("saveDynReg", $this->lng->txt('save'));
192 $form->addCommandButton("cancelDynReg", $this->lng->txt("cancel"));
193
194 $form->setTitle($DIC->language()->txt($a_new_type . '_custom_new'));
195
196 return $form;
197 }

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

Referenced by saveDynReg(), and showToolConfig().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isContentTabAvailable()

ilObjLTIConsumerGUI::isContentTabAvailable ( )

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

846 : bool
847 {
848 if (!$this->object->getOfflineStatus() &&
849 $this->object->getProvider()->getAvailability() != ilLTIConsumeProvider::AVAILABILITY_NONE) {
850 return true;
851 }
852 return false;
853 }

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

+ Here is the call graph for this function:

◆ saveContentSelection()

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

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

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

References ilObjectGUI\$data, $provider, $refId, $token, and getRequestValue().

Referenced by contentSelectionResponse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCustom()

ilObjLTIConsumerGUI::saveCustom ( )

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

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

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

+ Here is the call graph for this function:

◆ saveDynReg()

ilObjLTIConsumerGUI::saveDynReg ( )

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

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

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

+ Here is the call graph for this function:

◆ saveObject()

ilObjLTIConsumerGUI::saveObject ( )

Reimplemented from ilObjectGUI.

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

102 : void
103 {
104 // create permission is already checked in createObject. This check here is done to prevent hacking attempts
105 if (!$this->checkPermissionBool("create", "", $this->requested_new_type)) {
106 $this->error->raiseError($this->lng->txt("no_create_permission"), $this->error->MESSAGE);
107 }
108
109 $this->lng->loadLanguageModule($this->requested_new_type);
110 $this->ctrl->setParameter($this, "new_type", $this->requested_new_type);
111
112 $forms = $this->initCreateForm($this->requested_new_type);
113
114 foreach ($forms as $form) {
115 if ($form->checkInput()) {
116 $this->ctrl->setParameter($this, "new_type", "");
117
118 $class_name = "ilObj" . $this->obj_definition->getClassName($this->requested_new_type);
119 $newObj = new $class_name();
120 $newObj->setType($this->requested_new_type);
121 $newObj->setTitle($form->getInput("title"));
122 $newObj->setDescription($form->getInput("desc"));
123 $newObj->processAutoRating();
124 $newObj->create();
125
126 $this->putObjectInTree($newObj);
127
128 $dtpl = $this->getDidacticTemplateVar("dtpl");
129 if ($dtpl) {
130 $newObj->applyDidacticTemplate($dtpl);
131 }
132
133 $this->afterSave($newObj);
134 }
135
136 $form->setValuesByPost();
137 $this->tpl->setContent($form->getHTML());
138 }
139
140 }
error(string $a_errmsg)
initCreateForm(string $a_new_type)

References afterSave(), ilObject2GUI\checkPermissionBool(), ILIAS\Repository\ctrl(), error(), ilObjectGUI\getDidacticTemplateVar(), initCreateForm(), ILIAS\Repository\lng(), and ilObject2GUI\putObjectInTree().

+ Here is the call graph for this function:

◆ setTabs()

ilObjLTIConsumerGUI::setTabs ( )
protected

create tabs (repository/workspace switch)

this had to be moved here because of the context-specific permission tab

Reimplemented from ilObject2GUI.

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

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

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

+ Here is the call graph for this function:

◆ showToolConfig()

ilObjLTIConsumerGUI::showToolConfig ( )

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

336 : void
337 {
338 global $DIC;
340 throw new ilLtiConsumerException('permission denied!');
341 }
342 $new_type = $this->getRequestValue("new_type");
343 $DIC->ctrl()->setParameter($this, "new_type", $new_type);
344 $provider_id = $this->getRequestValue("provider_id");
345 $DIC->ctrl()->setParameter($this, "provider_id", $provider_id);
346 $DIC->language()->loadLanguageModule($new_type);
347 $form = $this->initShowToolConfig($new_type, (int) $provider_id);
348 $DIC->ui()->mainTemplate()->setContent($form->getHTML());
349 }

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

+ Here is the call graph for this function:

◆ trackObjectReadEvent()

ilObjLTIConsumerGUI::trackObjectReadEvent ( )
protected

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

1009 : void
1010 {
1011 global $DIC;
1012 /* @var \ILIAS\DI\Container $DIC */
1013
1015 $this->object->getType(),
1016 $this->object->getRefId(),
1017 $this->object->getId(),
1018 $DIC->user()->getId()
1019 );
1020
1021 ilLPStatusWrapper::_updateStatus($this->object->getId(), $DIC->user()->getId());
1022 }
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)

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

+ Here is the call 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.

◆ $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.

Referenced by initCreateForm().

◆ CFORM_DYNAMIC_REGISTRATION

const ilObjLTIConsumerGUI::CFORM_DYNAMIC_REGISTRATION = 98

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

Referenced by initCreateForm().

◆ 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: