56 public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
66 $DIC->language()->loadLanguageModule(
"cmix");
78 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
80 $form->setTarget(
"_top");
81 $form->setFormAction($this->ctrl->getFormAction($this,
"save"));
82 $form->setTitle($this->lng->txt($a_new_type .
"_new"));
87 $title->setValue(self::NEW_OBJ_TITLE);
88 $form->addItem($title);
91 $type->setRequired(
true);
94 $typeLearningModule->
setInfo($this->lng->txt(
'cmix_add_cmi5_lm_info'));
95 $type->addOption($typeLearningModule);
98 $typeGenericModule->
setInfo($this->lng->txt(
'cmix_add_xapi_standard_object_info'));
99 $type->addOption($typeGenericModule);
101 $form->addItem(
$type);
106 foreach ($types as
$type) {
107 $option =
new ilRadioOption($type[
'title'], $type[
'type_id'], $type[
'description']);
108 $item->addOption($option);
110 #$item->setValue($this->object->typedef->getTypeId()); 111 $form->addItem($item);
116 $srcRemoteContent =
new ilRadioOption($this->lng->txt(
'cmix_add_source_url'),
'resource');
117 $srcRemoteContent->
setInfo($this->lng->txt(
'cmix_add_source_url_info'));
118 $source->addOption($srcRemoteContent);
120 $srcUploadContent =
new ilRadioOption($this->lng->txt(
'cmix_add_source_local_dir'),
'upload');
121 $srcUploadContent->
setInfo($this->lng->txt(
'cmix_add_source_local_dir_info'));
122 $source->addOption($srcUploadContent);
124 $srcUpload =
new ilFileInputGUI($this->lng->txt(
"select_file"),
"uploadfile");
125 $srcUpload->setAllowDeletion(
false);
127 $srcUpload->setRequired(
true);
128 $srcUploadContent->addSubItem($srcUpload);
131 $srcServerContent =
new ilRadioOption($this->lng->txt(
'cmix_add_source_upload_dir'),
'server');
132 $srcServerContent->
setInfo($this->lng->txt(
'cmix_add_source_upload_dir_info'));
133 $source->addOption($srcServerContent);
135 $options = [
'' => $this->lng->txt(
'cmix_add_source_upload_select')];
138 $options[$file] = $file;
141 $srcSelect =
new ilSelectInputGUI($this->lng->txt(
"select_file"),
"serverfile");
142 $srcSelect->setOptions($options);
143 $srcServerContent->addSubItem($srcSelect);
146 $srcExternalApp =
new ilRadioOption($this->lng->txt(
'cmix_add_source_external_app'),
'external');
147 $srcExternalApp->
setInfo($this->lng->txt(
'cmix_add_source_external_app_info'));
148 $source->addOption($srcExternalApp);
152 $form->addCommandButton(
"save", $this->lng->txt($a_new_type .
"_add"));
153 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
165 if ($form->checkInput()) {
166 $newObject->setContentType($form->getInput(
'content_type'));
168 $newObject->setLrsTypeId($form->getInput(
'lrs_type_id'));
169 $newObject->initLrsType();
171 $newObject->setPrivacyIdent($newObject->getLrsType()->getPrivacyIdent());
172 $newObject->setPrivacyName($newObject->getLrsType()->getPrivacyName());
174 switch ($form->getInput(
'source_type')) {
177 $newObject->
setTitle($form->getInput(
'title'));
185 $uploadImporter->importFormUpload($form->getItemByPostVar(
'uploadfile'));
189 $form->getItemByPostVar(
'uploadfile')->setAlert($e->getMessage());
191 $DIC->ctrl()->redirectByClass(self::class,
'create');
202 $serverFile = $form->getInput(
'serverfile');
210 $uploadImporter->importServerFile(implode(DIRECTORY_SEPARATOR, [
221 $newObject->setBypassProxyEnabled(
true);
229 $DIC->ctrl()->redirectByClass(ilCmiXapiSettingsGUI::class);
241 if (!$generalMetadata) {
245 $generalMetadata->setTitle($object->
getTitle());
246 $generalMetadata->
save();
248 $id = $generalMetadata->addIdentifier();
249 $id->setCatalog(
'ILIAS');
250 $id->setEntry(
'il__' . $object->
getType() .
'_' . $object->
getId());
258 $return = parent::initHeaderAction($a_sub_type, $a_sub_id);
260 if ($this->creation_mode) {
265 if ($validator->isCertificateDownloadable((
int) $DIC->user()->getId(), (int) $this->object->getId())) {
266 $certLink = $DIC->ctrl()->getLinkTargetByClass(
267 [ilObjCmiXapiGUI::class, ilCmiXapiSettingsGUI::class],
271 $DIC->language()->loadLanguageModule(
'certificate');
273 $return->addCustomCommand($certLink,
'download_certificate');
275 $return->addHeaderIcon(
278 $DIC->language()->txt(
'download_certificate'),
288 public static function _goto($a_target)
291 $err = $DIC[
'ilErr'];
292 $ctrl = $DIC->ctrl();
293 $request = $DIC->http()->request();
295 $lng = $DIC->language();
297 $targetParameters = explode(
'_', $a_target);
298 $id = (int) $targetParameters[0];
301 $err->raiseError(
$lng->txt(
'msg_no_perm_read'), $err->FATAL);
304 if (
$access->checkAccess(
'read',
'', $id)) {
305 $ctrl->setTargetScript(
'ilias.php');
306 $ctrl->initBaseClass(ilRepositoryGUI::class);
307 $ctrl->setParameterByClass(ilObjCmiXapiGUI::class,
'ref_id', $id);
308 if (isset($request->getQueryParams()[
'gotolp'])) {
309 $ctrl->setParameterByClass(ilObjCmiXapiGUI::class,
'gotolp', 1);
311 $ctrl->redirectByClass([ilRepositoryGUI::class, ilObjCmiXapiGUI::class]);
312 } elseif (
$access->checkAccess(
'visible',
'', $id)) {
314 } elseif (
$access->checkAccess(
'read',
'', ROOT_FOLDER_ID)) {
317 $DIC->language()->txt(
'msg_no_perm_read_item'),
326 $err->raiseError($DIC->language()->txt(
"msg_no_perm_read_lm"), $err->FATAL);
335 if (!$this->creation_mode) {
336 $link =
ilLink::_getLink($this->object->getRefId(), $this->
object->getType());
337 $navigationHistory = $DIC[
'ilNavigationHistory'];
338 $navigationHistory->addItem($this->object->getRefId(), $link, $this->
object->getType());
346 switch ($DIC->ctrl()->getNextClass()) {
347 case strtolower(ilObjectCopyGUI::class):
350 $gui->setType($this->
getType());
351 $DIC->ctrl()->forwardCommand($gui);
355 case strtolower(ilCommonActionDispatcherGUI::class):
358 $this->ctrl->forwardCommand($gui);
362 case strtolower(ilLearningProgressGUI::class):
364 $DIC->tabs()->activateTab(self::TAB_ID_LEARNING_PROGRESS);
368 $this->object->getRefId()
371 $DIC->ctrl()->forwardCommand($gui);
375 case strtolower(ilObjectMetaDataGUI::class):
377 $DIC->tabs()->activateTab(self::TAB_ID_METADATA);
380 $DIC->ctrl()->forwardCommand($gui);
383 case strtolower(ilPermissionGUI::class):
385 $DIC->tabs()->activateTab(self::TAB_ID_PERMISSIONS);
388 $DIC->ctrl()->forwardCommand($gui);
392 case strtolower(ilCmiXapiSettingsGUI::class):
394 $DIC->tabs()->activateTab(self::TAB_ID_SETTINGS);
397 $DIC->ctrl()->forwardCommand($gui);
401 case strtolower(ilCmiXapiStatementsGUI::class):
403 $DIC->tabs()->activateTab(self::TAB_ID_STATEMENTS);
406 $DIC->ctrl()->forwardCommand($gui);
410 case strtolower(ilCmiXapiScoringGUI::class):
412 $DIC->tabs()->activateTab(self::TAB_ID_SCORING);
415 $DIC->ctrl()->forwardCommand($gui);
419 case strtolower(ilCmiXapiExportGUI::class):
421 $DIC->tabs()->activateTab(self::TAB_ID_EXPORT);
424 $DIC->ctrl()->forwardCommand($gui);
428 case strtolower(ilCmiXapiRegistrationGUI::class):
430 $DIC->tabs()->activateTab(self::TAB_ID_INFO);
433 $DIC->ctrl()->forwardCommand($gui);
437 case strtolower(ilCmiXapiLaunchGUI::class):
440 $DIC->ctrl()->forwardCommand($gui);
446 $command = $DIC->ctrl()->getCmd(self::DEFAULT_CMD);
455 $DIC->tabs()->addTab(
457 $DIC->language()->txt(self::TAB_ID_INFO),
458 $DIC->ctrl()->getLinkTargetByClass(self::class)
461 if ($this->cmixAccess->hasWriteAccess()) {
462 $DIC->tabs()->addTab(
463 self::TAB_ID_SETTINGS,
464 $DIC->language()->txt(self::TAB_ID_SETTINGS),
465 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiSettingsGUI::class)
469 if ($this->cmixAccess->hasStatementsAccess()) {
470 $DIC->tabs()->addTab(
471 self::TAB_ID_STATEMENTS,
472 $DIC->language()->txt(self::TAB_ID_STATEMENTS),
473 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiStatementsGUI::class)
477 if ($this->cmixAccess->hasHighscoreAccess()) {
478 $DIC->tabs()->addTab(
479 self::TAB_ID_SCORING,
480 $DIC->language()->txt(self::TAB_ID_SCORING),
481 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiScoringGUI::class)
485 if ($this->cmixAccess->hasLearningProgressAccess()) {
486 $DIC->tabs()->addTab(
487 self::TAB_ID_LEARNING_PROGRESS,
488 $DIC->language()->txt(self::TAB_ID_LEARNING_PROGRESS),
489 $DIC->ctrl()->getLinkTargetByClass(ilLearningProgressGUI::class)
493 if ($this->cmixAccess->hasWriteAccess()) {
495 $link = $gui->getTab();
498 $DIC->tabs()->addTab(
499 self::TAB_ID_METADATA,
500 $DIC->language()->txt(
'meta_data'),
506 if ($this->cmixAccess->hasWriteAccess()) {
507 $DIC->tabs()->addTab(
509 $DIC->language()->txt(self::TAB_ID_EXPORT),
510 $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiExportGUI::class)
514 if ($this->cmixAccess->hasEditPermissionsAccess()) {
515 $DIC->tabs()->addTab(
516 self::TAB_ID_PERMISSIONS,
517 $DIC->language()->txt(self::TAB_ID_PERMISSIONS),
518 $DIC->ctrl()->getLinkTargetByClass(ilPermissionGUI::class,
'perm')
522 if (defined(
'DEVMODE') && DEVMODE) {
523 $DIC->tabs()->addTab(
526 $DIC->ctrl()->getLinkTarget($this,
'debug')
535 $DIC->tabs()->activateTab(
'debug');
538 $filter->setActivityId($this->object->getActivityId());
542 $this->object->getLrsType()->getLrsEndpointStatementsAggregationLink(),
547 $this->object->getLrsType()->getBasicAuth(),
552 $report = $request->queryReport($this->
object);
554 $DIC->ui()->mainTemplate()->setContent(
555 $report->getResponseDebug()
571 $this->object->getTitle(),
572 $this->ctrl->getLinkTarget($this, self::DEFAULT_CMD),
583 $this->object->getType(),
584 $this->
object->getRefId(),
585 $this->
object->getId(),
586 $DIC->user()->getId()
594 $DIC->tabs()->activateTab(self::TAB_ID_INFO);
596 $DIC->ctrl()->setCmd(
"showSummary");
597 $DIC->ctrl()->setCmdClass(
"ilinfoscreengui");
607 $ilErr->raiseError($DIC->language()->txt(
"msg_no_perm_read"));
615 $info->enablePrivateNotes();
621 $info->enableNewsEditing(
false);
625 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
627 if ($enable_internal_rss) {
628 $info->setBlockProperty(
"news",
"settings",
true);
629 $info->setBlockProperty(
"news",
"public_notifications_option",
true);
635 $info->addSection(
'DEVMODE Info');
636 $info->addProperty(
'Local Object ID', $this->object->getId());
637 $info->addProperty(
'Current User ID', $DIC->user()->getId());
641 $info->addMetaDataSections($this->object->getId(), 0, $this->
object->getType());
644 if ($this->object->isSourceTypeExternal()) {
645 $info->addSection($DIC->language()->txt(
"cmix_info_privacy_section"));
647 $info->addSection($DIC->language()->txt(
"cmix_info_privacy_section_launch"));
650 $info->addProperty($DIC->language()->txt(
'cmix_lrs_type'), $this->
object->getLrsType()->getTitle());
652 if ($this->object->isSourceTypeExternal()) {
653 $cmixUser =
new ilCmiXapiUser($this->object->getId(), $DIC->user()->getId(), $this->
object->getPrivacyIdent());
654 if ($cmixUser->getUsrIdent()) {
656 $DIC->language()->txt(
"conf_user_registered_mail"),
657 $cmixUser->getUsrIdent()
662 $DIC->language()->txt(
"conf_privacy_name"),
663 $DIC->language()->txt(
'conf_privacy_name_' . self::getPrivacyNameString($this->object->getPrivacyName()))
667 $DIC->language()->txt(
"conf_privacy_ident"),
668 $DIC->language()->txt(
'conf_privacy_ident_' . self::getPrivacyIdentString($this->object->getPrivacyIdent()))
672 if ($this->object->getLrsType()->getExternalLrs()) {
674 $DIC->language()->txt(
"cmix_info_external_lrs_label"),
675 $DIC->language()->txt(
'cmix_info_external_lrs_info')
679 if (strlen($this->object->getLrsType()->getPrivacyCommentDefault())) {
681 $DIC->language()->txt(
"cmix_indication_to_user"),
682 nl2br($this->object->getLrsType()->getPrivacyCommentDefault())
688 $this->ctrl->forwardCommand($info);
695 if (!$this->object->getOfflineStatus() && $this->
object->getLrsType()->isAvailable()) {
701 if ($this->object->isSourceTypeExternal()) {
705 if ($extCmiUserExists) {
706 $registerButton->setCaption(
'change_registration');
708 $registerButton->setPrimary(
true);
709 $registerButton->setCaption(
'create_registration');
712 $registerButton->setUrl($DIC->ctrl()->getLinkTargetByClass(
713 ilCmiXapiRegistrationGUI::class
716 $DIC->toolbar()->addButtonInstance($registerButton);
719 $launchButton->setPrimary(
true);
720 $launchButton->setCaption(
'launch');
723 $launchButton->setTarget(
'_blank');
726 $launchButton->setUrl($DIC->ctrl()->getLinkTargetByClass(
727 ilCmiXapiLaunchGUI::class
730 $DIC->toolbar()->addButtonInstance($launchButton);
738 $cmiUserExists =
ilCmiXapiUser::exists($this->object->getId(),$DIC->user()->getId(),$this->
object->getPrivacyIdent());
740 if ($cmiUserExists) {
741 $cmixUser =
new ilCmiXapiUser($this->object->getId(), $DIC->user()->getId(), $this->
object->getPrivacyIdent());
745 $fetchButton->setCaption(
'fetch_xapi_statements');
747 $fetchButton->setUrl($DIC->ctrl()->getLinkTarget(
749 self::CMD_FETCH_XAPI_STATEMENTS
752 $DIC->toolbar()->addButtonInstance($fetchButton);
776 if ($this->object->isBypassProxyEnabled()) {
792 $info = $DIC->language()->txt(
'xapi_statements_not_fetched_yet');
811 $cmixUser =
new ilCmiXapiUser($this->object->getId(), $DIC->user()->getId(), $this->
object->getPrivacyIdent());
818 if ($report->hasStatements()) {
820 $evaluation->evaluateReport($report);
826 $cmixUser->setFetchUntil($now);
829 ilUtil::sendSuccess($DIC->language()->txt(
'xapi_statements_fetched_successfully'),
true);
830 $DIC->ctrl()->redirect($this, self::CMD_INFO_SCREEN);
839 $this->object->getLrsType()->getLrsEndpointStatementsAggregationLink(),
844 $this->object->getLrsType()->getBasicAuth(),
848 return $request->queryReport($this->
object);
857 $filter->setActor(
new ilCmiXapiUser($this->object->getId(), $DIC->user()->getId()));
858 $filter->setActivityId($this->object->getActivityId());
860 $filter->setStartDate($since);
861 $filter->setEndDate($until);
874 return "il_uuid_user_id";
876 return "il_uuid_ext_account";
878 return "il_uuid_login";
882 return "il_uuid_random";
884 return "il_uuid_SHA256";
static _recordReadEvent( $a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
This class represents an option in a radio group.
static getInstance(ilObjCmiXapi $object)
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
New implementation of ilObjectGUI.
GUI class for the workflow of copying objects.
afterSave(ilObject $newObject)
const LAUNCH_METHOD_NEW_WIN
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static getTypesData($a_extended=false, $a_availability=null)
Get basic data array of all types (without field definitions)
static _lookupTitle($a_id)
lookup object title
static _getUploadDirectory()
Get the directory with uploaded files.
static _getUploadFiles()
Get a list of readable files in the upload directory.
setInfo($a_info)
Set Info.
__construct($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
const CMD_DELIVER_CERTIFICATE
setTitle($a_title)
set object title
initMetadata(ilObjCmiXapi $object)
handleAvailablityMessage()
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
buildReportFilter(ilCmiXapiDateTime $since, ilCmiXapiDateTime $until)
const AVAILABILITY_CREATE
initCreateForm($a_new_type)
getXapiStatementsReport(ilCmiXapiDateTime $since, ilCmiXapiDateTime $until)
getId()
get object id public
static getPrivacyIdentString(int $ident)
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
static getPrivacyNameString(int $ident)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
initDidacticTemplate(ilPropertyFormGUI $form)
Show didactic template types.
static _lookupObjId($a_id)
Validates if an active certificate is stored in the database and can be downloaded by the user...
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
isFetchXapiStatementsRequired(ilCmiXapiUser $cmixUser)
getType()
get object type public
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const TAB_ID_LEARNING_PROGRESS
__construct(Container $dic, ilPlugin $plugin)
const LP_CONTEXT_REPOSITORY
static exists($objId, $usrId, $privacyIdent=999)
const CMD_FETCH_XAPI_STATEMENTS
prepareOutput($a_show_subobjects=true)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static getLogger($a_component_id)
Get component logger.
initHeaderAction($a_sub_type=null, $a_sub_id=null)
static _checkUploadFile($a_file)
Check if a file exists in the upload directory and is readable.
sendLastFetchInfo(ilCmiXapiUser $cmixUser)
addHeaderAction()
Add header action menu.
Class ilObjUserTrackingGUI.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call