19declare(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);
117 $item->setRequired(
true);
119 foreach ($types as
$type) {
121 $item->addOption($option);
123 $form->addItem($item);
126 $source->setRequired(
true);
128 $srcRemoteContent =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_url'),
'resource');
129 $srcRemoteContent->setInfo($this->
lng->txt(
'cmix_add_source_url_info'));
130 $source->addOption($srcRemoteContent);
132 $srcUploadContent =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_local_dir'),
'upload');
133 $srcUploadContent->setInfo($this->
lng->txt(
'cmix_add_source_local_dir_info'));
134 $source->addOption($srcUploadContent);
137 $srcUpload->setAllowDeletion(
false);
138 $srcUpload->setSuffixes([
'zip',
'xml']);
139 $srcUpload->setRequired(
true);
140 $srcUploadContent->addSubItem($srcUpload);
143 $srcServerContent =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_upload_dir'),
'server');
144 $srcServerContent->setInfo($this->
lng->txt(
'cmix_add_source_upload_dir_info'));
145 $source->addOption($srcServerContent);
147 $options = [
'' => $this->
lng->txt(
'cmix_add_source_upload_select')];
155 $srcServerContent->addSubItem($srcSelect);
158 $srcExternalApp =
new ilRadioOption($this->
lng->txt(
'cmix_add_source_external_app'),
'external');
159 $srcExternalApp->setInfo($this->
lng->txt(
'cmix_add_source_external_app_info'));
160 $source->addOption($srcExternalApp);
162 $form->addItem($source);
164 $form->addCommandButton(
"save", $this->
lng->txt($a_new_type .
"_add"));
165 $form->addCommandButton(
"cancel", $this->
lng->txt(
"cancel"));
174 $this->
error->raiseError($this->
lng->txt(
"no_create_permission"), $this->error->MESSAGE);
177 $this->
lng->loadLanguageModule($this->requested_new_type);
178 $this->
ctrl->setParameter($this,
"new_type", $this->requested_new_type);
182 $this->
ctrl->setParameter($this,
'new_type',
'');
184 $class_name =
'ilObj' . $this->obj_definition->getClassName($this->requested_new_type);
186 $new_obj =
new $class_name();
187 $new_obj->setType($this->requested_new_type);
188 $new_obj->processAutoRating();
193 $dtpl =
$data[
'didactic_templates'] ??
null;
194 if ($dtpl !==
null) {
196 $new_obj->applyDidacticTemplate($dtpl_id);
208 if ($form->checkInput()) {
209 $newObject->setContentType($form->getInput(
'content_type'));
211 $newObject->setLrsTypeId((
int) $form->getInput(
'lrs_type_id'));
212 $newObject->initLrsType();
214 $newObject->setPrivacyIdent($newObject->getLrsType()->getPrivacyIdent());
215 $newObject->setPrivacyName($newObject->getLrsType()->getPrivacyName());
217 switch ($form->getInput(
'source_type')) {
220 $newObject->
setTitle($form->getInput(
'title'));
228 $uploadImporter->importFormUpload((array) $form->getInput(
'uploadfile'));
232 $form->getItemByPostVar(
'uploadfile')->setAlert(
$e->getMessage());
233 $this->tpl->setOnScreenMessage(
'failure',
'something went wrong!',
true);
234 $this->
ctrl->redirectByClass(self::class,
'create');
245 $serverFile = $form->getInput(
'serverfile');
253 $uploadImporter->importServerFile(implode(DIRECTORY_SEPARATOR, [
265 $newObject->setBypassProxyEnabled(
true);
273 $this->
ctrl->redirectByClass(ilCmiXapiSettingsGUI::class);
281 $this->lom_services->derive()
288 $return = parent::initHeaderAction($sub_type, $sub_id);
290 if ($this->creation_mode) {
295 if ($validator->isCertificateDownloadable((
int) $this->user->getId(), $this->object->getId())) {
296 $certLink = $this->
ctrl->getLinkTargetByClass(
297 [ilObjCmiXapiGUI::class, ilCmiXapiSettingsGUI::class],
301 $this->
lng->loadLanguageModule(
'certificate');
303 $return->addCustomCommand($certLink,
'download_certificate');
305 $return->addHeaderIcon(
308 $this->
lng->txt(
'download_certificate'),
318 public static function _goto(
string $a_target): void
321 $main_tpl =
$DIC->ui()->mainTemplate();
323 $err =
$DIC[
'ilErr'];
330 $targetParameters = explode(
'_', $a_target);
331 $id = (
int) $targetParameters[0];
334 $err->raiseError(
$lng->
txt(
'msg_no_perm_read'), $err->FATAL);
344 $main_tpl->setOnScreenMessage(
'info', sprintf(
345 $lng->
txt(
'msg_no_perm_read_item'),
352 $err->raiseError(
$lng->
txt(
"msg_no_perm_read_lm"), $err->FATAL);
362 if (!$this->creation_mode) {
363 $link = ilLink::_getLink($this->
object->getRefId(), $this->object->getType());
364 $navigationHistory =
$DIC[
'ilNavigationHistory'];
366 $navigationHistory->addItem($this->
object->getRefId(), $link, $this->object->getType());
376 switch (
$DIC->ctrl()->getNextClass()) {
377 case strtolower(ilObjectCopyGUI::class):
381 $DIC->ctrl()->forwardCommand($gui);
385 case strtolower(ilCommonActionDispatcherGUI::class):
388 $this->
ctrl->forwardCommand($gui);
392 case strtolower(ilLearningProgressGUI::class):
401 $DIC->ctrl()->forwardCommand($gui);
405 case strtolower(ilInfoScreenGUI::class):
410 case strtolower(ilCommentGUI::class):
414 case strtolower(ilObjectMetaDataGUI::class):
419 $DIC->ctrl()->forwardCommand($gui);
422 case strtolower(ilPermissionGUI::class):
427 $DIC->ctrl()->forwardCommand($gui);
431 case strtolower(ilCmiXapiSettingsGUI::class):
436 $DIC->ctrl()->forwardCommand($gui);
440 case strtolower(ilCmiXapiStatementsGUI::class):
445 $DIC->ctrl()->forwardCommand($gui);
449 case strtolower(ilCmiXapiScoringGUI::class):
454 $DIC->ctrl()->forwardCommand($gui);
458 case strtolower(ilCmiXapiExportGUI::class):
463 $DIC->ctrl()->forwardCommand($gui);
467 case strtolower(ilCmiXapiRegistrationGUI::class):
472 $DIC->ctrl()->forwardCommand($gui);
476 case strtolower(ilCmiXapiLaunchGUI::class):
479 $DIC->ctrl()->forwardCommand($gui);
485 $command =
$DIC->ctrl()->getCmd(self::DEFAULT_CMD);
492 $this->
ctrl->redirectByClass(ilCmiXapiSettingsGUI::class,
"show");
505 $DIC->tabs()->addTab(
507 $DIC->language()->txt(self::TAB_ID_INFO),
508 $DIC->ctrl()->getLinkTargetByClass(ilInfoScreenGUI::class)
511 if ($this->cmixAccess->hasWriteAccess()) {
512 $DIC->tabs()->addTab(
513 self::TAB_ID_SETTINGS,
514 $DIC->language()->txt(self::TAB_ID_SETTINGS),
515 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiSettingsGUI::class)
519 if ($this->cmixAccess->hasStatementsAccess()) {
520 $DIC->tabs()->addTab(
521 self::TAB_ID_STATEMENTS,
522 $DIC->language()->txt(self::TAB_ID_STATEMENTS),
523 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiStatementsGUI::class)
527 if ($this->cmixAccess->hasHighscoreAccess()) {
528 $DIC->tabs()->addTab(
529 self::TAB_ID_SCORING,
530 $DIC->language()->txt(self::TAB_ID_SCORING),
531 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiScoringGUI::class)
535 if ($this->cmixAccess->hasLearningProgressAccess()) {
536 $DIC->tabs()->addTab(
537 self::TAB_ID_LEARNING_PROGRESS,
538 $DIC->language()->txt(self::TAB_ID_LEARNING_PROGRESS),
539 $DIC->ctrl()->getLinkTargetByClass(ilLearningProgressGUI::class)
543 if ($this->cmixAccess->hasWriteAccess()) {
545 $link = $gui->getTab();
548 $DIC->tabs()->addTab(
549 self::TAB_ID_METADATA,
550 $DIC->language()->txt(
'meta_data'),
556 if ($this->cmixAccess->hasWriteAccess()) {
557 $DIC->tabs()->addTab(
559 $DIC->language()->txt(self::TAB_ID_EXPORT),
560 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiExportGUI::class)
564 if ($this->cmixAccess->hasEditPermissionsAccess()) {
565 $DIC->tabs()->addTab(
566 self::TAB_ID_PERMISSIONS,
567 $DIC->language()->txt(self::TAB_ID_PERMISSIONS),
568 $DIC->ctrl()->getLinkTargetByClass(ilPermissionGUI::class,
'perm')
572 if (defined(
'DEVMODE') && DEVMODE) {
573 $DIC->tabs()->addTab(
576 $DIC->ctrl()->getLinkTarget($this,
'debug')
586 $DIC->tabs()->activateTab(
'debug');
589 $filter->setActivityId($this->
object->getActivityId());
593 $this->object->getLrsType()->getLrsEndpointStatementsAggregationLink(),
598 $this->
object->getLrsType()->getBasicAuth(),
605 $DIC->ui()->mainTemplate()->setContent(
606 $report->getResponseDebug()
609 $this->tpl->setOnScreenMessage(
'info', $linkBuilder->getPipelineDebug());
610 $this->tpl->setOnScreenMessage(
'question',
'<pre>' . print_r($report->getTableData(),
true) .
'</pre>');
611 }
catch (Exception
$e) {
612 $this->tpl->setOnScreenMessage(
'failure',
$e->getMessage());
624 $this->
object->getTitle(),
625 $this->ctrl->getLinkTarget($this, self::DEFAULT_CMD),
627 $DIC->http()->wrapper()->query()->retrieve(
"ref_id",
$DIC->refinery()->kindlyTo()->int())
638 $this->object->getRefId(),
639 $this->object->getId(),
640 $DIC->user()->getId()
648 $DIC->tabs()->activateTab(self::TAB_ID_INFO);
649 $this->
ctrl->redirectByClass(ilInfoScreenGUI::class,
'showSummary');
660 $ilErr->raiseError($DIC->language()->txt(
"msg_no_perm_read"),
$ilErr->MESSAGE);
668 $info->enablePrivateNotes();
674 $info->enableNewsEditing(
false);
678 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
680 if ($enable_internal_rss) {
681 $info->setBlockProperty(
"news",
"settings", (
string)
true);
682 $info->setBlockProperty(
"news",
"public_notifications_option", (
string)
true);
688 $info->addSection(
'DEVMODE Info');
689 $info->addProperty(
'Local Object ID', (
string) $this->
object->getId());
690 $info->addProperty(
'Current User ID', (
string) $DIC->user()->getId());
694 $info->addMetaDataSections($this->
object->getId(), 0, $this->object->getType());
697 if ($this->
object->isSourceTypeExternal()) {
698 $info->addSection($DIC->language()->txt(
"cmix_info_privacy_section"));
700 $info->addSection(
$DIC->language()->txt(
"cmix_info_privacy_section_launch"));
703 $info->addProperty(
$DIC->language()->txt(
'cmix_lrs_type'), $this->object->getLrsType()->getTitle());
705 if ($this->
object->isSourceTypeExternal()) {
708 $DIC->user()->getId(),
709 $this->object->getPrivacyIdent()
711 if ($cmixUser->getUsrIdent()) {
713 $DIC->language()->txt(
"conf_user_registered_mail"),
714 $cmixUser->getUsrIdent()
719 $DIC->language()->txt(
"conf_privacy_name"),
720 $DIC->language()->txt(
'conf_privacy_name_' . self::getPrivacyNameString($this->object->getPrivacyName()))
724 $DIC->language()->txt(
"conf_privacy_ident"),
725 $DIC->language()->txt(
'conf_privacy_ident_' . self::getPrivacyIdentString($this->object->getPrivacyIdent()))
729 if ($this->
object->getLrsType()->getExternalLrs()) {
731 $DIC->language()->txt(
"cmix_info_external_lrs_label"),
732 $DIC->language()->txt(
'cmix_info_external_lrs_info')
736 if (strlen($this->
object->getLrsType()->getPrivacyCommentDefault())) {
738 $DIC->language()->txt(
"cmix_indication_to_user"),
739 nl2br($this->
object->getLrsType()->getPrivacyCommentDefault())
753 if (!$this->
object->getOfflineStatus() && $this->object->getLrsType()->isAvailable() && $this->checkPermissionBool(
"read")) {
759 if ($this->
object->isSourceTypeExternal()) {
776 if ($extCmiUserExists) {
777 $label = $this->
lng->txt(
'change_registration');
780 $label = $this->
lng->txt(
'create_registration');
782 $button =
$DIC->ui()->factory()->button()->primary(
784 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiRegistrationGUI::class)
786 $DIC->toolbar()->addComponent($button);
789 $launchButton->setPrimary(
true);
790 $launchButton->setCaption(
'launch');
793 $launchButton->setTarget(
'_blank');
796 $launchButton->setUrl(
$DIC->ctrl()->getLinkTargetByClass(
797 ilCmiXapiLaunchGUI::class
800 $DIC->toolbar()->addButtonInstance($launchButton);
820 $DIC->user()->getId(),
821 $this->object->getPrivacyIdent()
824 if ($cmiUserExists) {
827 $DIC->user()->getId(),
828 $this->object->getPrivacyIdent()
832 $button =
$DIC->ui()->factory()->button()->primary(
833 $this->
lng->txt(
'fetch_xapi_statements'),
834 $DIC->ctrl()->getLinkTarget(
836 self::CMD_FETCH_XAPI_STATEMENTS
839 $DIC->toolbar()->addComponent($button);
851 $DIC->language()->loadLanguageModule(
'cmix');
852 $this->tpl->setOnScreenMessage(
'failure',
$DIC->language()->txt(
'lrs_type_not_avail_msg'));
863 if ($this->
object->isBypassProxyEnabled()) {
880 $info =
$DIC->language()->txt(
'xapi_statements_not_fetched_yet');
887 $this->tpl->setOnScreenMessage(
'info',
$info);
900 $cmixUser =
new ilCmiXapiUser($this->
object->getId(), $DIC->user()->getId(), $this->object->getPrivacyIdent());
902 $fetchedUntil = $cmixUser->getFetchUntil();
907 if ($report->hasStatements()) {
909 $evaluation->evaluateReport($report);
915 $cmixUser->setFetchUntil($now);
918 $this->tpl->setOnScreenMessage(
'success',
$DIC->language()->txt(
'xapi_statements_fetched_successfully'),
true);
919 $DIC->ctrl()->redirect($this, self::CMD_INFO_SCREEN);
930 $this->object->getLrsType()->getLrsEndpointStatementsAggregationLink(),
935 $this->
object->getLrsType()->getBasicAuth(),
952 $filter->setActivityId($this->
object->getActivityId());
954 $filter->setStartDate($since);
955 $filter->setEndDate($until);
968 return "il_uuid_user_id";
970 return "il_uuid_ext_account";
972 return "il_uuid_login";
976 return "il_uuid_random";
978 return "il_uuid_sha256";
980 return "il_uuid_sha256url";
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, $a_ext_rc=null, $a_ext_time=null)
static getInstance(ilObjCmiXapi $object)
static getTypesData(bool $a_extended=false, ?int $a_availability=null)
Get basic data array of all types (without field definitions)
const AVAILABILITY_CREATE
const CMD_DELIVER_CERTIFICATE
static exists(int $objId, int $usrId, int $privacyIdent=999)
Class ilCommonActionDispatcherGUI.
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
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
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...
const LP_CONTEXT_REPOSITORY
Class ilObjUserTrackingGUI.
static getLogger(string $a_component_id)
Get component logger.
sendLastFetchInfo(ilCmiXapiUser $cmixUser)
isFetchXapiStatementsRequired(ilCmiXapiUser $cmixUser)
__construct(int $a_id=0, int $a_id_type=self::REPOSITORY_NODE_ID, int $a_parent_node_id=0)
setTabs()
create tabs (repository/workspace switch)
static getPrivacyNameString(int $ident)
addLocatorItems()
Functions to be overwritten.
handleAvailablityMessage()
afterSave(ilObject $newObject)
Post (successful) object creation hook.
static _goto(string $a_target)
ilCmiXapiAccess $cmixAccess
initCreateForm(string $a_new_type)
getType()
Functions that must be overwritten.
initHeaderAction(?string $sub_type=null, ?int $sub_id=null)
Add header action menu.
static getPrivacyIdentString(int $ident)
getXapiStatementsReport(ilCmiXapiDateTime $since, ilCmiXapiDateTime $until)
initMetadata(ilObjCmiXapi $object)
buildReportFilter(ilCmiXapiDateTime $since, ilCmiXapiDateTime $until)
const CMD_FETCH_XAPI_STATEMENTS
const TAB_ID_LEARNING_PROGRESS
LOMServices $lom_services
const LAUNCH_METHOD_NEW_WIN
New implementation of ilObjectGUI.
executeCommand()
execute command
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
putObjectInTree(ilObject $obj, ?int $parent_node_id=null)
Add object to tree at given position.
prepareOutput(bool $show_sub_objects=true)
GUI class for the workflow of copying objects.
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
initDidacticTemplate(ilPropertyFormGUI $form)
addHeaderAction()
Add header action menu.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
ServerRequestInterface $request
parseDidacticTemplateVar(string $var, string $type)
Class ilObject Basic functions for all objects.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This class represents an option in a radio group.
static _checkUploadFile(string $a_file)
static _getUploadDirectory()
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
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)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc