40 private \ILIAS\ResourceStorage\Services
$irss;
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"];
67 $ilCtrl =
$DIC->ctrl();
69 $this->
ctrl = $ilCtrl;
70 $this->
ctrl->saveParameter($this, array(
"ref_id"));
72 $this->lm_request =
$DIC->htmlLearningModule()
83 $this->output_prepared = $a_prepare_output;
84 $this->gui =
$DIC->htmlLearningModule()->internal()->gui();
89 $next_class = $this->
ctrl->getNextClass($this);
90 $cmd = $this->
ctrl->getCmd();
94 strtolower($this->lm_request->getBaseClass()) ===
"iladministrationgui"
97 } elseif (!in_array($cmd, array(
"",
"framset")) || $next_class !=
"") {
98 $this->tpl->loadStandardTemplate();
103 switch ($next_class) {
104 case strtolower(ilContainerResourceGUI::class):
105 $this->
tabs->activateTab(
'id_list_files');
107 $check_access = $this->
access->checkAccess(
'write',
'', $this->
object->getRefId());
111 $this->
object->getResource(),
112 $this->lng->txt(
'files'),
114 $this->object->getStartFile(),
115 $this->lng->txt(
'start_file'),
116 ))->getConfiguration();
119 $view_configuration = $view_configuration->withExternalAction(
120 $this->
lng->txt(
'cont_set_start_file'),
134 $modal = $this->ui_factory->modal()->roundtrip(
135 $this->
lng->txt(
'import_from_upload_dir'),
138 $this->ui_factory->input()->field()->select(
139 $this->
lng->txt(
'import_from_upload_dir_file_name'),
141 $this->lng->txt(
'import_from_upload_dir_info'),
142 )->withRequired(
true)
144 $this->
ctrl->getFormActionByClass(
145 \ilObjFileBasedLMGUI::class,
151 $this->
lng->txt(
'import_from_upload_dir'),
152 $modal->getShowSignal()
154 $view_configuration = $view_configuration->withExternalTopAction(
155 'import_from_upload_dir',
166 $this->
ctrl->forwardCommand($container_gui);
168 case 'ilobjectmetadatagui':
170 $this->
tabs->activateTab(
'id_meta_data');
172 $this->
ctrl->forwardCommand($md_gui);
175 case "ilinfoscreengui":
179 case "illearningprogressgui":
180 $this->
tabs->activateTab(
'id_learning_progress');
181 $user_id = ($this->lm_request->getUserId() > 0)
182 ? $this->lm_request->getUserId()
183 : $this->
user->getId();
186 $this->
object->getRefId(),
189 $this->
ctrl->forwardCommand($new_gui);
192 case 'ilpermissiongui':
193 $this->
tabs->activateTab(
'id_permissions');
195 $ret = $this->
ctrl->forwardCommand($perm_gui);
199 $this->
tabs->activateTab(
"export");
201 $ret = $this->
ctrl->forwardCommand($exp_gui);
204 case "ilcommonactiondispatchergui":
206 $this->
ctrl->forwardCommand($gui);
210 $cmd = $this->
ctrl->getCmd(self::CMD_LIST_FILES);
213 strtolower($this->lm_request->getBaseClass()) ===
"iladministrationgui"
217 $ret = $this->$cmd();
226 $this->
ctrl->redirectByClass(
"ilrepositorygui",
"frameset");
232 $this->
error->raiseError($this->
lng->txt(
"permission_denied"), $this->error->MESSAGE);
234 $this->
tabs->activateTab(
"id_settings");
238 $this->tpl->setContent($this->
form->getHTML());
251 $ti->setRequired(
true);
252 $this->
form->addItem($ti);
258 $this->
form->addItem($ta);
262 $cb->setOptionTitle($this->
lng->txt(
""));
264 $this->
form->addItem($cb);
270 if ($startfile !==
"") {
271 $ne->setValue(basename($startfile));
273 $ne->setValue(basename($this->
lng->txt(
"no_start_file")));
275 $this->
form->addItem($ne);
278 $pres->setTitle($this->
lng->txt(
'obj_presentation'));
279 $this->
form->addItem($pres);
282 $obj_service->commonSettings()->legacyForm($this->
form, $this->
object)->addTileImage();
284 $this->
form->addCommandButton(
"saveProperties", $this->
lng->txt(
"save"));
285 $this->
form->addCommandButton(
"toFilesystem", $this->
lng->txt(
"cont_set_start_file"));
287 $this->
form->setTitle($this->
lng->txt(
"cont_lm_properties"));
288 $this->
form->setFormAction($this->
ctrl->getFormAction($this,
"saveProperties"));
292 $section->setTitle($this->
lng->txt(
'obj_features'));
293 $this->
form->addItem($section);
309 $values[
'cobj_online'] = !$this->
object->getOfflineStatus();
310 if ($startfile !==
"") {
311 $startfile = basename($startfile);
313 $startfile = $this->
lng->txt(
"no_start_file");
316 $values[
"startfile"] = $startfile;
317 $values[
"title"] = $this->
object->getTitle();
318 $values[
"desc"] = $this->
object->getLongDescription();
319 $values[
"cont_show_info_tab"] = $this->
object->isInfoEnabled();
321 $this->
form->setValuesByArray($values);
328 if ($this->
object->getRID() !=
"") {
329 $this->
ctrl->redirectByClass(ilContainerResourceGUI::class);
331 $this->
ctrl->redirectByClass(static::class,
"properties");
338 $this->
error->raiseError($this->
lng->txt(
"permission_denied"), $this->error->MESSAGE);
344 if ($this->
form->checkInput()) {
345 $this->
object->setTitle($this->
form->getInput(
"title"));
346 $this->
object->setDescription($this->
form->getInput(
"desc"));
347 $this->
object->setOfflineStatus(!(
bool) $this->
form->getInput(
"cobj_online"));
349 $this->
object->update();
352 $obj_service->commonSettings()->legacyForm($this->
form, $this->
object)->saveTileImage();
363 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
364 $this->
ctrl->redirect($this,
"properties");
367 $this->
tabs->activateTab(
"id_settings");
368 $this->
form->setValuesByPost();
369 $this->tpl->setContent($this->
form->getHTML());
374 if (!$this->rbac_system->checkAccess(
"visible,write", $this->object->getRefId())) {
392 if (!$new_object->getStartFile()) {
393 $new_object->maybeDetermineStartFile();
397 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_added"),
true);
398 $this->
object = $new_object;
410 $this->
error->raiseError($this->
lng->txt(
"permission_denied"), $this->error->MESSAGE);
414 $start_file = $this->
http->wrapper()->query()->has(
'lm_path')
415 ? $start_file = $this->
http->wrapper()->query()->retrieve(
417 $this->
refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string())
423 $start_file = hex2bin($start_file);
424 }
catch (Throwable
$e) {
428 if ($start_file ===
'') {
429 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'cont_no_start_file'),
true);
431 $this->
object->setStartFile($start_file);
432 $this->
object->update();
433 $this->tpl->setOnScreenMessage(
'success', sprintf($this->
lng->txt(
'cont_start_file_set_to'), $start_file),
true);
436 $this->
ctrl->redirectByClass(ilContainerResourceGUI::class);
439 public function showLearningModule(): void
444 $this->
user->getId(),
445 $this->object->getId(),
446 $this->object->getRefId(),
454 $resource = $this->
object->getResource();
456 if ($resource !==
null) {
457 $startfile = $this->
object->getStartFile() ??
'index.html';
458 $uri = $this->irss->consume()->containerURI(
459 $resource->getIdentification(),
470 if ($startfile !==
"") {
481 $this->
ctrl->redirectByClass(ilInfoScreenGUI::class,
"showSummary");
486 $this->
tabs->activateTab(
'id_info');
488 $this->
lng->loadLanguageModule(
"meta");
491 $info->enablePrivateNotes();
492 $info->enableLearningProgress();
495 if ($this->
access->checkAccess(
"write",
"", $this->requested_ref_id)) {
496 $info->enableNewsEditing();
499 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
500 if ($enable_internal_rss) {
501 $info->setBlockProperty(
"news",
"settings",
true);
506 if ($this->
access->checkAccess(
"read",
"", $this->requested_ref_id)) {
509 $this->
lng->txt(
"view"),
510 "ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=" . $this->object->getRefId(),
512 )->primary()->toToolbar();
516 $info->addMetaDataSections($this->
object->getId(), 0, $this->object->getType());
535 if ($this->
access->checkAccess(
'write',
'', $this->ref_id)) {
541 $this->ctrl->getLinkTarget($this, self::CMD_LIST_FILES)
545 if ($this->
access->checkAccess(
'visible',
'', $this->ref_id) && $this->object->isInfoEnabled()) {
549 $this->ctrl->getLinkTargetByClass([self::class, ilInfoScreenGUI::class],
"showSummary")
553 if ($this->
access->checkAccess(
'write',
'', $this->ref_id)) {
557 $this->ctrl->getLinkTarget($this,
"properties")
563 "id_learning_progress",
564 $lng->
txt(
"learning_progress"),
565 $this->ctrl->getLinkTargetByClass([self::class, ilLearningProgressGUI::class],
'')
569 if ($this->
access->checkAccess(
'write',
'', $this->ref_id)) {
571 $mdtab = $mdgui->getTab();
582 if ($this->
access->checkAccess(
"write",
"", $this->object->getRefId())) {
586 $this->ctrl->getLinkTargetByClass(ilExportGUI::class,
"")
590 if ($this->
access->checkAccess(
'edit_permission',
'', $this->object->getRefId())) {
594 $this->ctrl->getLinkTargetByClass([self::class, ilPermissionGUI::class],
"perm")
599 if ($startfile !==
"" && $this->
access->checkAccess(
'read',
'', $this->ref_id)) {
600 $this->
tabs->addNonTabbedLink(
602 $this->
lng->txt(
"glo_presentation_view"),
603 "ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=" . $this->object->getRefId(),
609 public static function _goto(
string $a_target): void
612 $main_tpl =
$DIC->ui()->mainTemplate();
621 $main_tpl->setOnScreenMessage(
624 $lng->
txt(
"msg_no_perm_read_item"),
639 if (is_object($this->
object)) {
641 $this->
object->getTitle(),
642 $this->ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary"),
644 $this->requested_ref_id
651 if ($this->
object->getResource() !==
null) {
652 $this->
ctrl->redirectByClass(ilContainerResourceGUI::class);
655 $this->
tabs->activateTab(
"id_list_files");
657 $message_box = $this->gui->ui()->factory()->messageBox()->info(
658 $this->
lng->txt(
"infobox_files_not_migrated")
661 $this->tpl->setContent(
662 $this->gui->ui()->renderer()->render([$message_box])
669 parent::importFileObject();
678 $this->
ctrl->setParameter($this,
"ref_id", $new_object->
getRefId());
679 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_added"),
true);
680 $this->
ctrl->redirect($this,
"properties");
693 $newObj->setDescription(
"");
695 $newObj->populateByDirectoy($a_dir,
$filename);
711 $this->object->getType()
716 $this->object->getType()
719 $subdir = $this->
object->getType() .
"_" . $this->
object->getId();
721 $target_dir = $export_dir .
"/" . $subdir;
726 $source_dir = $this->
object->getDataDirectory();
732 $zip_file = $export_dir .
"/" . $date .
"__" .
IL_INST_ID .
"__" .
733 $this->
object->getType() .
"_" . $this->
object->getId() .
".zip";
748 $this->
ctrl->redirectByClass(
"illearningprogressgui",
"");
760 $main_tpl =
$DIC->ui()->mainTemplate();
762 $main_tpl->setOnScreenMessage(
765 $this->
lng->txt(
"msg_no_perm_write"),
772 $file = $this->lm_request->getString(
'form/input_0');
775 $DIC->ui()->mainTemplate()->setOnScreenMessage(
777 $this->
lng->txt(
'import_from_upload_dir_info'),
781 $this->irss->manageContainer()->addStreamToContainer(
782 $this->
object->getResource()->getIdentification(),
783 Streams::ofResource(fopen(
$path,
'rb')),
786 $DIC->ui()->mainTemplate()->setOnScreenMessage(
788 $this->
lng->txt(
'file_imported_from_upload_dir'),
792 $DIC->ui()->mainTemplate()->setOnScreenMessage(
794 $this->
lng->txt(
'file_import_from_upload_dir_failed'),
799 $this->
ctrl->setParameterByClass(
"ilObjFileBasedLMGUI",
"ref_id", $this->
object->getRefId());
800 $this->
ctrl->redirectByClass([
"ilrepositorygui",
"ilObjFileBasedLMGUI",
"ilContainerResourceGUI"]);
806 $upload_dir =
$lm_set->get(
"cont_upload_dir");
811 }
catch (InvalidArgumentException
$e) {
814 return $import_directory->getAbsolutePath();
824 $handle = opendir($upload_dir);
826 while (
false !== ($file = readdir($handle))) {
827 $full_path = $upload_dir .
"/" . $file;
828 if (is_file($full_path) and is_readable($full_path)) {
Stream factory which enables the user to create streams without the knowledge of the concrete class.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
Export User Interface Class.
static _createExportDirectory(int $a_obj_id, string $a_export_type="xml", string $a_obj_type="")
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
@depricated Get export directory for an repository object
static zip(string $a_dir, string $a_file, bool $compress_content=false)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
setScreenIdComponent(string $a_comp)
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
loadLanguageModule(string $a_module)
Load language module.
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...
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
const LP_CONTEXT_REPOSITORY
Class ilObjUserTrackingGUI.
static _tracProgress(int $a_user_id, int $a_obj_id, int $a_ref_id, string $a_obj_type='')
manifest.xml file not found-exception for import
This class represents a non editable value in a property form.
static _determineStartUrl(int $a_id)
User Interface class for file based learning modules (HTML)
afterSave(ilObject $new_object)
Post (successful) object creation hook.
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
ILIAS ResourceStorage Services $irss
createFromDirectory(string $a_dir)
infoScreen()
this one is called from the info button in the repository
importFileObject(?int $parent_id=null)
__construct( $a_data, int $a_id=0, bool $a_call_by_reference=true, bool $a_prepare_output=true)
static _goto(string $a_target)
getTabs()
@abstract overwrite in derived GUI class of your object type
ILIAS HTMLLearningModule InternalGUIService $gui
const CMD_IMPORT_FROM_UPLOAD_DIR
StandardGUIRequest $lm_request
afterImport(ilObject $new_object)
Post (successful) object import hook.
File Based Learning Module (HTML) object.
Class ilObjectGUI Basic methods of all Output classes.
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
cancelObject()
cancel action and go back to previous page
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
addHeaderAction()
Add header action menu.
putObjectInTree(ilObject $obj, ?int $parent_node_id=null)
Add object to tree at given position.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
prepareOutput(bool $show_sub_objects=true)
updateObject()
updates object entry in object_data
redrawHeaderActionObject()
Ajax call: redraw action header only.
static updateServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
static initServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
const INFO_TAB_VISIBILITY
Class ilObject Basic functions for all objects.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
This class represents a text property in a property form.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static redirect(string $a_script)
static signFolderOfStartFile(string $start_file_path)
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 http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
form(?array $class_path, string $cmd, string $submit_caption="")