42 $this->
user = $DIC->user();
43 $this->
tabs = $DIC->tabs();
44 $this->
ctrl = $DIC->ctrl();
45 $this->tpl = $DIC[
"tpl"];
46 $this->tree = $DIC->repositoryTree();
47 $this->
lng = $DIC->language();
48 $this->
toolbar = $DIC->toolbar();
52 $this->requested_file_ref_id = $this->request->getString(
"file_ref_id");
61 $next_class = $this->
ctrl->getNextClass($this);
66 $cmd = $this->
ctrl->getCmd();
68 switch ($next_class) {
83 if (in_array(
$sub_command, [
"insertNew",
"insertFromRepository",
"insertFromWorkspace"])) {
87 if ((
$sub_command ==
"") && $this->edit_repo->getSubCmd() !=
"") {
92 case "insertFromWorkspace":
96 case "insertFromRepository":
106 $ilTabs->setSubTabActive(
"cont_new_file");
110 if ($a_form != null) {
115 $this->tpl->setContent($form->getHTML());
124 $ilTabs->setSubTabActive(
"cont_file_from_repository");
129 $this->tpl->setContent($form->getHTML());
141 if ($a_cmd ==
"insert") {
147 $ilTabs->setSubTabActive(
"cont_file_from_repository");
148 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
157 if (!$exp->handleCommand()) {
166 string $a_cmd =
"insert" 173 if ($a_cmd ==
"insert") {
179 $ilTabs->setSubTabActive(
"cont_file_from_workspace");
182 $ilCtrl->setParameter($this,
"subCmd",
"selectFile");
184 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
185 $exp->setTypeWhiteList(array(
"wsrt",
"wfld",
"file"));
186 $exp->setSelectableTypes(array(
"file"));
187 if ($exp->handleCommand()) {
200 $mode = ($this->requested_file_ref_id !=
"")
204 if (!$form->checkInput()) {
205 $form->setValuesByPost();
211 if (substr($this->requested_file_ref_id, 0, 4) ==
"wsp_") {
212 $fileObj =
new ilObjFile(substr($this->requested_file_ref_id, 4),
false);
215 elseif ($this->requested_file_ref_id ==
"") {
217 $fileObj->setType(
"file");
218 $fileObj->setTitle($_FILES[
"file"][
"name"]);
219 $fileObj->setDescription(
"");
220 $fileObj->setFileName($_FILES[
"file"][
"name"]);
221 $fileObj->setMode(
"filelist");
225 $upload = $DIC->upload();
226 if ($upload->hasBeenProcessed() !==
true) {
230 $fileObj->getUploadFile(
231 $_FILES[
"file"][
"tmp_name"],
232 $_FILES[
"file"][
"name"]
237 $fileObj =
new ilObjFile($this->requested_file_ref_id);
243 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
244 $this->content_obj->setListTitle(
245 $form->getInput(
"flst_title"),
246 $form->getInput(
"flst_language")
248 $this->content_obj->appendItem(
250 $fileObj->getFileName(),
251 $fileObj->getFileType()
254 $this->updated = $this->pg_obj->update();
255 if ($this->updated ===
true) {
264 $this->pg_obj->stripHierIDs();
265 $this->pg_obj->addHierIDs();
266 $this->
ctrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
267 $this->
ctrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
268 $this->
ctrl->redirect($this,
"editFiles");
284 $this->tpl->setContent($form->getHTML());
300 if ($a_mode !=
"add_file") {
303 $ti->setMaxLength(80);
314 if (in_array($a_mode, array(
"create",
"add_file"))) {
319 } elseif (in_array($a_mode, array(
"select_file"))) {
323 $file_ref_id = (
int) $this->requested_file_ref_id;
324 $fl_wsp_id = $this->request->getInt(
"fl_wsp_id");
326 if ($file_ref_id > 0) {
328 if (is_object($file_obj)) {
331 $hi->setValue($file_ref_id);
334 $ne->setValue($file_obj->getTitle());
336 } elseif ($fl_wsp_id > 0) {
341 $file_obj =
new ilObjFile($node[
"obj_id"],
false);
342 if (is_object($file_obj)) {
345 $hi->setValue(
"wsp_" . (
int) $node[
"obj_id"]);
348 $ne->setValue($file_obj->getTitle());
350 $this->tpl->parseCurrentBlock();
359 $ti->setValue($this->content_obj->getListTitle());
360 $si->setValue($this->content_obj->getLanguage());
361 $form->addCommandButton(
"saveProperties",
$lng->
txt(
"save"));
362 $form->addCommandButton(
"cancelUpdate",
$lng->
txt(
"cancel"));
363 $form->setTitle(
$lng->
txt(
"cont_edit_file_list_properties"));
371 $s_lang = $ilUser->getLanguage();
373 $si->setValue($s_lang);
374 $form->addCommandButton(
"create_flst",
$lng->
txt(
"save"));
375 $form->addCommandButton(
"cancelCreate",
$lng->
txt(
"cancel"));
376 $form->setTitle(
$lng->
txt(
"cont_insert_file_list"));
380 $form->addCommandButton(
"insertNewFileItem",
$lng->
txt(
"save"));
381 $form->addCommandButton(
"editFiles",
$lng->
txt(
"cancel"));
382 $form->setTitle(
$lng->
txt(
"cont_insert_file_item"));
386 $form->setFormAction($ilCtrl->getFormAction($this));
399 $this->content_obj->setListTitle(
400 $form->getInput(
"flst_title"),
401 $form->getInput(
"flst_language")
403 $this->updated = $this->pg_obj->update();
404 if ($this->updated ===
true) {
405 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
406 $this->
ctrl->redirect($this,
"editProperties");
408 $this->pg_obj->addHierIDs();
416 public function editFiles():
void 424 $this->
tabs->activateTab(
"cont_ed_edit_files");
426 $ilToolbar->addButton(
428 $ilCtrl->getLinkTarget($this,
"addFileItem")
440 public function setTabs(
bool $a_create =
true): void
450 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
451 $ilTabs->addSubTabTarget(
453 $ilCtrl->getLinkTarget($this, $cmd),
457 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
458 $ilTabs->addSubTabTarget(
459 "cont_file_from_repository",
460 $ilCtrl->getLinkTarget($this, $cmd),
463 $ilCtrl->setParameter($this,
"subCmd",
"");
465 if (!
$ilSetting->get(
"disable_personal_workspace") &&
467 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
468 $ilTabs->addSubTabTarget(
469 "cont_file_from_workspace",
470 $ilCtrl->getLinkTarget($this, $cmd),
473 $ilCtrl->setParameter($this,
"subCmd",
"");
476 $ilTabs->setBackTarget(
478 $this->
ctrl->getParentReturn($this)
482 "cont_ed_edit_files",
483 $ilCtrl->getLinkTarget($this,
"editFiles"),
490 $ilCtrl->getLinkTarget($this,
"editProperties"),
505 $files = $this->content_obj->getFileList();
507 if (count($files) >= 1) {
511 $files[count($files) - 1][
"hier_id"]
513 $ilCtrl->setParameterByClass(
516 $files[count($files) - 1][
"pc_id"]
518 $ilCtrl->redirectByClass(
"ilpcfileitemgui",
"newItemAfter");
520 $ilCtrl->redirect($this,
"newFileItem");
531 $fid = $this->request->getIntArray(
"fid");
532 if (count($fid) > 0) {
533 $this->content_obj->deleteFileItems(array_keys($fid));
535 $this->updated = $this->pg_obj->update();
536 $ilCtrl->
redirect($this,
"editFiles");
546 $pos = $this->request->getIntArray(
"position");
547 if (count($pos) > 0) {
548 $this->content_obj->savePositions($pos);
550 $this->updated = $this->pg_obj->update();
551 $ilCtrl->
redirect($this,
"editFiles");
561 $pos = $this->request->getIntArray(
"position");
562 $class = $this->request->getStringArray(
"class");
563 if (count($pos) > 0) {
564 $this->content_obj->savePositions($pos);
566 if (count($class) > 0) {
567 $this->content_obj->saveStyleClasses($class);
569 $this->updated = $this->pg_obj->update();
570 $ilCtrl->
redirect($this,
"editFiles");
581 $classes = $this->content_obj->getAllClasses();
585 foreach ($classes as $class) {
586 if ($class !=
"" && $class !=
"FileListItem") {
607 if (in_array(
$sub_command, [
"insertNew",
"insertFromRepository",
"insertFromWorkspace"])) {
611 if ((
$sub_command ==
"") && $this->edit_repo->getSubCmd() !=
"") {
616 case "insertFromWorkspace":
620 case "insertFromRepository":
630 $ilTabs->setSubTabActive(
"cont_new_file");
635 $this->tpl->setContent($form->getHTML());
647 $fl_wsp_id = $this->request->getInt(
"fl_wsp_id");
650 if ($fl_wsp_id > 0) {
655 $file_obj =
new ilObjFile($node[
"obj_id"],
false);
658 elseif ($a_file_ref_id == 0) {
663 $file_obj =
new ilObjFile($a_file_ref_id);
665 if (is_object($file_obj)) {
666 $this->content_obj->appendItem(
668 $file_obj->getTitle(),
669 $file_obj->getFileType()
671 $this->updated = $this->pg_obj->update();
672 if ($this->updated ===
true) {
674 $this->
ctrl->redirect($this,
"editFiles");
690 if ($_FILES[
"file"][
"name"] ==
"") {
699 $fileObj->setType(
"file");
700 $fileObj->setTitle($_FILES[
"file"][
"name"]);
701 $fileObj->setDescription(
"");
702 $fileObj->setFileName($_FILES[
"file"][
"name"]);
703 $fileObj->setMode(
"filelist");
707 $upload = $DIC->upload();
708 if ($upload->hasBeenProcessed() !==
true) {
712 $fileObj->getUploadFile(
713 $_FILES[
"file"][
"tmp_name"],
714 $_FILES[
"file"][
"name"]
732 $this->
ctrl->getParentReturn($this),
738 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
739 $ilTabs->addSubTabTarget(
741 $ilCtrl->getLinkTarget($this, $a_cmd),
745 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
746 $ilTabs->addSubTabTarget(
747 "cont_file_from_repository",
748 $ilCtrl->getLinkTarget($this, $a_cmd),
751 $ilCtrl->setParameter($this,
"subCmd",
"");
753 if (!
$ilSetting->get(
"disable_personal_workspace") &&
755 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
756 $ilTabs->addSubTabTarget(
757 "cont_file_from_workspace",
758 $ilCtrl->getLinkTarget($this, $a_cmd),
761 $ilCtrl->setParameter($this,
"subCmd",
"");
ilPageContent $content_obj
newFileItem()
New file item (called, if there is no file item in an existing)
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
getCharacteristicsOfCurrentStyle(array $a_type)
Get characteristics of current style and call setCharacteristics, if style is given.
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...
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
__construct(ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
createFileItem()
insert new file item
setTabs(bool $a_create=true)
Set Tabs.
deleteFileItem()
Delete file items from list.
insertFromRepository(string $a_cmd="insert")
Insert file from repository.
insertFromWorkspace(string $a_cmd="insert")
Insert file from personal workspace.
setParameterByClass(string $a_class, string $a_parameter, $a_value)
setCharacteristics(array $a_chars)
Content object of ilPageObject (see ILIAS DTD).
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
editProperties()
edit properties form
insertNewFileItem(int $a_file_ref_id=0)
insert new file item after another item
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
executeCommand()
execute command
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
Explorer for selecting a personal workspace item.
ilGlobalTemplateInterface $tpl
setItemTabs(string $a_cmd="")
output tabs
setCurrentTextLang(string $lang_key)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
string $requested_file_ref_id
checkStyleSelection()
Checks whether style selection shoudl be available or not.
setCustomLinkTarget(string $a_val)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initEditForm(string $a_mode="edit")
Init edit form.
create()
create new file list in dom and update page in db
insert(ilPropertyFormGUI $a_form=null)
insert new file list form
saveProperties()
save table properties in db and return to page edit screen
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
savePositionsAndClasses()
Save positions of file items and style classes.
addFileItem()
Add file item.
savePositions()
Save positions of file items.