3 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;
147 $srcSelect->setOptions($options);
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);
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) {
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 $command = $DIC->ctrl()->getCmd(self::DEFAULT_CMD);
453 protected function launch():
void 460 if ($obj->isSourceTypeExternal() || $obj->isBypassProxyEnabled()) {
464 $DIC->ctrl()->forwardCommand($gui);
474 $DIC->tabs()->addTab(
476 $DIC->language()->txt(self::TAB_ID_INFO),
477 $DIC->ctrl()->getLinkTargetByClass(self::class)
480 if ($this->cmixAccess->hasWriteAccess()) {
481 $DIC->tabs()->addTab(
482 self::TAB_ID_SETTINGS,
483 $DIC->language()->txt(self::TAB_ID_SETTINGS),
484 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiSettingsGUI::class)
488 if ($this->cmixAccess->hasStatementsAccess()) {
489 $DIC->tabs()->addTab(
490 self::TAB_ID_STATEMENTS,
491 $DIC->language()->txt(self::TAB_ID_STATEMENTS),
492 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiStatementsGUI::class)
496 if ($this->cmixAccess->hasHighscoreAccess()) {
497 $DIC->tabs()->addTab(
498 self::TAB_ID_SCORING,
499 $DIC->language()->txt(self::TAB_ID_SCORING),
500 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiScoringGUI::class)
504 if ($this->cmixAccess->hasLearningProgressAccess()) {
505 $DIC->tabs()->addTab(
506 self::TAB_ID_LEARNING_PROGRESS,
507 $DIC->language()->txt(self::TAB_ID_LEARNING_PROGRESS),
508 $DIC->ctrl()->getLinkTargetByClass(ilLearningProgressGUI::class)
512 if ($this->cmixAccess->hasWriteAccess()) {
514 $link = $gui->getTab();
517 $DIC->tabs()->addTab(
518 self::TAB_ID_METADATA,
519 $DIC->language()->txt(
'meta_data'),
525 if ($this->cmixAccess->hasWriteAccess()) {
526 $DIC->tabs()->addTab(
528 $DIC->language()->txt(self::TAB_ID_EXPORT),
529 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiExportGUI::class)
533 if ($this->cmixAccess->hasEditPermissionsAccess()) {
534 $DIC->tabs()->addTab(
535 self::TAB_ID_PERMISSIONS,
536 $DIC->language()->txt(self::TAB_ID_PERMISSIONS),
537 $DIC->ctrl()->getLinkTargetByClass(ilPermissionGUI::class,
'perm')
541 if (defined(
'DEVMODE') && DEVMODE) {
542 $DIC->tabs()->addTab(
545 $DIC->ctrl()->getLinkTarget($this,
'debug')
555 $DIC->tabs()->activateTab(
'debug');
558 $filter->setActivityId($this->
object->getActivityId());
562 $this->
object->getLrsType()->getLrsEndpointStatementsAggregationLink(),
567 $this->
object->getLrsType()->getBasicAuth(),
572 $report = $request->queryReport($this->
object->getId());
574 $DIC->ui()->mainTemplate()->setContent(
575 $report->getResponseDebug()
578 $this->tpl->setOnScreenMessage(
'info', $linkBuilder->getPipelineDebug());
579 $this->tpl->setOnScreenMessage(
'question',
'<pre>' . print_r($report->getTableData(),
true) .
'</pre>');
581 $this->tpl->setOnScreenMessage(
'failure', $e->getMessage());
593 $this->
object->getTitle(),
594 $this->
ctrl->getLinkTarget($this, self::DEFAULT_CMD),
596 $DIC->http()->wrapper()->query()->retrieve(
"ref_id", $DIC->refinery()->kindlyTo()->int())
607 $this->
object->getRefId(),
608 $this->
object->getId(),
609 $DIC->user()->getId()
618 $DIC->tabs()->activateTab(self::TAB_ID_INFO);
620 $DIC->ctrl()->setCmd(
"showSummary");
621 $DIC->ctrl()->setCmdClass(
"ilinfoscreengui");
633 $ilErr->raiseError($DIC->language()->txt(
"msg_no_perm_read"));
641 $info->enablePrivateNotes();
647 $info->enableNewsEditing(
false);
651 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
653 if ($enable_internal_rss) {
654 $info->setBlockProperty(
"news",
"settings", (
string)
true);
655 $info->setBlockProperty(
"news",
"public_notifications_option", (
string)
true);
661 $info->addSection(
'DEVMODE Info');
662 $info->addProperty(
'Local Object ID', (
string) $this->
object->getId());
663 $info->addProperty(
'Current User ID', (
string) $DIC->user()->getId());
667 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
670 if ($this->
object->isSourceTypeExternal()) {
671 $info->addSection($DIC->language()->txt(
"cmix_info_privacy_section"));
673 $info->addSection($DIC->language()->txt(
"cmix_info_privacy_section_launch"));
676 $info->addProperty($DIC->language()->txt(
'cmix_lrs_type'), $this->
object->getLrsType()->getTitle());
678 if ($this->
object->isSourceTypeExternal()) {
681 $DIC->user()->getId(),
682 $this->
object->getPrivacyIdent()
684 if ($cmixUser->getUsrIdent()) {
686 $DIC->language()->txt(
"conf_user_registered_mail"),
687 $cmixUser->getUsrIdent()
692 $DIC->language()->txt(
"conf_privacy_name"),
693 $DIC->language()->txt(
'conf_privacy_name_' . self::getPrivacyNameString($this->
object->getPrivacyName()))
697 $DIC->language()->txt(
"conf_privacy_ident"),
698 $DIC->language()->txt(
'conf_privacy_ident_' . self::getPrivacyIdentString($this->
object->getPrivacyIdent()))
702 if ($this->
object->getLrsType()->getExternalLrs()) {
704 $DIC->language()->txt(
"cmix_info_external_lrs_label"),
705 $DIC->language()->txt(
'cmix_info_external_lrs_info')
709 if (strlen($this->
object->getLrsType()->getPrivacyCommentDefault())) {
711 $DIC->language()->txt(
"cmix_indication_to_user"),
712 nl2br($this->
object->getLrsType()->getPrivacyCommentDefault())
718 $this->
ctrl->forwardCommand($info);
726 if (!$this->
object->getOfflineStatus() && $this->
object->getLrsType()->isAvailable()) {
732 if ($this->
object->isSourceTypeExternal()) {
736 if ($extCmiUserExists) {
737 $registerButton->setCaption(
'change_registration');
739 $registerButton->setPrimary(
true);
740 $registerButton->setCaption(
'create_registration');
743 $registerButton->setUrl($DIC->ctrl()->getLinkTargetByClass(
744 ilCmiXapiRegistrationGUI::class
747 $DIC->toolbar()->addButtonInstance($registerButton);
750 $launchButton->setPrimary(
true);
751 $launchButton->setCaption(
'launch');
754 $launchButton->setTarget(
'_blank');
757 $launchButton->setUrl($DIC->ctrl()->getLinkTargetByClass(
758 ilCmiXapiLaunchGUI::class
761 $DIC->toolbar()->addButtonInstance($launchButton);
771 $DIC->user()->getId(),
772 $this->
object->getPrivacyIdent()
775 if ($cmiUserExists) {
778 $DIC->user()->getId(),
779 $this->
object->getPrivacyIdent()
784 $fetchButton->setCaption(
'fetch_xapi_statements');
786 $fetchButton->setUrl($DIC->ctrl()->getLinkTarget(
788 self::CMD_FETCH_XAPI_STATEMENTS
791 $DIC->toolbar()->addButtonInstance($fetchButton);
805 $this->tpl->setOnScreenMessage(
'failure', $DIC->language()->txt(
'cmix_lrstype_not_avail_msg'));
816 if ($this->
object->isBypassProxyEnabled()) {
833 $info = $DIC->language()->txt(
'xapi_statements_not_fetched_yet');
840 $this->tpl->setOnScreenMessage(
'info', $info);
853 $cmixUser =
new ilCmiXapiUser($this->
object->getId(), $DIC->user()->getId(), $this->
object->getPrivacyIdent());
860 if ($report->hasStatements()) {
862 $evaluation->evaluateReport($report);
868 $cmixUser->setFetchUntil($now);
871 $this->tpl->setOnScreenMessage(
'success', $DIC->language()->txt(
'xapi_statements_fetched_successfully'),
true);
872 $DIC->ctrl()->redirect($this, self::CMD_INFO_SCREEN);
883 $this->
object->getLrsType()->getLrsEndpointStatementsAggregationLink(),
888 $this->
object->getLrsType()->getBasicAuth(),
892 return $request->queryReport($this->
object->getId());
905 $filter->setActivityId($this->
object->getActivityId());
907 $filter->setStartDate($since);
908 $filter->setEndDate($until);
921 return "il_uuid_user_id";
923 return "il_uuid_ext_account";
925 return "il_uuid_login";
929 return "il_uuid_random";
931 return "il_uuid_sha256";
933 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
static _getLink(?int $a_ref_id, string $a_type='', array $a_params=array(), string $append="")
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
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.