39 private \ILIAS\ResourceStorage\Services
$irss;
40 private \ILIAS\HTTP\Services
$http;
41 protected \ILIAS\HTMLLearningModule\InternalGUIService
$gui;
51 bool $a_call_by_reference =
true,
52 bool $a_prepare_output =
true 56 $this->irss = $DIC->resourceStorage();
57 $this->
lng = $DIC->language();
58 $this->
user = $DIC->user();
59 $this->
locator = $DIC[
"ilLocator"];
60 $this->
tabs = $DIC->tabs();
61 $this->tree = $DIC->repositoryTree();
62 $this->tpl = $DIC[
"tpl"];
63 $this->
access = $DIC->access();
64 $this->
toolbar = $DIC->toolbar();
65 $this->
help = $DIC[
"ilHelp"];
66 $this->
http = $DIC->http();
67 $lng = $DIC->language();
68 $ilCtrl = $DIC->ctrl();
70 $this->
ctrl = $ilCtrl;
71 $this->
ctrl->saveParameter($this, array(
"ref_id"));
73 $this->lm_request = $DIC->htmlLearningModule()
84 $this->output_prepared = $a_prepare_output;
85 $this->gui = $DIC->htmlLearningModule()->internal()->gui();
90 $next_class = $this->
ctrl->getNextClass($this);
91 $cmd = $this->
ctrl->getCmd();
95 strtolower($this->lm_request->getBaseClass()) ===
"iladministrationgui" 98 } elseif (!in_array($cmd, array(
"",
"framset")) || $next_class !=
"") {
99 $this->tpl->loadStandardTemplate();
104 switch ($next_class) {
105 case strtolower(ilContainerResourceGUI::class):
106 $this->
tabs->activateTab(
'id_list_files');
108 $check_access = $this->
access->checkAccess(
'write',
'', $this->
object->getRefId());
112 $this->
object->getResource(),
114 $this->
lng->txt(
'files'),
123 $this->
lng->txt(
'cont_set_start_file'),
134 $options[$file] = $file;
137 $modal = $this->ui_factory->modal()->roundtrip(
138 $this->
lng->txt(
'import_from_upload_dir'),
141 $this->ui_factory->input()->field()->select(
142 $this->
lng->txt(
'import_from_upload_dir_file_name'),
144 $this->
lng->txt(
'import_from_upload_dir_info'),
145 )->withRequired(
true)
147 $this->
ctrl->getFormActionByClass(
148 \ilObjFileBasedLMGUI::class,
154 $this->
lng->txt(
'import_from_upload_dir'),
155 $modal->getShowSignal()
157 $view_configuration = $view_configuration->withExternalTopAction(
158 'import_from_upload_dir',
169 $this->
ctrl->forwardCommand($container_gui);
171 case 'ilobjectmetadatagui':
173 $this->
tabs->activateTab(
'id_meta_data');
175 $this->
ctrl->forwardCommand($md_gui);
178 case "ilinfoscreengui":
182 case "illearningprogressgui":
183 $this->
tabs->activateTab(
'id_learning_progress');
184 $user_id = ($this->lm_request->getUserId() > 0)
185 ? $this->lm_request->getUserId()
186 : $this->
user->getId();
189 $this->
object->getRefId(),
192 $this->
ctrl->forwardCommand($new_gui);
195 case 'ilpermissiongui':
196 $this->
tabs->activateTab(
'id_permissions');
198 $ret = $this->
ctrl->forwardCommand($perm_gui);
202 $this->
tabs->activateTab(
"export");
204 $ret = $this->
ctrl->forwardCommand($exp_gui);
207 case "ilcommonactiondispatchergui":
209 $this->
ctrl->forwardCommand($gui);
213 $cmd = $this->
ctrl->getCmd(self::CMD_LIST_FILES);
216 strtolower($this->lm_request->getBaseClass()) ===
"iladministrationgui" 220 $ret = $this->$cmd();
229 $this->
ctrl->redirectByClass(
"ilrepositorygui",
"frameset");
235 $this->error->raiseError($this->
lng->txt(
"permission_denied"), $this->error->MESSAGE);
237 $this->
tabs->activateTab(
"id_settings");
241 $this->tpl->setContent($this->
form->getHTML());
254 $ti->setRequired(
true);
255 $this->
form->addItem($ti);
261 $this->
form->addItem($ta);
265 $cb->setOptionTitle($this->
lng->txt(
""));
267 $this->
form->addItem($cb);
273 if ($startfile !==
"") {
274 $ne->setValue(basename($startfile));
276 $ne->setValue(basename($this->
lng->txt(
"no_start_file")));
278 $this->
form->addItem($ne);
281 $pres->setTitle($this->
lng->txt(
'obj_presentation'));
282 $this->
form->addItem($pres);
285 $obj_service->commonSettings()->legacyForm($this->
form, $this->
object)->addTileImage();
287 $this->
form->addCommandButton(
"saveProperties", $this->
lng->txt(
"save"));
288 $this->
form->addCommandButton(
"toFilesystem", $this->
lng->txt(
"cont_set_start_file"));
290 $this->
form->setTitle($this->
lng->txt(
"cont_lm_properties"));
291 $this->
form->setFormAction($this->
ctrl->getFormAction($this,
"saveProperties"));
295 $section->setTitle($this->
lng->txt(
'obj_features'));
296 $this->
form->addItem($section);
312 $values[
'cobj_online'] = !$this->
object->getOfflineStatus();
313 if ($startfile !==
"") {
314 $startfile = basename($startfile);
316 $startfile = $this->
lng->txt(
"no_start_file");
319 $values[
"startfile"] = $startfile;
320 $values[
"title"] = $this->
object->getTitle();
321 $values[
"desc"] = $this->
object->getLongDescription();
322 $values[
"cont_show_info_tab"] = $this->
object->isInfoEnabled();
324 $this->
form->setValuesByArray($values);
331 if ($this->
object->getRID() !=
"") {
332 $this->
ctrl->redirectByClass(ilContainerResourceGUI::class);
334 $this->
ctrl->redirectByClass(static::class,
"properties");
341 $this->error->raiseError($this->
lng->txt(
"permission_denied"), $this->error->MESSAGE);
347 if ($this->
form->checkInput()) {
348 $this->
object->setTitle($this->
form->getInput(
"title"));
349 $this->
object->setDescription($this->
form->getInput(
"desc"));
350 $this->
object->setOfflineStatus(!(
bool) $this->
form->getInput(
"cobj_online"));
352 $this->
object->update();
355 $obj_service->commonSettings()->legacyForm($this->
form, $this->
object)->saveTileImage();
366 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
367 $this->
ctrl->redirect($this,
"properties");
370 $this->
tabs->activateTab(
"id_settings");
371 $this->
form->setValuesByPost();
372 $this->tpl->setContent($this->
form->getHTML());
377 if (!$this->rbac_system->checkAccess(
"visible,write", $this->object->getRefId())) {
395 if (!$new_object->getStartFile()) {
396 $new_object->maybeDetermineStartFile();
400 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_added"),
true);
401 $this->
object = $new_object;
413 $this->error->raiseError($this->
lng->txt(
"permission_denied"), $this->error->MESSAGE);
417 $start_file = $this->
http->wrapper()->query()->has(
'lm_path')
418 ? $start_file = $this->
http->wrapper()->query()->retrieve(
426 $start_file = hex2bin($start_file);
431 if ($start_file ===
'') {
432 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'cont_no_start_file'),
true);
434 $this->
object->setStartFile($start_file);
435 $this->
object->update();
436 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'cont_start_file_set'),
true);
439 $this->
ctrl->redirectByClass(ilContainerResourceGUI::class);
442 public function showLearningModule():
void 447 $this->
user->getId(),
448 $this->
object->getId(),
449 $this->
object->getRefId(),
457 $resource = $this->
object->getResource();
459 if ($resource !== null) {
460 $startfile = $this->
object->getStartFile() ??
'index.html';
461 $uri = $this->irss->consume()->containerURI(
462 $resource->getIdentification(),
473 if ($startfile !==
"") {
484 $this->
ctrl->redirectByClass(ilInfoScreenGUI::class,
"showSummary");
489 $this->
tabs->activateTab(
'id_info');
491 $this->
lng->loadLanguageModule(
"meta");
494 $info->enablePrivateNotes();
495 $info->enableLearningProgress();
498 if ($this->
access->checkAccess(
"write",
"", $this->requested_ref_id)) {
499 $info->enableNewsEditing();
502 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
503 if ($enable_internal_rss) {
504 $info->setBlockProperty(
"news",
"settings",
true);
509 if ($this->
access->checkAccess(
"read",
"", $this->requested_ref_id)) {
512 $this->
lng->txt(
"view"),
513 "ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=" . $this->
object->getRefId(),
515 )->primary()->toToolbar();
519 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
522 $this->
ctrl->forwardCommand($info);
538 if ($this->
access->checkAccess(
'write',
'', $this->ref_id)) {
544 $this->
ctrl->getLinkTarget($this, self::CMD_LIST_FILES)
548 if ($this->
access->checkAccess(
'visible',
'', $this->ref_id) && $this->
object->isInfoEnabled()) {
552 $this->
ctrl->getLinkTargetByClass([self::class, ilInfoScreenGUI::class],
"showSummary")
556 if ($this->
access->checkAccess(
'write',
'', $this->ref_id)) {
560 $this->
ctrl->getLinkTarget($this,
"properties")
566 "id_learning_progress",
567 $lng->
txt(
"learning_progress"),
568 $this->
ctrl->getLinkTargetByClass([self::class, ilLearningProgressGUI::class],
'')
572 if ($this->
access->checkAccess(
'write',
'', $this->ref_id)) {
574 $mdtab = $mdgui->getTab();
585 if ($this->
access->checkAccess(
"write",
"", $this->object->getRefId())) {
589 $this->
ctrl->getLinkTargetByClass(ilExportGUI::class,
"")
593 if ($this->
access->checkAccess(
'edit_permission',
'', $this->object->getRefId())) {
597 $this->
ctrl->getLinkTargetByClass([self::class, ilPermissionGUI::class],
"perm")
602 if ($startfile !==
"" && $this->
access->checkAccess(
'read',
'', $this->ref_id)) {
603 $this->
tabs->addNonTabbedLink(
605 $this->
lng->txt(
"glo_presentation_view"),
606 "ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=" . $this->
object->getRefId(),
612 public static function _goto(
string $a_target): void
615 $main_tpl = $DIC->ui()->mainTemplate();
617 $lng = $DIC->language();
624 $main_tpl->setOnScreenMessage(
627 $lng->
txt(
"msg_no_perm_read_item"),
642 if (is_object($this->
object)) {
644 $this->
object->getTitle(),
645 $this->
ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary"),
654 if ($this->
object->getResource() !== null) {
655 $this->
ctrl->redirectByClass(ilContainerResourceGUI::class);
658 $this->
tabs->activateTab(
"id_list_files");
660 $message_box = $this->gui->ui()->factory()->messageBox()->info(
661 $this->
lng->txt(
"infobox_files_not_migrated")
664 $this->tpl->setContent(
665 $this->gui->ui()->renderer()->render([$message_box])
672 parent::importFileObject();
681 $this->
ctrl->setParameter($this,
"ref_id", $new_object->
getRefId());
682 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_added"),
true);
683 $this->
ctrl->redirect($this,
"properties");
696 $newObj->setDescription(
"");
698 $newObj->populateByDirectoy($a_dir,
$filename);
714 $this->
object->getType()
719 $this->
object->getType()
722 $subdir = $this->
object->getType() .
"_" . $this->
object->getId();
724 $target_dir = $export_dir .
"/" . $subdir;
729 $source_dir = $this->
object->getDataDirectory();
735 $zip_file = $export_dir .
"/" . $date .
"__" .
IL_INST_ID .
"__" .
736 $this->
object->getType() .
"_" . $this->
object->getId() .
".zip";
751 $this->
ctrl->redirectByClass(
"illearningprogressgui",
"");
763 $main_tpl = $DIC->ui()->mainTemplate();
765 $main_tpl->setOnScreenMessage(
768 $this->
lng->txt(
"msg_no_perm_write"),
775 $file = $this->lm_request->getString(
'form/input_0');
778 $DIC->ui()->mainTemplate()->setOnScreenMessage(
780 $this->
lng->txt(
'import_from_upload_dir_info'),
784 $this->irss->manageContainer()->addStreamToContainer(
785 $this->
object->getResource()->getIdentification(),
786 Streams::ofResource(fopen(
$path,
'rb')),
789 $DIC->ui()->mainTemplate()->setOnScreenMessage(
791 $this->
lng->txt(
'file_imported_from_upload_dir'),
795 $DIC->ui()->mainTemplate()->setOnScreenMessage(
797 $this->
lng->txt(
'file_import_from_upload_dir_failed'),
802 $this->
ctrl->setParameterByClass(
"ilObjFileBasedLMGUI",
"ref_id", $this->
object->getRefId());
803 $this->
ctrl->redirectByClass([
"ilrepositorygui",
"ilObjFileBasedLMGUI",
"ilContainerResourceGUI"]);
809 $upload_dir =
$lm_set->get(
"cont_upload_dir");
817 return $import_directory->getAbsolutePath();
827 $handle = opendir($upload_dir);
829 while (
false !== ($file = readdir($handle))) {
830 $full_path = $upload_dir .
"/" . $file;
831 if (is_file($full_path) and is_readable($full_path)) {
redrawHeaderActionObject()
Ajax call: redraw action header only.
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
__construct( $a_data, int $a_id=0, bool $a_call_by_reference=true, bool $a_prepare_output=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
cancelObject()
cancel action and go back to previous page
static _goto(string $a_target)
prepareOutput(bool $show_sub_objects=true)
createFromDirectory(string $a_dir)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
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) ...
File Based Learning Module (HTML) object.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
setParameterByClass(string $a_class, string $a_parameter, $a_value)
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
loadLanguageModule(string $a_module)
Load language module.
static updateServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
Get export directory for an repository object
sort()
description: > Example for rendering a Sort Glyph.
infoScreen()
this one is called from the info button in the repository
static _lookupObjId(int $ref_id)
afterSave(ilObject $new_object)
static _tracProgress(int $a_user_id, int $a_obj_id, int $a_ref_id, string $a_obj_type='')
withExternalAction(string $label, string $target_gui, string $target_cmd, string $parameter_namespace, string $path_parameter='path', bool $supports_directories=false, array $supported_mime_types=[' *'])
StandardGUIRequest $lm_request
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS HTMLLearningModule InternalGUIService $gui
if($request_wrapper->has('ui_mainbar')) getURI()
afterImport(ilObject $new_object)
static http()
Fetches the global http state from ILIAS.
static _lookupTitle(int $obj_id)
static signFolderOfStartFile(string $start_file_path)
ILIAS ResourceStorage Services $irss
ILIAS HTTP Services $http
const CMD_IMPORT_FROM_UPLOAD_DIR
setScreenIdComponent(string $a_comp)
static _createExportDirectory(int $a_obj_id, string $a_export_type="xml", string $a_obj_type="")
Class ilObjectGUI Basic methods of all Output classes.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static initServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static redirect(string $a_script)
putObjectInTree(ilObject $obj, int $parent_node_id=null)
Add object to tree at given position.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
form( $class_path, string $cmd, string $submit_caption="")
__construct(Container $dic, ilPlugin $plugin)
const LP_CONTEXT_REPOSITORY
This class represents a text area property in a property form.
static zip(string $a_dir, string $a_file, bool $compress_content=false)
const INFO_TAB_VISIBILITY
User Interface class for file based learning modules (HTML)
updateObject()
updates object entry in object_data
importFileObject(int $parent_id=null)
static _determineStartUrl(int $a_id)
addHeaderAction()
Add header action menu.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)