19 declare(strict_types=1);
65 public function __construct(
int $a_id = 0,
int $a_id_type = self::REPOSITORY_NODE_ID,
int $a_parent_node_id = 0)
75 $this->
lng->loadLanguageModule(
"cmix");
76 $this->lom_services = $DIC->learningObjectMetadata();
90 $form->setTarget(
"_top");
91 $form->setFormAction($this->
ctrl->getFormAction($this,
"save"));
92 $form->setTitle($this->
lng->txt($a_new_type .
"_new"));
97 $title->setValue(self::NEW_OBJ_TITLE);
98 $form->addItem($title);
101 $type->setRequired(
true);
104 $typeLearningModule->
setInfo($this->
lng->txt(
'cmix_add_cmi5_lm_info'));
105 $type->addOption($typeLearningModule);
108 $this->
lng->txt(
'cmix_add_xapi_standard_object'),
111 $typeGenericModule->
setInfo($this->
lng->txt(
'cmix_add_xapi_standard_object_info'));
112 $type->addOption($typeGenericModule);
114 $form->addItem(
$type);
119 foreach ($types as
$type) {
120 $option =
new ilRadioOption((
string) $type[
'title'], (
string) $type[
'type_id'], (
string) $type[
'description']);
121 $item->addOption($option);
123 #$item->setValue($this->object->typedef->getTypeId()); 124 #$item->setInfo($this->lng->txt('cmix_add_lrs_type_info')); 125 $form->addItem($item);
130 $srcRemoteContent =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_url'),
'resource');
131 $srcRemoteContent->
setInfo($this->
lng->txt(
'cmix_add_source_url_info'));
132 $source->addOption($srcRemoteContent);
134 $srcUploadContent =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_local_dir'),
'upload');
135 $srcUploadContent->
setInfo($this->
lng->txt(
'cmix_add_source_local_dir_info'));
136 $source->addOption($srcUploadContent);
140 $srcUpload->setSuffixes([
'zip',
'xml']);
141 $srcUpload->setRequired(
true);
142 $srcUploadContent->addSubItem($srcUpload);
145 $srcServerContent =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_upload_dir'),
'server');
146 $srcServerContent->
setInfo($this->
lng->txt(
'cmix_add_source_upload_dir_info'));
147 $source->addOption($srcServerContent);
149 $options = [
'' => $this->
lng->txt(
'cmix_add_source_upload_select')];
152 $options[$file] = $file;
157 $srcServerContent->addSubItem($srcSelect);
160 $srcExternalApp =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_external_app'),
'external');
161 $srcExternalApp->
setInfo($this->
lng->txt(
'cmix_add_source_external_app_info'));
162 $source->addOption($srcExternalApp);
164 $form->addItem($source);
166 $form->addCommandButton(
"save", $this->
lng->txt($a_new_type .
"_add"));
167 $form->addCommandButton(
"cancel", $this->
lng->txt(
"cancel"));
176 $this->error->raiseError($this->
lng->txt(
"no_create_permission"), $this->error->MESSAGE);
179 $this->
lng->loadLanguageModule($this->requested_new_type);
180 $this->
ctrl->setParameter($this,
"new_type", $this->requested_new_type);
184 $this->
ctrl->setParameter($this,
'new_type',
'');
186 $class_name =
'ilObj' . $this->obj_definition->getClassName($this->requested_new_type);
188 $new_obj =
new $class_name();
189 $new_obj->setType($this->requested_new_type);
190 $new_obj->processAutoRating();
195 $dtpl =
$data[
'didactic_templates'] ?? null;
196 if ($dtpl !== null) {
198 $new_obj->applyDidacticTemplate($dtpl_id);
210 if ($form->checkInput()) {
211 $newObject->setContentType($form->getInput(
'content_type'));
213 $newObject->setLrsTypeId((
int) $form->getInput(
'lrs_type_id'));
214 $newObject->initLrsType();
216 $newObject->setPrivacyIdent($newObject->getLrsType()->getPrivacyIdent());
217 $newObject->setPrivacyName($newObject->getLrsType()->getPrivacyName());
219 switch ($form->getInput(
'source_type')) {
222 $newObject->
setTitle($form->getInput(
'title'));
230 $uploadImporter->importFormUpload((array) $form->getInput(
'uploadfile'));
234 $form->getItemByPostVar(
'uploadfile')->setAlert($e->getMessage());
235 $this->tpl->setOnScreenMessage(
'failure',
'something went wrong!',
true);
236 $this->
ctrl->redirectByClass(self::class,
'create');
247 $serverFile = $form->getInput(
'serverfile');
255 $uploadImporter->importServerFile(implode(DIRECTORY_SEPARATOR, [
267 $newObject->setBypassProxyEnabled(
true);
275 $this->
ctrl->redirectByClass(ilCmiXapiSettingsGUI::class);
283 $this->lom_services->derive()
284 ->fromBasicProperties($object->
getTitle())
290 $return = parent::initHeaderAction($sub_type, $sub_id);
292 if ($this->creation_mode) {
297 if ($validator->isCertificateDownloadable((
int) $this->user->getId(), $this->
object->getId())) {
298 $certLink = $this->
ctrl->getLinkTargetByClass(
299 [ilObjCmiXapiGUI::class, ilCmiXapiSettingsGUI::class],
303 $this->
lng->loadLanguageModule(
'certificate');
305 $return->addCustomCommand($certLink,
'download_certificate');
307 $return->addHeaderIcon(
310 $this->
lng->txt(
'download_certificate'),
320 public static function _goto(
string $a_target): void
323 $main_tpl = $DIC->ui()->mainTemplate();
325 $err = $DIC[
'ilErr'];
327 $ctrl = $DIC->ctrl();
330 $lng = $DIC->language();
332 $targetParameters = explode(
'_', $a_target);
333 $id = (
int) $targetParameters[0];
336 $err->raiseError(
$lng->
txt(
'msg_no_perm_read'), $err->FATAL);
346 $main_tpl->setOnScreenMessage(
'info', sprintf(
347 $lng->
txt(
'msg_no_perm_read_item'),
354 $err->raiseError(
$lng->
txt(
"msg_no_perm_read_lm"), $err->FATAL);
364 if (!$this->creation_mode) {
365 $link = ilLink::_getLink($this->
object->getRefId(), $this->
object->getType());
366 $navigationHistory = $DIC[
'ilNavigationHistory'];
368 $navigationHistory->addItem($this->
object->getRefId(), $link, $this->
object->getType());
378 switch ($DIC->ctrl()->getNextClass()) {
379 case strtolower(ilObjectCopyGUI::class):
382 $gui->setType($this->
getType());
383 $DIC->ctrl()->forwardCommand($gui);
387 case strtolower(ilCommonActionDispatcherGUI::class):
390 $this->
ctrl->forwardCommand($gui);
394 case strtolower(ilLearningProgressGUI::class):
396 $DIC->tabs()->activateTab(self::TAB_ID_LEARNING_PROGRESS);
403 $DIC->ctrl()->forwardCommand($gui);
407 case strtolower(ilInfoScreenGUI::class):
408 $DIC->tabs()->activateTab(self::TAB_ID_INFO);
412 case strtolower(ilCommentGUI::class):
413 $DIC->ctrl()->redirectByClass(ilCommentGUI::class,
"getListHTML");
416 case strtolower(ilObjectMetaDataGUI::class):
418 $DIC->tabs()->activateTab(self::TAB_ID_METADATA);
421 $DIC->ctrl()->forwardCommand($gui);
424 case strtolower(ilPermissionGUI::class):
426 $DIC->tabs()->activateTab(self::TAB_ID_PERMISSIONS);
429 $DIC->ctrl()->forwardCommand($gui);
433 case strtolower(ilCmiXapiSettingsGUI::class):
435 $DIC->tabs()->activateTab(self::TAB_ID_SETTINGS);
438 $DIC->ctrl()->forwardCommand($gui);
442 case strtolower(ilCmiXapiStatementsGUI::class):
444 $DIC->tabs()->activateTab(self::TAB_ID_STATEMENTS);
447 $DIC->ctrl()->forwardCommand($gui);
451 case strtolower(ilCmiXapiScoringGUI::class):
453 $DIC->tabs()->activateTab(self::TAB_ID_SCORING);
456 $DIC->ctrl()->forwardCommand($gui);
460 case strtolower(ilCmiXapiExportGUI::class):
462 $DIC->tabs()->activateTab(self::TAB_ID_EXPORT);
465 $DIC->ctrl()->forwardCommand($gui);
469 case strtolower(ilCmiXapiRegistrationGUI::class):
471 $DIC->tabs()->activateTab(self::TAB_ID_INFO);
474 $DIC->ctrl()->forwardCommand($gui);
478 case strtolower(ilCmiXapiLaunchGUI::class):
481 $DIC->ctrl()->forwardCommand($gui);
487 $command = $DIC->ctrl()->getCmd(self::DEFAULT_CMD);
494 $this->
ctrl->redirectByClass(ilCmiXapiSettingsGUI::class,
"show");
507 $DIC->tabs()->addTab(
509 $DIC->language()->txt(self::TAB_ID_INFO),
510 $DIC->ctrl()->getLinkTargetByClass(ilInfoScreenGUI::class)
513 if ($this->cmixAccess->hasWriteAccess()) {
514 $DIC->tabs()->addTab(
515 self::TAB_ID_SETTINGS,
516 $DIC->language()->txt(self::TAB_ID_SETTINGS),
517 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiSettingsGUI::class)
521 if ($this->cmixAccess->hasStatementsAccess()) {
522 $DIC->tabs()->addTab(
523 self::TAB_ID_STATEMENTS,
524 $DIC->language()->txt(self::TAB_ID_STATEMENTS),
525 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiStatementsGUI::class)
529 if ($this->cmixAccess->hasHighscoreAccess()) {
530 $DIC->tabs()->addTab(
531 self::TAB_ID_SCORING,
532 $DIC->language()->txt(self::TAB_ID_SCORING),
533 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiScoringGUI::class)
537 if ($this->cmixAccess->hasLearningProgressAccess()) {
538 $DIC->tabs()->addTab(
539 self::TAB_ID_LEARNING_PROGRESS,
540 $DIC->language()->txt(self::TAB_ID_LEARNING_PROGRESS),
541 $DIC->ctrl()->getLinkTargetByClass(ilLearningProgressGUI::class)
545 if ($this->cmixAccess->hasWriteAccess()) {
547 $link = $gui->getTab();
550 $DIC->tabs()->addTab(
551 self::TAB_ID_METADATA,
552 $DIC->language()->txt(
'meta_data'),
558 if ($this->cmixAccess->hasWriteAccess()) {
559 $DIC->tabs()->addTab(
561 $DIC->language()->txt(self::TAB_ID_EXPORT),
562 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiExportGUI::class)
566 if ($this->cmixAccess->hasEditPermissionsAccess()) {
567 $DIC->tabs()->addTab(
568 self::TAB_ID_PERMISSIONS,
569 $DIC->language()->txt(self::TAB_ID_PERMISSIONS),
570 $DIC->ctrl()->getLinkTargetByClass(ilPermissionGUI::class,
'perm')
574 if (defined(
'DEVMODE') && DEVMODE) {
575 $DIC->tabs()->addTab(
578 $DIC->ctrl()->getLinkTarget($this,
'debug')
588 $DIC->tabs()->activateTab(
'debug');
591 $filter->setActivityId($this->
object->getActivityId());
595 $this->
object->getLrsType()->getLrsEndpointStatementsAggregationLink(),
600 $this->
object->getLrsType()->getBasicAuth(),
605 $report = $request->queryReport($this->
object->getId());
607 $DIC->ui()->mainTemplate()->setContent(
608 $report->getResponseDebug()
611 $this->tpl->setOnScreenMessage(
'info', $linkBuilder->getPipelineDebug());
612 $this->tpl->setOnScreenMessage(
'question',
'<pre>' . print_r($report->getTableData(),
true) .
'</pre>');
614 $this->tpl->setOnScreenMessage(
'failure', $e->getMessage());
626 $this->
object->getTitle(),
627 $this->
ctrl->getLinkTarget($this, self::DEFAULT_CMD),
629 $DIC->http()->wrapper()->query()->retrieve(
"ref_id", $DIC->refinery()->kindlyTo()->int())
640 $this->
object->getRefId(),
641 $this->
object->getId(),
642 $DIC->user()->getId()
650 $DIC->tabs()->activateTab(self::TAB_ID_INFO);
651 $this->
ctrl->redirectByClass(ilInfoScreenGUI::class,
'showSummary');
662 $ilErr->raiseError($DIC->language()->txt(
"msg_no_perm_read"),
$ilErr->MESSAGE);
670 $info->enablePrivateNotes();
676 $info->enableNewsEditing(
false);
680 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
682 if ($enable_internal_rss) {
683 $info->setBlockProperty(
"news",
"settings", (
string)
true);
684 $info->setBlockProperty(
"news",
"public_notifications_option", (
string)
true);
690 $info->addSection(
'DEVMODE Info');
691 $info->addProperty(
'Local Object ID', (
string) $this->
object->getId());
692 $info->addProperty(
'Current User ID', (
string) $DIC->user()->getId());
696 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
699 if ($this->
object->isSourceTypeExternal()) {
700 $info->addSection($DIC->language()->txt(
"cmix_info_privacy_section"));
702 $info->addSection($DIC->language()->txt(
"cmix_info_privacy_section_launch"));
705 $info->addProperty($DIC->language()->txt(
'cmix_lrs_type'), $this->
object->getLrsType()->getTitle());
707 if ($this->
object->isSourceTypeExternal()) {
710 $DIC->user()->getId(),
711 $this->
object->getPrivacyIdent()
713 if ($cmixUser->getUsrIdent()) {
715 $DIC->language()->txt(
"conf_user_registered_mail"),
716 $cmixUser->getUsrIdent()
721 $DIC->language()->txt(
"conf_privacy_name"),
722 $DIC->language()->txt(
'conf_privacy_name_' . self::getPrivacyNameString($this->
object->getPrivacyName()))
726 $DIC->language()->txt(
"conf_privacy_ident"),
727 $DIC->language()->txt(
'conf_privacy_ident_' . self::getPrivacyIdentString($this->
object->getPrivacyIdent()))
731 if ($this->
object->getLrsType()->getExternalLrs()) {
733 $DIC->language()->txt(
"cmix_info_external_lrs_label"),
734 $DIC->language()->txt(
'cmix_info_external_lrs_info')
738 if (strlen($this->
object->getLrsType()->getPrivacyCommentDefault())) {
740 $DIC->language()->txt(
"cmix_indication_to_user"),
741 nl2br($this->
object->getLrsType()->getPrivacyCommentDefault())
747 $this->
ctrl->forwardCommand($info);
755 if (!$this->
object->getOfflineStatus() && $this->
object->getLrsType()->isAvailable() && $this->
checkPermissionBool(
"read")) {
761 if ($this->
object->isSourceTypeExternal()) {
778 if ($extCmiUserExists) {
779 $label = $this->
lng->txt(
'change_registration');
782 $label = $this->
lng->txt(
'create_registration');
784 $button = $DIC->ui()->factory()->button()->primary(
786 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiRegistrationGUI::class)
788 $DIC->toolbar()->addComponent($button);
791 $launchButton->setPrimary(
true);
792 $launchButton->setCaption(
'launch');
795 $launchButton->setTarget(
'_blank');
798 $launchButton->setUrl($DIC->ctrl()->getLinkTargetByClass(
799 ilCmiXapiLaunchGUI::class
802 $DIC->toolbar()->addButtonInstance($launchButton);
822 $DIC->user()->getId(),
823 $this->
object->getPrivacyIdent()
826 if ($cmiUserExists) {
829 $DIC->user()->getId(),
830 $this->
object->getPrivacyIdent()
834 $button = $DIC->ui()->factory()->button()->primary(
835 $this->
lng->txt(
'fetch_xapi_statements'),
836 $DIC->ctrl()->getLinkTarget(
838 self::CMD_FETCH_XAPI_STATEMENTS
841 $DIC->toolbar()->addComponent($button);
853 $DIC->language()->loadLanguageModule(
'cmix');
854 $this->tpl->setOnScreenMessage(
'failure', $DIC->language()->txt(
'lrs_type_not_avail_msg'));
865 if ($this->
object->isBypassProxyEnabled()) {
882 $info = $DIC->language()->txt(
'xapi_statements_not_fetched_yet');
889 $this->tpl->setOnScreenMessage(
'info', $info);
902 $cmixUser =
new ilCmiXapiUser($this->
object->getId(), $DIC->user()->getId(), $this->
object->getPrivacyIdent());
909 if ($report->hasStatements()) {
911 $evaluation->evaluateReport($report);
917 $cmixUser->setFetchUntil($now);
920 $this->tpl->setOnScreenMessage(
'success', $DIC->language()->txt(
'xapi_statements_fetched_successfully'),
true);
921 $DIC->ctrl()->redirect($this, self::CMD_INFO_SCREEN);
932 $this->
object->getLrsType()->getLrsEndpointStatementsAggregationLink(),
937 $this->
object->getLrsType()->getBasicAuth(),
941 return $request->queryReport($this->
object->getId());
954 $filter->setActivityId($this->
object->getActivityId());
956 $filter->setStartDate($since);
957 $filter->setEndDate($until);
970 return "il_uuid_user_id";
972 return "il_uuid_ext_account";
974 return "il_uuid_login";
978 return "il_uuid_random";
980 return "il_uuid_sha256";
982 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 formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ilObjUser $user=null,)
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 _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()
putObjectInTree(ilObject $obj, int $parent_node_id=null)
Add object to tree at given position.
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
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 _checkUploadFile(string $a_file)
const CMD_FETCH_XAPI_STATEMENTS
sendLastFetchInfo(ilCmiXapiUser $cmixUser)
parseDidacticTemplateVar(string $var, string $type)
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.