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);
309 foreach ($this->lom_services->dataHelper()->getAllLanguages() as $language) {
310 $languages[$language->value()] = $language->presentableLabel();
317 if (in_array($a_mode, array(
"create",
"add_file"))) {
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"));
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));
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 427 $this->
tabs->activateTab(
"cont_ed_edit_files");
429 $ilToolbar->addButton(
431 $ilCtrl->getLinkTarget($this,
"addFileItem")
443 public function setTabs(
bool $a_create =
true): void
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"),
508 $files = $this->content_obj->getFileList();
510 if (count($files) >= 1) {
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");
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");
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");
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");
584 $classes = $this->content_obj->getAllClasses();
588 foreach ($classes as $class) {
589 if ($class !=
"" && $class !=
"FileListItem") {
610 if (in_array(
$sub_command, [
"insertNew",
"insertFromRepository",
"insertFromWorkspace"])) {
614 if ((
$sub_command ==
"") && $this->edit_repo->getSubCmd() !=
"") {
619 case "insertFromWorkspace":
623 case "insertFromRepository":
633 $ilTabs->setSubTabActive(
"cont_new_file");
638 $this->tpl->setContent($form->getHTML());
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) {
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");
693 if ($_FILES[
"file"][
"name"] ==
"") {
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"]
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",
"");
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...
__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.
insert(?ilPropertyFormGUI $a_form=null)
insert new file list form
insertFromRepository(string $a_cmd="insert")
Insert file from repository.
insertFromWorkspace(string $a_cmd="insert")
Insert file from personal workspace.
setContent(string $a_html)
Sets content for standard template.
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
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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...
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
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...
__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
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.