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"
168 $ilTabs = $this->
tabs;
173 if ($a_cmd ==
"insert") {
179 $ilTabs->setSubTabActive(
"cont_file_from_workspace");
182 $ilCtrl->setParameter($this,
"subCmd",
"selectFile");
183 $exp->setCustomLinkTarget($ilCtrl->getLinkTarget($this, $a_cmd));
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 !=
"")
203 $form = $this->initEditForm($mode);
204 if (!$form->checkInput()) {
205 $form->setValuesByPost();
206 $this->insert($form);
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);
239 $this->setCurrentTextLang($form->getInput(
"flst_language"));
242 $this->content_obj =
new ilPCFileList($this->getPage());
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) {
256 $this->afterCreation();
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");
281 $this->setTabs(
false);
283 $form = $this->initEditForm();
284 $this->tpl->setContent($form->getHTML());
293 $ilCtrl = $this->ctrl;
294 $ilUser = $this->user;
300 if ($a_mode !=
"add_file") {
303 $ti->setMaxLength(80);
309 foreach ($this->lom_services->dataHelper()->getAllLanguages() as $language) {
310 $languages[$language->value()] = $language->presentableLabel();
313 $si->setOptions($languages);
317 if (in_array($a_mode, array(
"create",
"add_file"))) {
320 $fi->setRequired(
true);
322 } elseif (in_array($a_mode, array(
"select_file"))) {
326 $file_ref_id = (
int) $this->requested_file_ref_id;
327 $fl_wsp_id = $this->request->getInt(
"fl_wsp_id");
329 if ($file_ref_id > 0) {
331 if (is_object($file_obj)) {
334 $hi->setValue($file_ref_id);
337 $ne->setValue($file_obj->getTitle());
339 } elseif ($fl_wsp_id > 0) {
344 $file_obj =
new ilObjFile($node[
"obj_id"],
false);
345 if (is_object($file_obj)) {
348 $hi->setValue(
"wsp_" . (
int) $node[
"obj_id"]);
351 $ne->setValue($file_obj->getTitle());
353 $this->tpl->parseCurrentBlock();
362 $ti->setValue($this->content_obj->getListTitle());
363 $si->setValue($this->content_obj->getLanguage());
364 $form->addCommandButton(
"saveProperties",
$lng->txt(
"save"));
365 $form->addCommandButton(
"cancelUpdate",
$lng->txt(
"cancel"));
366 $form->setTitle(
$lng->txt(
"cont_edit_file_list_properties"));
371 if ($this->getCurrentTextLang() !=
"") {
372 $s_lang = $this->getCurrentTextLang();
374 $s_lang = $ilUser->getLanguage();
376 $si->setValue($s_lang);
377 $form->addCommandButton(
"create",
$lng->txt(
"save"));
378 $form->addCommandButton(
"cancelCreate",
$lng->txt(
"cancel"));
379 $form->setTitle(
$lng->txt(
"cont_insert_file_list"));
383 $form->addCommandButton(
"insertNewFileItem",
$lng->txt(
"save"));
384 $form->addCommandButton(
"editFiles",
$lng->txt(
"cancel"));
385 $form->setTitle(
$lng->txt(
"cont_insert_file_item"));
389 $form->setFormAction($ilCtrl->getFormAction($this));
400 $form = $this->initEditForm(
"edit");
402 $this->content_obj->setListTitle(
403 $form->getInput(
"flst_title"),
404 $form->getInput(
"flst_language")
406 $this->updated = $this->pg_obj->update();
407 if ($this->updated ===
true) {
408 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
409 $this->
ctrl->redirect($this,
"editProperties");
411 $this->pg_obj->addHierIDs();
419 public function editFiles(): void
422 $ilToolbar = $this->toolbar;
423 $ilCtrl = $this->ctrl;
426 $this->setTabs(
false);
427 $this->
tabs->activateTab(
"cont_ed_edit_files");
429 $ilToolbar->addButton(
430 $lng->txt(
"cont_add_file"),
431 $ilCtrl->getLinkTarget($this,
"addFileItem")
435 $fl = $this->content_obj;
437 $tpl->setContent($table_gui->getHTML());
443 public function setTabs(
bool $a_create =
true): void
445 $ilTabs = $this->tabs;
446 $ilCtrl = $this->ctrl;
453 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
454 $ilTabs->addSubTabTarget(
456 $ilCtrl->getLinkTarget($this, $cmd),
460 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
461 $ilTabs->addSubTabTarget(
462 "cont_file_from_repository",
463 $ilCtrl->getLinkTarget($this, $cmd),
466 $ilCtrl->setParameter($this,
"subCmd",
"");
468 if (!
$ilSetting->get(
"disable_personal_workspace") &&
470 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
471 $ilTabs->addSubTabTarget(
472 "cont_file_from_workspace",
473 $ilCtrl->getLinkTarget($this, $cmd),
476 $ilCtrl->setParameter($this,
"subCmd",
"");
479 $ilTabs->setBackTarget(
481 $this->ctrl->getParentReturn($this)
485 "cont_ed_edit_files",
486 $ilCtrl->getLinkTarget($this,
"editFiles"),
493 $ilCtrl->getLinkTarget($this,
"editProperties"),
506 $ilCtrl = $this->ctrl;
508 $files = $this->content_obj->getFileList();
510 if (count($files) >= 1) {
511 $ilCtrl->setParameterByClass(
514 $files[count($files) - 1][
"hier_id"]
516 $ilCtrl->setParameterByClass(
519 $files[count($files) - 1][
"pc_id"]
521 $ilCtrl->redirectByClass(
"ilpcfileitemgui",
"newItemAfter");
523 $ilCtrl->redirect($this,
"newFileItem");
532 $ilCtrl = $this->ctrl;
534 $fid = $this->request->getIntArray(
"fid");
535 if (count($fid) > 0) {
536 $this->content_obj->deleteFileItems(array_keys($fid));
538 $this->updated = $this->pg_obj->update();
539 $ilCtrl->redirect($this,
"editFiles");
547 $ilCtrl = $this->ctrl;
549 $pos = $this->request->getIntArray(
"position");
550 if (count($pos) > 0) {
551 $this->content_obj->savePositions($pos);
553 $this->updated = $this->pg_obj->update();
554 $ilCtrl->redirect($this,
"editFiles");
562 $ilCtrl = $this->ctrl;
564 $pos = $this->request->getIntArray(
"position");
565 $class = $this->request->getStringArray(
"class");
566 if (count($pos) > 0) {
567 $this->content_obj->savePositions($pos);
569 if (count($class) > 0) {
570 $this->content_obj->saveStyleClasses($class);
572 $this->updated = $this->pg_obj->update();
573 $ilCtrl->redirect($this,
"editFiles");
582 $chars = $this->getCharacteristics();
584 $classes = $this->content_obj->getAllClasses();
585 if (count($chars) > 1) {
588 foreach ($classes as $class) {
589 if ($class !=
"" && $class !=
"FileListItem") {
607 $ilTabs = $this->tabs;
609 $sub_command = $this->sub_command;
610 if (in_array($sub_command, [
"insertNew",
"insertFromRepository",
"insertFromWorkspace"])) {
611 $this->edit_repo->setSubCmd($sub_command);
614 if (($sub_command ==
"") && $this->edit_repo->getSubCmd() !=
"") {
615 $sub_command = $this->edit_repo->getSubCmd();
618 switch ($sub_command) {
619 case "insertFromWorkspace":
620 $this->insertFromWorkspace(
"newFileItem");
623 case "insertFromRepository":
624 $this->insertFromRepository(
"newFileItem");
628 $this->insertNewFileItem($this->requested_file_ref_id);
632 $this->setItemTabs(
"newFileItem");
633 $ilTabs->setSubTabActive(
"cont_new_file");
635 $this->displayValidationError();
637 $form = $this->initEditForm(
"add_file");
638 $this->tpl->setContent($form->getHTML());
648 $ilUser = $this->user;
650 $fl_wsp_id = $this->request->getInt(
"fl_wsp_id");
653 if ($fl_wsp_id > 0) {
658 $file_obj =
new ilObjFile($node[
"obj_id"],
false);
661 elseif ($a_file_ref_id == 0) {
662 $file_obj = $this->createFileItem();
666 $file_obj =
new ilObjFile($a_file_ref_id);
668 if (is_object($file_obj)) {
669 $this->content_obj->appendItem(
671 $file_obj->getTitle(),
672 $file_obj->getFileType()
674 $this->updated = $this->pg_obj->update();
675 if ($this->updated ===
true) {
677 $this->
ctrl->redirect($this,
"editFiles");
681 $this->newFileItem();
693 if ($_FILES[
"file"][
"name"] ==
"") {
697 $form = $this->initEditForm();
702 $fileObj->setType(
"file");
703 $fileObj->setTitle($_FILES[
"file"][
"name"]);
704 $fileObj->setDescription(
"");
705 $fileObj->setFileName($_FILES[
"file"][
"name"]);
706 $fileObj->setMode(
"filelist");
710 $upload =
$DIC->upload();
711 if ($upload->hasBeenProcessed() !==
true) {
715 $fileObj->getUploadFile(
716 $_FILES[
"file"][
"tmp_name"],
717 $_FILES[
"file"][
"name"]
729 $ilTabs = $this->tabs;
730 $ilCtrl = $this->ctrl;
735 $this->
ctrl->getParentReturn($this),
741 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
742 $ilTabs->addSubTabTarget(
744 $ilCtrl->getLinkTarget($this, $a_cmd),
748 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
749 $ilTabs->addSubTabTarget(
750 "cont_file_from_repository",
751 $ilCtrl->getLinkTarget($this, $a_cmd),
754 $ilCtrl->setParameter($this,
"subCmd",
"");
756 if (!
$ilSetting->get(
"disable_personal_workspace") &&
758 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
759 $ilTabs->addSubTabTarget(
760 "cont_file_from_workspace",
761 $ilCtrl->getLinkTarget($this, $a_cmd),
764 $ilCtrl->setParameter($this,
"subCmd",
"");
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a non editable value in a property form.
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.
insertNewFileItem(int $a_file_ref_id=0)
insert new file item after another item
executeCommand()
execute command
addFileItem()
Add file item.
newFileItem()
New file item (called, if there is no file item in an existing)
setTabs(bool $a_create=true)
Set Tabs.
insert(?ilPropertyFormGUI $a_form=null)
insert new file list form
setItemTabs(string $a_cmd="")
output tabs
savePositions()
Save positions of file items.
editProperties()
edit properties form
savePositionsAndClasses()
Save positions of file items and style classes.
checkStyleSelection()
Checks whether style selection shoudl be available or not.
saveProperties()
save table properties in db and return to page edit screen
insertFromWorkspace(string $a_cmd="insert")
Insert file from personal workspace.
__construct(ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
create()
create new file list in dom and update page in db
deleteFileItem()
Delete file items from list.
createFileItem()
insert new file item
string $requested_file_ref_id
insertFromRepository(string $a_cmd="insert")
Insert file from repository.
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...
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
getCharacteristicsOfCurrentStyle(array $a_type)
Get characteristics of current style and call setCharacteristics, if style is given.
ilGlobalTemplateInterface $tpl
setCharacteristics(array $a_chars)
Content object of ilPageObject (see ILIAS DTD).
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text property in a property form.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
Explorer for selecting a personal workspace item.
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.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc