19 declare(strict_types=1);
60 public function __construct(
int $a_id = 0,
int $a_id_type = self::REPOSITORY_NODE_ID,
int $a_parent_node_id = 0)
68 $this->
lng->loadLanguageModule(
"cmix");
82 $form->setTarget(
"_top");
83 $form->setFormAction($this->
ctrl->getFormAction($this,
"save"));
84 $form->setTitle($this->
lng->txt($a_new_type .
"_new"));
89 $title->setValue(self::NEW_OBJ_TITLE);
90 $form->addItem($title);
93 $type->setRequired(
true);
96 $typeLearningModule->
setInfo($this->
lng->txt(
'cmix_add_cmi5_lm_info'));
97 $type->addOption($typeLearningModule);
100 $this->
lng->txt(
'cmix_add_xapi_standard_object'),
103 $typeGenericModule->
setInfo($this->
lng->txt(
'cmix_add_xapi_standard_object_info'));
104 $type->addOption($typeGenericModule);
106 $form->addItem(
$type);
111 foreach ($types as
$type) {
112 $option =
new ilRadioOption((
string) $type[
'title'], (
string) $type[
'type_id'], (
string) $type[
'description']);
113 $item->addOption($option);
115 #$item->setValue($this->object->typedef->getTypeId()); 116 $form->addItem($item);
121 $srcRemoteContent =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_url'),
'resource');
122 $srcRemoteContent->
setInfo($this->
lng->txt(
'cmix_add_source_url_info'));
123 $source->addOption($srcRemoteContent);
125 $srcUploadContent =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_local_dir'),
'upload');
126 $srcUploadContent->
setInfo($this->
lng->txt(
'cmix_add_source_local_dir_info'));
127 $source->addOption($srcUploadContent);
131 $srcUpload->setSuffixes([
'zip',
'xml']);
132 $srcUpload->setRequired(
true);
133 $srcUploadContent->addSubItem($srcUpload);
136 $srcServerContent =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_upload_dir'),
'server');
137 $srcServerContent->
setInfo($this->
lng->txt(
'cmix_add_source_upload_dir_info'));
138 $source->addOption($srcServerContent);
140 $options = [
'' => $this->
lng->txt(
'cmix_add_source_upload_select')];
143 $options[$file] = $file;
148 $srcServerContent->addSubItem($srcSelect);
151 $srcExternalApp =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_external_app'),
'external');
152 $srcExternalApp->
setInfo($this->
lng->txt(
'cmix_add_source_external_app_info'));
153 $source->addOption($srcExternalApp);
155 $form->addItem($source);
157 $form->addCommandButton(
"save", $this->
lng->txt($a_new_type .
"_add"));
158 $form->addCommandButton(
"cancel", $this->
lng->txt(
"cancel"));
168 if ($form->checkInput()) {
169 $newObject->setContentType($form->getInput(
'content_type'));
171 $newObject->setLrsTypeId((
int) $form->getInput(
'lrs_type_id'));
172 $newObject->initLrsType();
174 $newObject->setPrivacyIdent($newObject->getLrsType()->getPrivacyIdent());
175 $newObject->setPrivacyName($newObject->getLrsType()->getPrivacyName());
177 switch ($form->getInput(
'source_type')) {
180 $newObject->
setTitle($form->getInput(
'title'));
188 $uploadImporter->importFormUpload((array) $form->getInput(
'uploadfile'));
192 $form->getItemByPostVar(
'uploadfile')->setAlert($e->getMessage());
193 $this->tpl->setOnScreenMessage(
'failure',
'something went wrong!',
true);
194 $this->
ctrl->redirectByClass(self::class,
'create');
205 $serverFile = $form->getInput(
'serverfile');
213 $uploadImporter->importServerFile(implode(DIRECTORY_SEPARATOR, [
225 $newObject->setBypassProxyEnabled(
true);
233 $this->
ctrl->redirectByClass(ilCmiXapiSettingsGUI::class);
245 if (!$generalMetadata) {
249 $generalMetadata->setTitle($object->
getTitle());
250 $generalMetadata->
save();
252 $id = $generalMetadata->addIdentifier();
253 $id->setCatalog(
'ILIAS');
260 $return = parent::initHeaderAction($sub_type, $sub_id);
262 if ($this->creation_mode) {
267 if ($validator->isCertificateDownloadable((
int) $this->user->getId(), $this->
object->getId())) {
268 $certLink = $this->
ctrl->getLinkTargetByClass(
269 [ilObjCmiXapiGUI::class, ilCmiXapiSettingsGUI::class],
273 $this->
lng->loadLanguageModule(
'certificate');
275 $return->addCustomCommand($certLink,
'download_certificate');
277 $return->addHeaderIcon(
280 $this->
lng->txt(
'download_certificate'),
290 public static function _goto(
string $a_target): void
293 $main_tpl = $DIC->ui()->mainTemplate();
295 $err = $DIC[
'ilErr'];
297 $ctrl = $DIC->ctrl();
300 $lng = $DIC->language();
302 $targetParameters = explode(
'_', $a_target);
303 $id = (
int) $targetParameters[0];
306 $err->raiseError(
$lng->
txt(
'msg_no_perm_read'), $err->FATAL);
316 $main_tpl->setOnScreenMessage(
'info', sprintf(
317 $lng->
txt(
'msg_no_perm_read_item'),
324 $err->raiseError(
$lng->
txt(
"msg_no_perm_read_lm"), $err->FATAL);
334 if (!$this->creation_mode) {
335 $link = ilLink::_getLink($this->
object->getRefId(), $this->
object->getType());
336 $navigationHistory = $DIC[
'ilNavigationHistory'];
338 $navigationHistory->addItem($this->
object->getRefId(), $link, $this->
object->getType());
348 switch ($DIC->ctrl()->getNextClass()) {
349 case strtolower(ilObjectCopyGUI::class):
352 $gui->setType($this->
getType());
353 $DIC->ctrl()->forwardCommand($gui);
357 case strtolower(ilCommonActionDispatcherGUI::class):
360 $this->
ctrl->forwardCommand($gui);
364 case strtolower(ilLearningProgressGUI::class):
366 $DIC->tabs()->activateTab(self::TAB_ID_LEARNING_PROGRESS);
373 $DIC->ctrl()->forwardCommand($gui);
377 case strtolower(ilObjectMetaDataGUI::class):
379 $DIC->tabs()->activateTab(self::TAB_ID_METADATA);
382 $DIC->ctrl()->forwardCommand($gui);
385 case strtolower(ilPermissionGUI::class):
387 $DIC->tabs()->activateTab(self::TAB_ID_PERMISSIONS);
390 $DIC->ctrl()->forwardCommand($gui);
394 case strtolower(ilCmiXapiSettingsGUI::class):
396 $DIC->tabs()->activateTab(self::TAB_ID_SETTINGS);
399 $DIC->ctrl()->forwardCommand($gui);
403 case strtolower(ilCmiXapiStatementsGUI::class):
405 $DIC->tabs()->activateTab(self::TAB_ID_STATEMENTS);
408 $DIC->ctrl()->forwardCommand($gui);
412 case strtolower(ilCmiXapiScoringGUI::class):
414 $DIC->tabs()->activateTab(self::TAB_ID_SCORING);
417 $DIC->ctrl()->forwardCommand($gui);
421 case strtolower(ilCmiXapiExportGUI::class):
423 $DIC->tabs()->activateTab(self::TAB_ID_EXPORT);
426 $DIC->ctrl()->forwardCommand($gui);
430 case strtolower(ilCmiXapiRegistrationGUI::class):
432 $DIC->tabs()->activateTab(self::TAB_ID_INFO);
435 $DIC->ctrl()->forwardCommand($gui);
439 case strtolower(ilCmiXapiLaunchGUI::class):
442 $DIC->ctrl()->forwardCommand($gui);
448 if($DIC->ctrl()->getCmd() ==
"settings") {
449 $DIC->tabs()->activateTab(self::TAB_ID_SETTINGS);
450 $DIC->ctrl()->setCmd(
'show');
452 $DIC->ctrl()->forwardCommand($gui);
454 $command = $DIC->ctrl()->getCmd(self::DEFAULT_CMD);
465 $DIC->tabs()->addTab(
467 $DIC->language()->txt(self::TAB_ID_INFO),
468 $DIC->ctrl()->getLinkTargetByClass(self::class)
471 if ($this->cmixAccess->hasWriteAccess()) {
472 $DIC->tabs()->addTab(
473 self::TAB_ID_SETTINGS,
474 $DIC->language()->txt(self::TAB_ID_SETTINGS),
475 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiSettingsGUI::class)
479 if ($this->cmixAccess->hasStatementsAccess()) {
480 $DIC->tabs()->addTab(
481 self::TAB_ID_STATEMENTS,
482 $DIC->language()->txt(self::TAB_ID_STATEMENTS),
483 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiStatementsGUI::class)
487 if ($this->cmixAccess->hasHighscoreAccess()) {
488 $DIC->tabs()->addTab(
489 self::TAB_ID_SCORING,
490 $DIC->language()->txt(self::TAB_ID_SCORING),
491 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiScoringGUI::class)
495 if ($this->cmixAccess->hasLearningProgressAccess()) {
496 $DIC->tabs()->addTab(
497 self::TAB_ID_LEARNING_PROGRESS,
498 $DIC->language()->txt(self::TAB_ID_LEARNING_PROGRESS),
499 $DIC->ctrl()->getLinkTargetByClass(ilLearningProgressGUI::class)
503 if ($this->cmixAccess->hasWriteAccess()) {
505 $link = $gui->getTab();
508 $DIC->tabs()->addTab(
509 self::TAB_ID_METADATA,
510 $DIC->language()->txt(
'meta_data'),
516 if ($this->cmixAccess->hasWriteAccess()) {
517 $DIC->tabs()->addTab(
519 $DIC->language()->txt(self::TAB_ID_EXPORT),
520 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiExportGUI::class)
524 if ($this->cmixAccess->hasEditPermissionsAccess()) {
525 $DIC->tabs()->addTab(
526 self::TAB_ID_PERMISSIONS,
527 $DIC->language()->txt(self::TAB_ID_PERMISSIONS),
528 $DIC->ctrl()->getLinkTargetByClass(ilPermissionGUI::class,
'perm')
532 if (defined(
'DEVMODE') && DEVMODE) {
533 $DIC->tabs()->addTab(
536 $DIC->ctrl()->getLinkTarget($this,
'debug')
546 $DIC->tabs()->activateTab(
'debug');
549 $filter->setActivityId($this->
object->getActivityId());
553 $this->
object->getLrsType()->getLrsEndpointStatementsAggregationLink(),
558 $this->
object->getLrsType()->getBasicAuth(),
563 $report = $request->queryReport($this->
object->getId());
565 $DIC->ui()->mainTemplate()->setContent(
566 $report->getResponseDebug()
569 $this->tpl->setOnScreenMessage(
'info', $linkBuilder->getPipelineDebug());
570 $this->tpl->setOnScreenMessage(
'question',
'<pre>' . print_r($report->getTableData(),
true) .
'</pre>');
572 $this->tpl->setOnScreenMessage(
'failure', $e->getMessage());
584 $this->
object->getTitle(),
585 $this->
ctrl->getLinkTarget($this, self::DEFAULT_CMD),
587 $DIC->http()->wrapper()->query()->retrieve(
"ref_id", $DIC->refinery()->kindlyTo()->int())
598 $this->
object->getRefId(),
599 $this->
object->getId(),
600 $DIC->user()->getId()
609 $DIC->tabs()->activateTab(self::TAB_ID_INFO);
611 $DIC->ctrl()->setCmd(
"showSummary");
612 $DIC->ctrl()->setCmdClass(
"ilinfoscreengui");
624 $ilErr->raiseError($DIC->language()->txt(
"msg_no_perm_read"),
$ilErr->MESSAGE);
632 $info->enablePrivateNotes();
638 $info->enableNewsEditing(
false);
642 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
644 if ($enable_internal_rss) {
645 $info->setBlockProperty(
"news",
"settings", (
string)
true);
646 $info->setBlockProperty(
"news",
"public_notifications_option", (
string)
true);
652 $info->addSection(
'DEVMODE Info');
653 $info->addProperty(
'Local Object ID', (
string) $this->
object->getId());
654 $info->addProperty(
'Current User ID', (
string) $DIC->user()->getId());
658 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
661 if ($this->
object->isSourceTypeExternal()) {
662 $info->addSection($DIC->language()->txt(
"cmix_info_privacy_section"));
664 $info->addSection($DIC->language()->txt(
"cmix_info_privacy_section_launch"));
667 $info->addProperty($DIC->language()->txt(
'cmix_lrs_type'), $this->
object->getLrsType()->getTitle());
669 if ($this->
object->isSourceTypeExternal()) {
672 $DIC->user()->getId(),
673 $this->
object->getPrivacyIdent()
675 if ($cmixUser->getUsrIdent()) {
677 $DIC->language()->txt(
"conf_user_registered_mail"),
678 $cmixUser->getUsrIdent()
683 $DIC->language()->txt(
"conf_privacy_name"),
684 $DIC->language()->txt(
'conf_privacy_name_' . self::getPrivacyNameString($this->
object->getPrivacyName()))
688 $DIC->language()->txt(
"conf_privacy_ident"),
689 $DIC->language()->txt(
'conf_privacy_ident_' . self::getPrivacyIdentString($this->
object->getPrivacyIdent()))
693 if ($this->
object->getLrsType()->getExternalLrs()) {
695 $DIC->language()->txt(
"cmix_info_external_lrs_label"),
696 $DIC->language()->txt(
'cmix_info_external_lrs_info')
700 if (strlen($this->
object->getLrsType()->getPrivacyCommentDefault())) {
702 $DIC->language()->txt(
"cmix_indication_to_user"),
703 nl2br($this->
object->getLrsType()->getPrivacyCommentDefault())
709 $this->
ctrl->forwardCommand($info);
717 if (!$this->
object->getOfflineStatus() && $this->
object->getLrsType()->isAvailable() && $this->
checkPermissionBool(
"read")) {
723 if ($this->
object->isSourceTypeExternal()) {
740 if ($extCmiUserExists) {
741 $label = $this->
lng->txt(
'change_registration');
744 $label = $this->
lng->txt(
'create_registration');
746 $button = $DIC->ui()->factory()->button()->primary(
748 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiRegistrationGUI::class)
750 $DIC->toolbar()->addComponent($button);
753 $launchButton->setPrimary(
true);
754 $launchButton->setCaption(
'launch');
757 $launchButton->setTarget(
'_blank');
760 $launchButton->setUrl($DIC->ctrl()->getLinkTargetByClass(
761 ilCmiXapiLaunchGUI::class
764 $DIC->toolbar()->addButtonInstance($launchButton);
784 $DIC->user()->getId(),
785 $this->
object->getPrivacyIdent()
788 if ($cmiUserExists) {
791 $DIC->user()->getId(),
792 $this->
object->getPrivacyIdent()
796 $button = $DIC->ui()->factory()->button()->primary(
797 $this->
lng->txt(
'fetch_xapi_statements'),
798 $DIC->ctrl()->getLinkTarget(
800 self::CMD_FETCH_XAPI_STATEMENTS
803 $DIC->toolbar()->addComponent($button);
816 $this->tpl->setOnScreenMessage(
'failure', $DIC->language()->txt(
'cmix_lrstype_not_avail_msg'));
827 if ($this->
object->isBypassProxyEnabled()) {
844 $info = $DIC->language()->txt(
'xapi_statements_not_fetched_yet');
851 $this->tpl->setOnScreenMessage(
'info', $info);
864 $cmixUser =
new ilCmiXapiUser($this->
object->getId(), $DIC->user()->getId(), $this->
object->getPrivacyIdent());
871 if ($report->hasStatements()) {
873 $evaluation->evaluateReport($report);
879 $cmixUser->setFetchUntil($now);
882 $this->tpl->setOnScreenMessage(
'success', $DIC->language()->txt(
'xapi_statements_fetched_successfully'),
true);
883 $DIC->ctrl()->redirect($this, self::CMD_INFO_SCREEN);
894 $this->
object->getLrsType()->getLrsEndpointStatementsAggregationLink(),
899 $this->
object->getLrsType()->getBasicAuth(),
903 return $request->queryReport($this->
object->getId());
916 $filter->setActivityId($this->
object->getActivityId());
918 $filter->setStartDate($since);
919 $filter->setEndDate($until);
932 return "il_uuid_user_id";
934 return "il_uuid_ext_account";
936 return "il_uuid_login";
940 return "il_uuid_random";
942 return "il_uuid_sha256";
944 return "il_uuid_sha256url";
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static exists(int $objId, int $usrId, int $privacyIdent=999)
static getInstance(ilObjCmiXapi $object)
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
executeCommand()
execute command
static getLogger(string $a_component_id)
Get component logger.
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...
New implementation of ilObjectGUI.
GUI class for the workflow of copying objects.
afterSave(ilObject $newObject)
static _goto(string $a_target)
const LAUNCH_METHOD_NEW_WIN
initHeaderAction(?string $sub_type=null, ?int $sub_id=null)
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 getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static _gotoRepositoryNode(int $ref_id, string $cmd="")
setParameterByClass(string $a_class, string $a_parameter, $a_value)
prepareOutput(bool $show_sub_objects=true)
static _getUploadDirectory()
const CMD_DELIVER_CERTIFICATE
initMetadata(ilObjCmiXapi $object)
handleAvailablityMessage()
static _lookupObjId(int $ref_id)
buildReportFilter(ilCmiXapiDateTime $since, ilCmiXapiDateTime $until)
const AVAILABILITY_CREATE
__construct(int $a_id=0, int $a_id_type=self::REPOSITORY_NODE_ID, int $a_parent_node_id=0)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
static _lookupTitle(int $obj_id)
getXapiStatementsReport(ilCmiXapiDateTime $since, ilCmiXapiDateTime $until)
static getPrivacyIdentString(int $ident)
static getPrivacyNameString(int $ident)
ServerRequestInterface $request
initDidacticTemplate(ilPropertyFormGUI $form)
Validates if an active certificate is stored in the database and can be downloaded by the user...
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)
ilCmiXapiAccess $cmixAccess
isFetchXapiStatementsRequired(ilCmiXapiUser $cmixUser)
initCreateForm(string $a_new_type)
setTargetScript(string $a_target_script)
const TAB_ID_LEARNING_PROGRESS
const LP_CONTEXT_REPOSITORY
addItem(string $a_title, string $a_link, string $a_frame="", int $a_ref_id=0, ?string $type=null)
static _checkUploadFile(string $a_file)
const CMD_FETCH_XAPI_STATEMENTS
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
sendLastFetchInfo(ilCmiXapiUser $cmixUser)
static getTypesData(bool $a_extended=false, ?int $a_availability=null)
Get basic data array of all types (without field definitions)
addHeaderAction()
Add header action menu.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.