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");
276 $this->setTabs(
false);
278 $form = $this->initEditForm();
279 $this->tpl->setContent($form->getHTML());
288 $ilCtrl = $this->ctrl;
295 if ($a_mode !=
"add_file") {
298 $ti->setMaxLength(80);
305 $si->setOptions(
$lang);
309 if (in_array($a_mode, array(
"create",
"add_file"))) {
312 $fi->setRequired(
true);
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"));
363 if ($this->getCurrentTextLang() !=
"") {
364 $s_lang = $this->getCurrentTextLang();
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));
392 $form = $this->initEditForm(
"edit");
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
413 $ilToolbar = $this->toolbar;
414 $ilCtrl = $this->ctrl;
417 $this->setTabs(
false);
419 $ilToolbar->addButton(
420 $lng->txt(
"cont_add_file"),
421 $ilCtrl->getLinkTarget($this,
"addFileItem")
425 $fl = $this->content_obj;
427 $tpl->setContent($table_gui->getHTML());
433 public function setTabs(
bool $a_create =
true): void
435 $ilTabs = $this->tabs;
436 $ilCtrl = $this->ctrl;
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"),
496 $ilCtrl = $this->ctrl;
498 $files = $this->content_obj->getFileList();
500 if (count($files) >= 1) {
501 $ilCtrl->setParameterByClass(
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");
522 $ilCtrl = $this->ctrl;
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");
537 $ilCtrl = $this->ctrl;
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");
552 $ilCtrl = $this->ctrl;
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");
572 $chars = $this->getCharacteristics();
574 $classes = $this->content_obj->getAllClasses();
575 if (count($chars) > 1) {
578 foreach ($classes as $class) {
579 if ($class !=
"" && $class !=
"FileListItem") {
597 $ilTabs = $this->tabs;
599 $sub_command = $this->sub_command;
600 if (in_array($sub_command, [
"insertNew",
"insertFromRepository",
"insertFromWorkspace"])) {
601 $this->edit_repo->setSubCmd($sub_command);
604 if (($sub_command ==
"") && $this->edit_repo->getSubCmd() !=
"") {
605 $sub_command = $this->edit_repo->getSubCmd();
608 switch ($sub_command) {
609 case "insertFromWorkspace":
610 $this->insertFromWorkspace(
"newFileItem");
613 case "insertFromRepository":
614 $this->insertFromRepository(
"newFileItem");
618 $this->insertNewFileItem($this->requested_file_ref_id);
622 $this->setItemTabs(
"newFileItem");
623 $ilTabs->setSubTabActive(
"cont_new_file");
625 $this->displayValidationError();
627 $form = $this->initEditForm(
"add_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) {
652 $file_obj = $this->createFileItem();
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");
671 $this->newFileItem();
683 if ($_FILES[
"file"][
"name"] ==
"") {
687 $form = $this->initEditForm();
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"]
719 $ilTabs = $this->tabs;
720 $ilCtrl = $this->ctrl;
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",
"");
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...
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.
setItemTabs(string $a_cmd="")
output tabs
savePositions()
Save positions of file items.
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.
edit()
edit properties form
__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
insert(ilPropertyFormGUI $a_form=null)
insert new file list form
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc