19 declare(strict_types=1);
63 public function __construct(
int $a_id = 0,
int $a_id_type = self::REPOSITORY_NODE_ID,
int $a_parent_node_id = 0)
73 $this->
lng->loadLanguageModule(
"cmix");
74 $this->lom_services = $DIC->learningObjectMetadata();
88 $form->setTarget(
"_top");
89 $form->setFormAction($this->
ctrl->getFormAction($this,
"save"));
90 $form->setTitle($this->
lng->txt($a_new_type .
"_new"));
95 $title->setValue(self::NEW_OBJ_TITLE);
96 $form->addItem($title);
99 $type->setRequired(
true);
102 $typeLearningModule->
setInfo($this->
lng->txt(
'cmix_add_cmi5_lm_info'));
103 $type->addOption($typeLearningModule);
106 $this->
lng->txt(
'cmix_add_xapi_standard_object'),
109 $typeGenericModule->
setInfo($this->
lng->txt(
'cmix_add_xapi_standard_object_info'));
110 $type->addOption($typeGenericModule);
112 $form->addItem(
$type);
117 foreach ($types as
$type) {
118 $option =
new ilRadioOption($type[
'title'], (
string) $type[
'type_id'], $type[
'description']);
119 $item->addOption($option);
121 #$item->setValue($this->object->typedef->getTypeId()); 122 $form->addItem($item);
127 $srcRemoteContent =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_url'),
'resource');
128 $srcRemoteContent->
setInfo($this->
lng->txt(
'cmix_add_source_url_info'));
129 $source->addOption($srcRemoteContent);
131 $srcUploadContent =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_local_dir'),
'upload');
132 $srcUploadContent->
setInfo($this->
lng->txt(
'cmix_add_source_local_dir_info'));
133 $source->addOption($srcUploadContent);
137 $srcUpload->setSuffixes([
'zip',
'xml']);
138 $srcUpload->setRequired(
true);
139 $srcUploadContent->addSubItem($srcUpload);
142 $srcServerContent =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_upload_dir'),
'server');
143 $srcServerContent->
setInfo($this->
lng->txt(
'cmix_add_source_upload_dir_info'));
144 $source->addOption($srcServerContent);
146 $options = [
'' => $this->
lng->txt(
'cmix_add_source_upload_select')];
149 $options[$file] = $file;
154 $srcServerContent->addSubItem($srcSelect);
157 $srcExternalApp =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_external_app'),
'external');
158 $srcExternalApp->
setInfo($this->
lng->txt(
'cmix_add_source_external_app_info'));
159 $source->addOption($srcExternalApp);
161 $form->addItem($source);
163 $form->addCommandButton(
"save", $this->
lng->txt($a_new_type .
"_add"));
164 $form->addCommandButton(
"cancel", $this->
lng->txt(
"cancel"));
174 if ($form->checkInput()) {
175 $newObject->setContentType($form->getInput(
'content_type'));
177 $newObject->setLrsTypeId((
int) $form->getInput(
'lrs_type_id'));
178 $newObject->initLrsType();
180 $newObject->setPrivacyIdent($newObject->getLrsType()->getPrivacyIdent());
181 $newObject->setPrivacyName($newObject->getLrsType()->getPrivacyName());
183 switch ($form->getInput(
'source_type')) {
186 $newObject->
setTitle($form->getInput(
'title'));
194 $uploadImporter->importFormUpload((array) $form->getInput(
'uploadfile'));
198 $form->getItemByPostVar(
'uploadfile')->setAlert($e->getMessage());
199 $this->tpl->setOnScreenMessage(
'failure',
'something went wrong!',
true);
200 $this->
ctrl->redirectByClass(self::class,
'create');
211 $serverFile = $form->getInput(
'serverfile');
219 $uploadImporter->importServerFile(implode(DIRECTORY_SEPARATOR, [
231 $newObject->setBypassProxyEnabled(
true);
239 $this->
ctrl->redirectByClass(ilCmiXapiSettingsGUI::class);
247 $this->lom_services->derive()
248 ->fromBasicProperties($object->
getTitle())
254 $return = parent::initHeaderAction($sub_type, $sub_id);
256 if ($this->creation_mode) {
261 if ($validator->isCertificateDownloadable((
int) $this->user->getId(), $this->
object->getId())) {
262 $certLink = $this->
ctrl->getLinkTargetByClass(
263 [ilObjCmiXapiGUI::class, ilCmiXapiSettingsGUI::class],
267 $this->
lng->loadLanguageModule(
'certificate');
269 $return->addCustomCommand($certLink,
'download_certificate');
271 $return->addHeaderIcon(
274 $this->
lng->txt(
'download_certificate'),
284 public static function _goto(
string $a_target): void
287 $main_tpl = $DIC->ui()->mainTemplate();
289 $err = $DIC[
'ilErr'];
291 $ctrl = $DIC->ctrl();
294 $lng = $DIC->language();
296 $targetParameters = explode(
'_', $a_target);
297 $id = (
int) $targetParameters[0];
300 $err->raiseError(
$lng->
txt(
'msg_no_perm_read'), $err->FATAL);
310 $main_tpl->setOnScreenMessage(
'info', sprintf(
311 $lng->
txt(
'msg_no_perm_read_item'),
318 $err->raiseError(
$lng->
txt(
"msg_no_perm_read_lm"), $err->FATAL);
328 if (!$this->creation_mode) {
329 $link = ilLink::_getLink($this->
object->getRefId(), $this->
object->getType());
330 $navigationHistory = $DIC[
'ilNavigationHistory'];
332 $navigationHistory->addItem($this->
object->getRefId(), $link, $this->
object->getType());
342 switch ($DIC->ctrl()->getNextClass()) {
343 case strtolower(ilObjectCopyGUI::class):
346 $gui->setType($this->
getType());
347 $DIC->ctrl()->forwardCommand($gui);
351 case strtolower(ilCommonActionDispatcherGUI::class):
354 $this->
ctrl->forwardCommand($gui);
358 case strtolower(ilLearningProgressGUI::class):
360 $DIC->tabs()->activateTab(self::TAB_ID_LEARNING_PROGRESS);
367 $DIC->ctrl()->forwardCommand($gui);
371 case strtolower(ilObjectMetaDataGUI::class):
373 $DIC->tabs()->activateTab(self::TAB_ID_METADATA);
376 $DIC->ctrl()->forwardCommand($gui);
379 case strtolower(ilPermissionGUI::class):
381 $DIC->tabs()->activateTab(self::TAB_ID_PERMISSIONS);
384 $DIC->ctrl()->forwardCommand($gui);
388 case strtolower(ilCmiXapiSettingsGUI::class):
390 $DIC->tabs()->activateTab(self::TAB_ID_SETTINGS);
393 $DIC->ctrl()->forwardCommand($gui);
397 case strtolower(ilCmiXapiStatementsGUI::class):
399 $DIC->tabs()->activateTab(self::TAB_ID_STATEMENTS);
402 $DIC->ctrl()->forwardCommand($gui);
406 case strtolower(ilCmiXapiScoringGUI::class):
408 $DIC->tabs()->activateTab(self::TAB_ID_SCORING);
411 $DIC->ctrl()->forwardCommand($gui);
415 case strtolower(ilCmiXapiExportGUI::class):
417 $DIC->tabs()->activateTab(self::TAB_ID_EXPORT);
420 $DIC->ctrl()->forwardCommand($gui);
424 case strtolower(ilCmiXapiRegistrationGUI::class):
426 $DIC->tabs()->activateTab(self::TAB_ID_INFO);
429 $DIC->ctrl()->forwardCommand($gui);
433 case strtolower(ilCmiXapiLaunchGUI::class):
436 $DIC->ctrl()->forwardCommand($gui);
442 $command = $DIC->ctrl()->getCmd(self::DEFAULT_CMD);
452 $DIC->tabs()->addTab(
454 $DIC->language()->txt(self::TAB_ID_INFO),
455 $DIC->ctrl()->getLinkTargetByClass(self::class)
458 if ($this->cmixAccess->hasWriteAccess()) {
459 $DIC->tabs()->addTab(
460 self::TAB_ID_SETTINGS,
461 $DIC->language()->txt(self::TAB_ID_SETTINGS),
462 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiSettingsGUI::class)
466 if ($this->cmixAccess->hasStatementsAccess()) {
467 $DIC->tabs()->addTab(
468 self::TAB_ID_STATEMENTS,
469 $DIC->language()->txt(self::TAB_ID_STATEMENTS),
470 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiStatementsGUI::class)
474 if ($this->cmixAccess->hasHighscoreAccess()) {
475 $DIC->tabs()->addTab(
476 self::TAB_ID_SCORING,
477 $DIC->language()->txt(self::TAB_ID_SCORING),
478 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiScoringGUI::class)
482 if ($this->cmixAccess->hasLearningProgressAccess()) {
483 $DIC->tabs()->addTab(
484 self::TAB_ID_LEARNING_PROGRESS,
485 $DIC->language()->txt(self::TAB_ID_LEARNING_PROGRESS),
486 $DIC->ctrl()->getLinkTargetByClass(ilLearningProgressGUI::class)
490 if ($this->cmixAccess->hasWriteAccess()) {
492 $link = $gui->getTab();
495 $DIC->tabs()->addTab(
496 self::TAB_ID_METADATA,
497 $DIC->language()->txt(
'meta_data'),
503 if ($this->cmixAccess->hasWriteAccess()) {
504 $DIC->tabs()->addTab(
506 $DIC->language()->txt(self::TAB_ID_EXPORT),
507 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiExportGUI::class)
511 if ($this->cmixAccess->hasEditPermissionsAccess()) {
512 $DIC->tabs()->addTab(
513 self::TAB_ID_PERMISSIONS,
514 $DIC->language()->txt(self::TAB_ID_PERMISSIONS),
515 $DIC->ctrl()->getLinkTargetByClass(ilPermissionGUI::class,
'perm')
519 if (defined(
'DEVMODE') && DEVMODE) {
520 $DIC->tabs()->addTab(
523 $DIC->ctrl()->getLinkTarget($this,
'debug')
533 $DIC->tabs()->activateTab(
'debug');
536 $filter->setActivityId($this->
object->getActivityId());
540 $this->
object->getLrsType()->getLrsEndpointStatementsAggregationLink(),
545 $this->
object->getLrsType()->getBasicAuth(),
550 $report = $request->queryReport($this->
object->getId());
552 $DIC->ui()->mainTemplate()->setContent(
553 $report->getResponseDebug()
556 $this->tpl->setOnScreenMessage(
'info', $linkBuilder->getPipelineDebug());
557 $this->tpl->setOnScreenMessage(
'question',
'<pre>' . print_r($report->getTableData(),
true) .
'</pre>');
559 $this->tpl->setOnScreenMessage(
'failure', $e->getMessage());
571 $this->
object->getTitle(),
572 $this->
ctrl->getLinkTarget($this, self::DEFAULT_CMD),
574 $DIC->http()->wrapper()->query()->retrieve(
"ref_id", $DIC->refinery()->kindlyTo()->int())
585 $this->
object->getRefId(),
586 $this->
object->getId(),
587 $DIC->user()->getId()
596 $DIC->tabs()->activateTab(self::TAB_ID_INFO);
612 $ilErr->raiseError($DIC->language()->txt(
"msg_no_perm_read"),
$ilErr->MESSAGE);
620 $info->enablePrivateNotes();
626 $info->enableNewsEditing(
false);
630 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
632 if ($enable_internal_rss) {
633 $info->setBlockProperty(
"news",
"settings", (
string)
true);
634 $info->setBlockProperty(
"news",
"public_notifications_option", (
string)
true);
640 $info->addSection(
'DEVMODE Info');
641 $info->addProperty(
'Local Object ID', (
string) $this->
object->getId());
642 $info->addProperty(
'Current User ID', (
string) $DIC->user()->getId());
646 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
649 if ($this->
object->isSourceTypeExternal()) {
650 $info->addSection($DIC->language()->txt(
"cmix_info_privacy_section"));
652 $info->addSection($DIC->language()->txt(
"cmix_info_privacy_section_launch"));
655 $info->addProperty($DIC->language()->txt(
'cmix_lrs_type'), $this->
object->getLrsType()->getTitle());
657 if ($this->
object->isSourceTypeExternal()) {
660 $DIC->user()->getId(),
661 $this->
object->getPrivacyIdent()
663 if ($cmixUser->getUsrIdent()) {
665 $DIC->language()->txt(
"conf_user_registered_mail"),
666 $cmixUser->getUsrIdent()
671 $DIC->language()->txt(
"conf_privacy_name"),
672 $DIC->language()->txt(
'conf_privacy_name_' . self::getPrivacyNameString($this->
object->getPrivacyName()))
676 $DIC->language()->txt(
"conf_privacy_ident"),
677 $DIC->language()->txt(
'conf_privacy_ident_' . self::getPrivacyIdentString($this->
object->getPrivacyIdent()))
681 if ($this->
object->getLrsType()->getExternalLrs()) {
683 $DIC->language()->txt(
"cmix_info_external_lrs_label"),
684 $DIC->language()->txt(
'cmix_info_external_lrs_info')
688 if (strlen($this->
object->getLrsType()->getPrivacyCommentDefault())) {
690 $DIC->language()->txt(
"cmix_indication_to_user"),
691 nl2br($this->
object->getLrsType()->getPrivacyCommentDefault())
697 $this->
ctrl->forwardCommand($info);
705 if (!$this->
object->getOfflineStatus() && $this->
object->getLrsType()->isAvailable()) {
711 if ($this->
object->isSourceTypeExternal()) {
728 if ($extCmiUserExists) {
729 $label = $this->
lng->txt(
'change_registration');
732 $label = $this->
lng->txt(
'create_registration');
734 $button = $DIC->ui()->factory()->button()->primary(
736 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiRegistrationGUI::class)
738 $DIC->toolbar()->addComponent($button);
758 $button = $DIC->ui()->factory()->button()->primary(
759 $this->
lng->txt(
'launch'),
760 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiLaunchGUI::class)
762 $DIC->toolbar()->addComponent($button);
772 $DIC->user()->getId(),
773 $this->
object->getPrivacyIdent()
776 if ($cmiUserExists) {
779 $DIC->user()->getId(),
780 $this->
object->getPrivacyIdent()
784 $button = $DIC->ui()->factory()->button()->primary(
785 $this->
lng->txt(
'fetch_xapi_statements'),
786 $DIC->ctrl()->getLinkTarget(
788 self::CMD_FETCH_XAPI_STATEMENTS
791 $DIC->toolbar()->addComponent($button);
804 $this->tpl->setOnScreenMessage(
'failure', $DIC->language()->txt(
'cmix_lrstype_not_avail_msg'));
815 if ($this->
object->isBypassProxyEnabled()) {
832 $info = $DIC->language()->txt(
'xapi_statements_not_fetched_yet');
839 $this->tpl->setOnScreenMessage(
'info', $info);
852 $cmixUser =
new ilCmiXapiUser($this->
object->getId(), $DIC->user()->getId(), $this->
object->getPrivacyIdent());
859 if ($report->hasStatements()) {
861 $evaluation->evaluateReport($report);
867 $cmixUser->setFetchUntil($now);
870 $this->tpl->setOnScreenMessage(
'success', $DIC->language()->txt(
'xapi_statements_fetched_successfully'),
true);
871 $DIC->ctrl()->redirect($this, self::CMD_INFO_SCREEN);
882 $this->
object->getLrsType()->getLrsEndpointStatementsAggregationLink(),
887 $this->
object->getLrsType()->getBasicAuth(),
891 return $request->queryReport($this->
object->getId());
904 $filter->setActivityId($this->
object->getActivityId());
906 $filter->setStartDate($since);
907 $filter->setEndDate($until);
920 return "il_uuid_user_id";
922 return "il_uuid_ext_account";
924 return "il_uuid_login";
928 return "il_uuid_random";
930 return "il_uuid_sha256";
932 return "il_uuid_sha256url";
This class represents an option in a radio group.
static exists(int $objId, int $usrId, int $privacyIdent=999)
static getInstance(ilObjCmiXapi $object)
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)
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 _gotoRepositoryNode(int $ref_id, string $cmd="")
setParameterByClass(string $a_class, string $a_parameter, $a_value)
LOMServices $lom_services
prepareOutput(bool $show_sub_objects=true)
static _getUploadDirectory()
const CMD_DELIVER_CERTIFICATE
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
initMetadata(ilObjCmiXapi $object)
handleAvailablityMessage()
static _lookupObjId(int $ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
isFetchXapiStatementsRequired(ilCmiXapiUser $cmixUser)
initCreateForm(string $a_new_type)
setTargetScript(string $a_target_script)
const TAB_ID_LEARNING_PROGRESS
__construct(Container $dic, ilPlugin $plugin)
const LP_CONTEXT_REPOSITORY
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static _checkUploadFile(string $a_file)
const CMD_FETCH_XAPI_STATEMENTS
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.
Class ilObjUserTrackingGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.