ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjFileBasedLMGUI.php
Go to the documentation of this file.
1<?php
2
25
35{
36 private const PARAM_PATH = "path";
37 public const CMD_LIST_FILES = "listFiles";
38 public const CMD_IMPORT_FROM_UPLOAD_DIR = 'importFromUploadDir';
39 private \ILIAS\ResourceStorage\Services $irss;
40 protected \ILIAS\HTMLLearningModule\InternalGUIService $gui;
43 protected ilTabsGUI $tabs;
44 protected ilHelpGUI $help;
45 public bool $output_prepared;
46
47 public function __construct(
48 $a_data,
49 int $a_id = 0,
50 bool $a_call_by_reference = true,
51 bool $a_prepare_output = true
52 ) {
53 global $DIC;
54
55 $this->irss = $DIC->resourceStorage();
56 $this->lng = $DIC->language();
57 $this->user = $DIC->user();
58 $this->locator = $DIC["ilLocator"];
59 $this->tabs = $DIC->tabs();
60 $this->tree = $DIC->repositoryTree();
61 $this->tpl = $DIC["tpl"];
62 $this->access = $DIC->access();
63 $this->toolbar = $DIC->toolbar();
64 $this->help = $DIC["ilHelp"];
65 $lng = $DIC->language();
66 $ilCtrl = $DIC->ctrl();
67
68 $this->ctrl = $ilCtrl;
69 $this->ctrl->saveParameter($this, array("ref_id"));
70
71 $this->lm_request = $DIC->htmlLearningModule()
72 ->internal()
73 ->gui()
74 ->standardRequest();
75
76 $this->type = "htlm";
77 $lng->loadLanguageModule("content");
79 $lng->loadLanguageModule("htlm");
80
81 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
82 $this->output_prepared = $a_prepare_output;
83 $this->gui = $DIC->htmlLearningModule()->internal()->gui();
84 }
85
86 public function executeCommand(): void
87 {
88 $next_class = $this->ctrl->getNextClass($this);
89 $cmd = $this->ctrl->getCmd();
90
91 if (
92 $this->getCreationMode() === true ||
93 strtolower($this->lm_request->getBaseClass()) === "iladministrationgui"
94 ) {
95 $this->prepareOutput();
96 } elseif (!in_array($cmd, array("", "framset")) || $next_class != "") {
97 $this->tpl->loadStandardTemplate();
98 $this->setLocator();
99 $this->setTabs();
100 }
101
102 switch ($next_class) {
103 case strtolower(ilContainerResourceGUI::class):
104 $this->tabs->activateTab('id_list_files');
105 // Check wite access to determine upload and manage capabilities
106 $check_access = $this->access->checkAccess('write', '', $this->object->getRefId());
107
108 // Build the view configuration
109 $view_configuration = new Configuration(
110 $this->object->getResource(),
111 new ilHTLMStakeholder(),
112 $this->lng->txt('files'),
114 250,
115 $check_access,
116 $check_access
117 );
118
119 // Add a single action for text-files to set as startfile
120 $view_configuration = $view_configuration->withExternalAction(
121 $this->lng->txt('cont_set_start_file'),
122 self::class,
123 'setStartFile',
124 'lm',
125 self::PARAM_PATH,
126 false,
127 ['text/*']
128 );
129
130 if ($this->getUploadDirectory()) {
131 foreach ($this->getUploadFiles() as $file) {
132 $options[$file] = $file;
133 }
134
135 $modal = $this->ui_factory->modal()->roundtrip(
136 $this->lng->txt('import_from_upload_dir'),
137 [],
138 [
139 $this->ui_factory->input()->field()->select(
140 $this->lng->txt('import_from_upload_dir_file_name'),
141 $options,
142 $this->lng->txt('import_from_upload_dir_info'),
143 )->withRequired(true)
144 ],
145 $this->ctrl->getFormActionByClass(
146 \ilObjFileBasedLMGUI::class,
148 )
149 );
150
151 $top_action = new TopAction(
152 $this->lng->txt('import_from_upload_dir'),
153 $modal->getShowSignal()
154 );
155 $view_configuration = $view_configuration->withExternalTopAction(
156 'import_from_upload_dir',
157 $top_action,
158 $modal
159 );
160 }
161 // build the collection GUI
162 $container_gui = new ilContainerResourceGUI(
163 $view_configuration
164 );
165
166 // forward the command
167 $this->ctrl->forwardCommand($container_gui);
168 break;
169 case 'ilobjectmetadatagui':
170 $this->checkPermission("write");
171 $this->tabs->activateTab('id_meta_data');
172 $md_gui = new ilObjectMetaDataGUI($this->object);
173 $this->ctrl->forwardCommand($md_gui);
174 break;
175
176 case "ilinfoscreengui":
177 $this->showInfoScreen();
178 break;
179
180 case "illearningprogressgui":
181 $this->tabs->activateTab('id_learning_progress');
182 $user_id = ($this->lm_request->getUserId() > 0)
183 ? $this->lm_request->getUserId()
184 : $this->user->getId();
185 $new_gui = new ilLearningProgressGUI(
187 $this->object->getRefId(),
189 );
190 $this->ctrl->forwardCommand($new_gui);
191 break;
192
193 case 'ilpermissiongui':
194 $this->tabs->activateTab('id_permissions');
195 $perm_gui = new ilPermissionGUI($this);
196 $ret = $this->ctrl->forwardCommand($perm_gui);
197 break;
198
199 case "ilexportgui":
200 $this->tabs->activateTab("export");
201 $exp_gui = new ilExportGUI($this);
202 $ret = $this->ctrl->forwardCommand($exp_gui);
203 break;
204
205 case "ilcommonactiondispatchergui":
207 $this->ctrl->forwardCommand($gui);
208 break;
209
210 default:
211 $cmd = $this->ctrl->getCmd(self::CMD_LIST_FILES);
212 if (
213 $this->getCreationMode() === true ||
214 strtolower($this->lm_request->getBaseClass()) === "iladministrationgui"
215 ) {
216 $cmd .= "Object";
217 }
218 $ret = $this->$cmd();
219 break;
220 }
221
222 $this->addHeaderAction();
223 }
224
225 final public function cancelCreationObject(): void
226 {
227 $this->ctrl->redirectByClass("ilrepositorygui", "frameset");
228 }
229
230 public function properties(): void
231 {
232 if (!$this->checkPermissionBool("write")) {
233 $this->error->raiseError($this->lng->txt("permission_denied"), $this->error->MESSAGE);
234 }
235 $this->tabs->activateTab("id_settings");
236
237 $this->initSettingsForm();
238 $this->getSettingsFormValues();
239 $this->tpl->setContent($this->form->getHTML());
240 }
241
242 public function initSettingsForm(): void
243 {
244 $obj_service = $this->getObjectService();
245
246 $this->form = new ilPropertyFormGUI();
247
248 // title
249 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
250 $ti->setSize(min(40, ilObject::TITLE_LENGTH));
251 $ti->setMaxLength(ilObject::TITLE_LENGTH);
252 $ti->setRequired(true);
253 $this->form->addItem($ti);
254
255 // description
256 $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
257 $ta->setCols(40);
258 $ta->setRows(2);
259 $this->form->addItem($ta);
260
261 // online
262 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_online"), "cobj_online");
263 $cb->setOptionTitle($this->lng->txt(""));
264 $cb->setValue("y");
265 $this->form->addItem($cb);
266
267 // startfile
268 $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
269
270 $ne = new ilNonEditableValueGUI($this->lng->txt("cont_startfile"), "");
271 if ($startfile !== "") {
272 $ne->setValue(basename($startfile));
273 } else {
274 $ne->setValue(basename($this->lng->txt("no_start_file")));
275 }
276 $this->form->addItem($ne);
277
278 $pres = new ilFormSectionHeaderGUI();
279 $pres->setTitle($this->lng->txt('obj_presentation'));
280 $this->form->addItem($pres);
281
282 // tile image
283 $obj_service->commonSettings()->legacyForm($this->form, $this->object)->addTileImage();
284
285 $this->form->addCommandButton("saveProperties", $this->lng->txt("save"));
286 $this->form->addCommandButton("toFilesystem", $this->lng->txt("cont_set_start_file"));
287
288 $this->form->setTitle($this->lng->txt("cont_lm_properties"));
289 $this->form->setFormAction($this->ctrl->getFormAction($this, "saveProperties"));
290
291 // additional features
292 $section = new ilFormSectionHeaderGUI();
293 $section->setTitle($this->lng->txt('obj_features'));
294 $this->form->addItem($section);
295
297 $this->object->getId(),
298 $this->form,
299 [
301 ]
302 );
303 }
304
305 public function getSettingsFormValues(): void
306 {
307 $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
308
309 $values = array();
310 $values['cobj_online'] = !$this->object->getOfflineStatus();
311 if ($startfile !== "") {
312 $startfile = basename($startfile);
313 } else {
314 $startfile = $this->lng->txt("no_start_file");
315 }
316
317 $values["startfile"] = $startfile;
318 $values["title"] = $this->object->getTitle();
319 $values["desc"] = $this->object->getLongDescription();
320 $values["cont_show_info_tab"] = $this->object->isInfoEnabled();
321
322 $this->form->setValuesByArray($values);
323 }
324
325 public function toFilesystem(): void
326 {
327 // If we already have a RID, we can redirect to Container GUI
328 // otherwise we display an message which informs the user that the resource is not yet available
329 if ($this->object->getRID() != "") {
330 $this->ctrl->redirectByClass(ilContainerResourceGUI::class);
331 } else {
332 $this->ctrl->redirectByClass(static::class, "properties");
333 }
334 }
335
336 public function saveProperties(): void
337 {
338 if (!$this->checkPermissionBool("write")) {
339 $this->error->raiseError($this->lng->txt("permission_denied"), $this->error->MESSAGE);
340 }
341
342 $obj_service = $this->getObjectService();
343
344 $this->initSettingsForm();
345 if ($this->form->checkInput()) {
346 $this->object->setTitle($this->form->getInput("title"));
347 $this->object->setDescription($this->form->getInput("desc"));
348 $this->object->setOfflineStatus(!(bool) $this->form->getInput("cobj_online"));
349
350 $this->object->update();
351
352 // tile image
353 $obj_service->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
354
355 // services
357 $this->object->getId(),
358 $this->form,
359 array(
361 )
362 );
363
364 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
365 $this->ctrl->redirect($this, "properties");
366 }
367
368 $this->tabs->activateTab("id_settings");
369 $this->form->setValuesByPost();
370 $this->tpl->setContent($this->form->getHTML());
371 }
372
373 public function editObject(): void
374 {
375 if (!$this->rbac_system->checkAccess("visible,write", $this->object->getRefId())) {
376 throw new ilPermissionException($this->lng->txt("permission_denied"));
377 }
378 }
379
380 public function edit(): void
381 {
382 $this->prepareOutput();
383 $this->editObject();
384 }
385
386 public function cancel(): void
387 {
388 $this->cancelObject();
389 }
390
391 protected function afterSave(ilObject $new_object): void
392 {
393 if (!$new_object->getStartFile()) {
394 $new_object->maybeDetermineStartFile();
395 }
396
397 // always send a message
398 $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_added"), true);
399 $this->object = $new_object;
400 $this->redirectAfterCreation();
401 }
402
403 public function update(): void
404 {
405 $this->updateObject();
406 }
407
408 public function setStartFile(): void
409 {
410 if (!$this->checkPermissionBool("write")) {
411 $this->error->raiseError($this->lng->txt("permission_denied"), $this->error->MESSAGE);
412 }
413
414 // try to determine start file from request
415 $start_file = $this->http->wrapper()->query()->has('lm_path')
416 ? $start_file = $this->http->wrapper()->query()->retrieve(
417 'lm_path',
418 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string())
419 )[0] ?? ''
420 : '';
421 // the ContainerResourceGUI uses e bin2hex/hex2bin serialization of pathes. Due to the internals of
422 // UI\Table\Data it's not possible to have a different handling for the parameter in case of external actions...
423 try {
424 $start_file = hex2bin($start_file);
425 } catch (Throwable $e) {
426 $start_file = '';
427 }
428
429 if ($start_file === '') {
430 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cont_no_start_file'), true);
431 } else {
432 $this->object->setStartFile($start_file);
433 $this->object->update();
434 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cont_start_file_set'), true);
435 }
436
437 $this->ctrl->redirectByClass(ilContainerResourceGUI::class);
438 }
439
440 public function showLearningModule(): void
441 {
442 // #9483
443 if ($this->user->getId() !== ANONYMOUS_USER_ID) {
445 $this->user->getId(),
446 $this->object->getId(),
447 $this->object->getRefId(),
448 "htlm"
449 );
450
451 ilLPStatusWrapper::_updateStatus($this->object->getId(), $this->user->getId());
452 }
453
455 $resource = $this->object->getResource();
456
457 if ($resource !== null) {
458 $startfile = $this->object->getStartFile() ?? 'index.html';
459 $uri = $this->irss->consume()->containerURI(
460 $resource->getIdentification(),
461 $startfile,
462 8 * 60
463 )->getURI();
464
465 ilUtil::redirect((string) $uri);
466 } else {
467 // This is a legacy learning module which has not yet been migrated to the new resource storage
468 $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
469
471 if ($startfile !== "") {
472 ilUtil::redirect($startfile);
473 }
474 }
475 }
476
480 public function infoScreen(): void
481 {
482 $this->ctrl->redirectByClass(ilInfoScreenGUI::class, "showSummary");
483 }
484
485 public function showInfoScreen(): void
486 {
487 $this->tabs->activateTab('id_info');
488
489 $this->lng->loadLanguageModule("meta");
490
491 $info = new ilInfoScreenGUI($this);
492 $info->enablePrivateNotes();
493 $info->enableLearningProgress();
494
495 $info->enableNews();
496 if ($this->access->checkAccess("write", "", $this->requested_ref_id)) {
497 $info->enableNewsEditing();
498
499 $news_set = new ilSetting("news");
500 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
501 if ($enable_internal_rss) {
502 $info->setBlockProperty("news", "settings", true);
503 }
504 }
505
506 // add read / back button
507 if ($this->access->checkAccess("read", "", $this->requested_ref_id)) {
508 // #15127
509 $this->gui->link(
510 $this->lng->txt("view"),
511 "ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=" . $this->object->getRefId(),
512 true
513 )->primary()->toToolbar();
514 }
515
516 // show standard meta data section
517 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
518
519 // forward the command
520 $this->ctrl->forwardCommand($info);
521 }
522
523 protected function setTabs(): void
524 {
525 $this->getTabs();
526 $this->setTitleAndDescription();
527 }
528
529 protected function getTabs(): void
530 {
532 $ilHelp = $this->help;
533
534 $ilHelp->setScreenIdComponent("htlm");
535
536 if ($this->access->checkAccess('write', '', $this->ref_id)) {
537 // Depending on whether the module has already been migrated to the IRSS, we add a tab to
538 // ilContainerResourceGUI or internally. internally, it is only indicated that the files cannot be edited.
539 $this->tabs->addTab(
540 "id_list_files",
541 $lng->txt("cont_list_files"),
542 $this->ctrl->getLinkTarget($this, self::CMD_LIST_FILES)
543 );
544 }
545
546 if ($this->access->checkAccess('visible', '', $this->ref_id) && $this->object->isInfoEnabled()) {
547 $this->tabs->addTab(
548 "id_info",
549 $lng->txt("info_short"),
550 $this->ctrl->getLinkTargetByClass([self::class, ilInfoScreenGUI::class], "showSummary")
551 );
552 }
553
554 if ($this->access->checkAccess('write', '', $this->ref_id)) {
555 $this->tabs->addTab(
556 "id_settings",
557 $lng->txt("settings"),
558 $this->ctrl->getLinkTarget($this, "properties")
559 );
560 }
561
562 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
563 $this->tabs->addTab(
564 "id_learning_progress",
565 $lng->txt("learning_progress"),
566 $this->ctrl->getLinkTargetByClass([self::class, ilLearningProgressGUI::class], '')
567 );
568 }
569
570 if ($this->access->checkAccess('write', '', $this->ref_id)) {
571 $mdgui = new ilObjectMetaDataGUI($this->object);
572 $mdtab = $mdgui->getTab();
573 if ($mdtab) {
574 $this->tabs->addTab(
575 "id_meta_data",
576 $lng->txt("meta_data"),
577 $mdtab
578 );
579 }
580 }
581
582 // export
583 if ($this->access->checkAccess("write", "", $this->object->getRefId())) {
584 $this->tabs->addTab(
585 "export",
586 $lng->txt("export"),
587 $this->ctrl->getLinkTargetByClass(ilExportGUI::class, "")
588 );
589 }
590
591 if ($this->access->checkAccess('edit_permission', '', $this->object->getRefId())) {
592 $this->tabs->addTab(
593 "id_permissions",
594 $lng->txt("perm_settings"),
595 $this->ctrl->getLinkTargetByClass([self::class, ilPermissionGUI::class], "perm")
596 );
597 }
598
599 $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
600 if ($startfile !== "" && $this->access->checkAccess('read', '', $this->ref_id)) {
601 $this->tabs->addNonTabbedLink(
602 "presentation_view",
603 $this->lng->txt("glo_presentation_view"),
604 "ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=" . $this->object->getRefId(),
605 "_blank"
606 );
607 }
608 }
609
610 public static function _goto(string $a_target): void
611 {
612 global $DIC;
613 $main_tpl = $DIC->ui()->mainTemplate();
614
615 $lng = $DIC->language();
616 $access = $DIC->access();
617
618 if ($access->checkAccess("read", "", $a_target) ||
619 $access->checkAccess("visible", "", $a_target)) {
620 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
621 } elseif ($access->checkAccess("read", "", ROOT_FOLDER_ID)) {
622 $main_tpl->setOnScreenMessage(
623 'failure',
624 sprintf(
625 $lng->txt("msg_no_perm_read_item"),
627 ),
628 true
629 );
631 }
632
633 throw new ilPermissionException($lng->txt("msg_no_perm_read_lm"));
634 }
635
636 protected function addLocatorItems(): void
637 {
638 $ilLocator = $this->locator;
639
640 if (is_object($this->object)) {
641 $ilLocator->addItem(
642 $this->object->getTitle(),
643 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
644 "",
645 $this->requested_ref_id
646 );
647 }
648 }
649
650 private function listFiles(): void
651 {
652 if ($this->object->getResource() !== null) {
653 $this->ctrl->redirectByClass(ilContainerResourceGUI::class);
654 return;
655 }
656 $this->tabs->activateTab("id_list_files");
657
658 $message_box = $this->gui->ui()->factory()->messageBox()->info(
659 $this->lng->txt("infobox_files_not_migrated")
660 );
661
662 $this->tpl->setContent(
663 $this->gui->ui()->renderer()->render([$message_box])
664 );
665 }
666
667 protected function importFileObject(?int $parent_id = null): void
668 {
669 try {
670 parent::importFileObject();
672 // since there is no manifest xml we assume that this is an HTML export file
673 $this->createFromDirectory($e->getTmpDir());
674 }
675 }
676
677 protected function afterImport(ilObject $new_object): void
678 {
679 $this->ctrl->setParameter($this, "ref_id", $new_object->getRefId());
680 $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_added"), true);
681 $this->ctrl->redirect($this, "properties");
682 }
683
684 public function createFromDirectory(string $a_dir): void
685 {
686 if ($a_dir === "" || !$this->checkPermissionBool("create", "", "htlm")) {
687 throw new ilPermissionException($this->lng->txt("no_create_permission"));
688 }
689
690 // create instance
691 $newObj = new ilObjFileBasedLM();
692 $filename = ilUtil::stripSlashes($_FILES["importfile"]["name"]);
693 $newObj->setTitle($filename);
694 $newObj->setDescription("");
695 $newObj->create();
696 $newObj->populateByDirectoy($a_dir, $filename);
697 $this->putObjectInTree($newObj);
698
699 $this->afterSave($newObj);
700 }
701
702
706
707 public function exportHTML(): void
708 {
710 $this->object->getId(),
711 "html",
712 $this->object->getType()
713 );
714 $export_dir = ilExport::_getExportDirectory(
715 $this->object->getId(),
716 "html",
717 $this->object->getType()
718 );
719
720 $subdir = $this->object->getType() . "_" . $this->object->getId();
721
722 $target_dir = $export_dir . "/" . $subdir;
723
724 ilFileUtils::delDir($target_dir);
725 ilFileUtils::makeDir($target_dir);
726
727 $source_dir = $this->object->getDataDirectory();
728
729 ilFileUtils::rCopy($source_dir, $target_dir);
730
731 // zip it all
732 $date = time();
733 $zip_file = $export_dir . "/" . $date . "__" . IL_INST_ID . "__" .
734 $this->object->getType() . "_" . $this->object->getId() . ".zip";
735 ilFileUtils::zip($target_dir, $zip_file);
736
737 ilFileUtils::delDir($target_dir);
738 }
739
740 public function redirectAfterCreation(): void
741 {
743 $ctrl->setParameterByClass("ilObjFileBasedLMGUI", "ref_id", $this->object->getRefId());
744 $ctrl->redirectByClass(["ilrepositorygui", "ilObjFileBasedLMGUI"], "properties");
745 }
746
747 public function learningProgress(): void
748 {
749 $this->ctrl->redirectByClass("illearningprogressgui", "");
750 }
751
752 public function redrawHeaderAction(): void
753 {
755 }
756
757 public function importFromUploadDir(): void
758 {
759 global $DIC;
760 if (!$this->checkPermissionBool("write", "", "htlm")) {
761 $main_tpl = $DIC->ui()->mainTemplate();
762
763 $main_tpl->setOnScreenMessage(
764 'failure',
765 sprintf(
766 $this->lng->txt("msg_no_perm_write"),
767 ),
768 true
769 );
771 }
772
773 $file = $this->lm_request->getString('form/input_0');
774 $path = $this->getUploadDirectory() . DIRECTORY_SEPARATOR . $file;
775 if ($file === '') {
776 $DIC->ui()->mainTemplate()->setOnScreenMessage(
777 'failure',
778 $this->lng->txt('import_from_upload_dir_info'),
779 true
780 );
781 } elseif (str_starts_with(realpath($path), $this->getUploadDirectory())) {
782 $this->irss->manageContainer()->addStreamToContainer(
783 $this->object->getResource()->getIdentification(),
784 Streams::ofResource(fopen($path, 'rb')),
785 $file
786 );
787 $DIC->ui()->mainTemplate()->setOnScreenMessage(
788 'success',
789 $this->lng->txt('file_imported_from_upload_dir'),
790 true
791 );
792 } else {
793 $DIC->ui()->mainTemplate()->setOnScreenMessage(
794 'failure',
795 $this->lng->txt('file_import_from_upload_dir_failed'),
796 true
797 );
798 }
799
800 $this->ctrl->setParameterByClass("ilObjFileBasedLMGUI", "ref_id", $this->object->getRefId());
801 $this->ctrl->redirectByClass(["ilrepositorygui", "ilObjFileBasedLMGUI", "ilContainerResourceGUI"]);
802 }
803
804 public function getUploadDirectory(): string
805 {
806 $lm_set = new ilSetting("lm");
807 $upload_dir = $lm_set->get("cont_upload_dir");
808
809 $import_file_factory = new ilImportDirectoryFactory();
810 try {
811 $import_directory = $import_file_factory->getInstanceForComponent(ilImportDirectoryFactory::TYPE_SAHS);
812 } catch (InvalidArgumentException $e) {
813 return '';
814 }
815 return $import_directory->getAbsolutePath();
816 }
817
818 public function getUploadFiles(): array
819 {
820 if (!$upload_dir = $this->getUploadDirectory()) {
821 return array();
822 }
823
824 // get the sorted content of the upload directory
825 $handle = opendir($upload_dir);
826 $files = array();
827 while (false !== ($file = readdir($handle))) {
828 $full_path = $upload_dir . "/" . $file;
829 if (is_file($full_path) and is_readable($full_path)) {
830 $files[] = $file;
831 }
832 }
833 closedir($handle);
834 sort($files);
835
836 return $files;
837 }
838
839}
$filename
Definition: buildRTE.php:78
Stream factory which enables the user to create streams without the knowledge of the concrete class.
Definition: Streams.php:32
error(string $a_errmsg)
This class represents a checkbox property in a property form.
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.
This class represents a section header in a property form.
Help GUI class.
setScreenIdComponent(string $a_comp)
Class ilInfoScreenGUI.
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
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.
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
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
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.
ilAccessHandler $access
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="")
ilLocatorGUI $locator
prepareOutput(bool $show_sub_objects=true)
ilLanguage $lng
updateObject()
updates object entry in object_data
redrawHeaderActionObject()
Ajax call: redraw action header only.
Class ilObjectMetaDataGUI.
static updateServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
static initServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
Class ilObject Basic functions for all objects.
const TITLE_LENGTH
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This class represents a property form user interface.
ILIAS Setting Class.
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)
const IL_INST_ID
Definition: constants.php:40
const ANONYMOUS_USER_ID
Definition: constants.php:27
const ROOT_FOLDER_ID
Definition: constants.php:32
$info
Definition: entry_point.php:21
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)
$path
Definition: ltiservices.php:30
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
form( $class_path, string $cmd, string $submit_caption="")
global $DIC
Definition: shib_login.php:26
$lm_set