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");
279 $this->tpl->setContent($form->getHTML());
295 if ($a_mode !=
"add_file") {
298 $ti->setMaxLength(80);
305 $si->setOptions(
$lang);
309 if (in_array($a_mode, array(
"create",
"add_file"))) {
314 } elseif (in_array($a_mode, array(
"select_file"))) {
318 $file_ref_id = (
int) $this->requested_file_ref_id;
319 $fl_wsp_id = $this->request->getInt(
"fl_wsp_id");
321 if ($file_ref_id > 0) {
323 if (is_object($file_obj)) {
326 $hi->setValue($file_ref_id);
329 $ne->setValue($file_obj->getTitle());
331 } elseif ($fl_wsp_id > 0) {
336 $file_obj =
new ilObjFile($node[
"obj_id"],
false);
337 if (is_object($file_obj)) {
340 $hi->setValue(
"wsp_" . (
int) $node[
"obj_id"]);
343 $ne->setValue($file_obj->getTitle());
345 $this->tpl->parseCurrentBlock();
354 $ti->setValue($this->content_obj->getListTitle());
355 $si->setValue($this->content_obj->getLanguage());
356 $form->addCommandButton(
"saveProperties",
$lng->
txt(
"save"));
357 $form->addCommandButton(
"cancelUpdate",
$lng->
txt(
"cancel"));
358 $form->setTitle(
$lng->
txt(
"cont_edit_file_list_properties"));
366 $s_lang =
$ilUser->getLanguage();
368 $si->setValue($s_lang);
369 $form->addCommandButton(
"create_flst",
$lng->
txt(
"save"));
370 $form->addCommandButton(
"cancelCreate",
$lng->
txt(
"cancel"));
371 $form->setTitle(
$lng->
txt(
"cont_insert_file_list"));
375 $form->addCommandButton(
"insertNewFileItem",
$lng->
txt(
"save"));
376 $form->addCommandButton(
"editFiles",
$lng->
txt(
"cancel"));
377 $form->setTitle(
$lng->
txt(
"cont_insert_file_item"));
381 $form->setFormAction($ilCtrl->getFormAction($this));
394 $this->content_obj->setListTitle(
395 $form->getInput(
"flst_title"),
396 $form->getInput(
"flst_language")
398 $this->updated = $this->pg_obj->update();
399 if ($this->updated ===
true) {
400 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
402 $this->pg_obj->addHierIDs();
410 public function editFiles():
void 419 $ilToolbar->addButton(
421 $ilCtrl->getLinkTarget($this,
"addFileItem")
433 public function setTabs(
bool $a_create =
true): void
443 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
444 $ilTabs->addSubTabTarget(
446 $ilCtrl->getLinkTarget($this, $cmd),
450 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
451 $ilTabs->addSubTabTarget(
452 "cont_file_from_repository",
453 $ilCtrl->getLinkTarget($this, $cmd),
456 $ilCtrl->setParameter($this,
"subCmd",
"");
458 if (!
$ilSetting->get(
"disable_personal_workspace") &&
460 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
461 $ilTabs->addSubTabTarget(
462 "cont_file_from_workspace",
463 $ilCtrl->getLinkTarget($this, $cmd),
466 $ilCtrl->setParameter($this,
"subCmd",
"");
469 $ilTabs->setBackTarget(
471 $this->
ctrl->getParentReturn($this)
475 "cont_ed_edit_files",
476 $ilCtrl->getLinkTarget($this,
"editFiles"),
483 $ilCtrl->getLinkTarget($this,
"edit"),
498 $files = $this->content_obj->getFileList();
500 if (count($files) >= 1) {
504 $files[count($files) - 1][
"hier_id"]
506 $ilCtrl->setParameterByClass(
509 $files[count($files) - 1][
"pc_id"]
511 $ilCtrl->redirectByClass(
"ilpcfileitemgui",
"newItemAfter");
513 $ilCtrl->redirect($this,
"newFileItem");
524 $fid = $this->request->getIntArray(
"fid");
525 if (count($fid) > 0) {
526 $this->content_obj->deleteFileItems(array_keys($fid));
528 $this->updated = $this->pg_obj->update();
529 $ilCtrl->
redirect($this,
"editFiles");
539 $pos = $this->request->getIntArray(
"position");
540 if (count($pos) > 0) {
541 $this->content_obj->savePositions($pos);
543 $this->updated = $this->pg_obj->update();
544 $ilCtrl->
redirect($this,
"editFiles");
554 $pos = $this->request->getIntArray(
"position");
555 $class = $this->request->getStringArray(
"class");
556 if (count($pos) > 0) {
557 $this->content_obj->savePositions($pos);
559 if (count($class) > 0) {
560 $this->content_obj->saveStyleClasses($class);
562 $this->updated = $this->pg_obj->update();
563 $ilCtrl->
redirect($this,
"editFiles");
574 $classes = $this->content_obj->getAllClasses();
578 foreach ($classes as $class) {
579 if ($class !=
"" && $class !=
"FileListItem") {
600 if (in_array(
$sub_command, [
"insertNew",
"insertFromRepository",
"insertFromWorkspace"])) {
604 if ((
$sub_command ==
"") && $this->edit_repo->getSubCmd() !=
"") {
609 case "insertFromWorkspace":
613 case "insertFromRepository":
623 $ilTabs->setSubTabActive(
"cont_new_file");
628 $this->tpl->setContent($form->getHTML());
640 $fl_wsp_id = $this->request->getInt(
"fl_wsp_id");
643 if ($fl_wsp_id > 0) {
648 $file_obj =
new ilObjFile($node[
"obj_id"],
false);
651 elseif ($a_file_ref_id == 0) {
656 $file_obj =
new ilObjFile($a_file_ref_id);
658 if (is_object($file_obj)) {
659 $this->content_obj->appendItem(
661 $file_obj->getTitle(),
662 $file_obj->getFileType()
664 $this->updated = $this->pg_obj->update();
665 if ($this->updated ===
true) {
667 $this->
ctrl->redirect($this,
"editFiles");
683 if ($_FILES[
"file"][
"name"] ==
"") {
692 $fileObj->setType(
"file");
693 $fileObj->setTitle($_FILES[
"file"][
"name"]);
694 $fileObj->setDescription(
"");
695 $fileObj->setFileName($_FILES[
"file"][
"name"]);
696 $fileObj->setMode(
"filelist");
700 $upload = $DIC->upload();
701 if ($upload->hasBeenProcessed() !==
true) {
705 $fileObj->getUploadFile(
706 $_FILES[
"file"][
"tmp_name"],
707 $_FILES[
"file"][
"name"]
725 $this->
ctrl->getParentReturn($this),
731 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
732 $ilTabs->addSubTabTarget(
734 $ilCtrl->getLinkTarget($this, $a_cmd),
738 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
739 $ilTabs->addSubTabTarget(
740 "cont_file_from_repository",
741 $ilCtrl->getLinkTarget($this, $a_cmd),
744 $ilCtrl->setParameter($this,
"subCmd",
"");
746 if (!
$ilSetting->get(
"disable_personal_workspace") &&
748 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
749 $ilTabs->addSubTabTarget(
750 "cont_file_from_workspace",
751 $ilCtrl->getLinkTarget($this, $a_cmd),
754 $ilCtrl->setParameter($this,
"subCmd",
"");
ilPageContent $content_obj
edit()
edit properties form
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)
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...
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...
__construct(Container $dic, ilPlugin $plugin)
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.