24 require_once(
"./Services/COPage/classes/class.ilPCListItem.php");
25 require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
64 public function __construct(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id =
"")
68 $this->lng = $DIC->language();
69 $this->tabs = $DIC->tabs();
70 $this->ctrl = $DIC->ctrl();
71 $this->
user = $DIC->user();
72 $this->tpl = $DIC[
"tpl"];
73 $this->tree = $DIC->repositoryTree();
75 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
84 $next_class = $this->ctrl->getNextClass($this);
87 $cmd = $this->ctrl->getCmd();
88 switch ($next_class) {
104 if ($_FILES[
"file"][
"name"] ==
"") {
105 $_GET[
"subCmd"] =
"-";
113 include_once(
"./Modules/File/classes/class.ilObjFile.php");
115 $fileObj->setType(
"file");
116 $fileObj->setTitle($_FILES[
"file"][
"name"]);
117 $fileObj->setDescription(
"");
118 $fileObj->setFileName($_FILES[
"file"][
"name"]);
119 $fileObj->setFileType($_FILES[
"file"][
"type"]);
120 $fileObj->setFileSize($_FILES[
"file"][
"size"]);
121 $fileObj->setMode(
"filelist");
123 $fileObj->raiseUploadError(
false);
125 $fileObj->createDirectory();
127 $upload = $DIC->upload();
128 if ($upload->hasBeenProcessed() !==
true) {
131 $fileObj->getUploadFile(
132 $_FILES[
"file"][
"tmp_name"],
133 $_FILES[
"file"][
"name"]
136 $this->file_object = $fileObj;
148 if (
$_GET[
"subCmd"] ==
"insertNew") {
149 $_SESSION[
"cont_file_insert"] =
"insertNew";
151 if (
$_GET[
"subCmd"] ==
"insertFromRepository") {
152 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
154 if (
$_GET[
"subCmd"] ==
"insertFromWorkspace") {
155 $_SESSION[
"cont_file_insert"] =
"insertFromWorkspace";
157 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"") {
161 switch (
$_GET[
"subCmd"]) {
162 case "insertFromWorkspace":
166 case "insertFromRepository":
175 $this->
setTabs(
"newItemAfter");
176 $ilTabs->setSubTabActive(
"cont_new_file");
180 $this->tpl->setContent(
$form->getHTML());
184 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_item_edit.html",
"Services/COPage");
185 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_item"));
186 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
191 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
193 $this->tpl->parseCurrentBlock();
196 $this->tpl->setCurrentBlock(
"commands");
197 $this->tpl->setVariable(
"BTN_NAME",
"insertNewItemAfter");
198 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
199 $this->tpl->parseCurrentBlock();
213 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
222 $form->addCommandButton(
"insertNewItemBefore",
$lng->txt(
"save"));
224 $form->addCommandButton(
"insertNewItemAfter",
$lng->txt(
"save"));
226 $form->addCommandButton(
"cancelAddFile",
$lng->txt(
"cancel"));
228 $form->setTitle(
$lng->txt(
"cont_insert_file_item"));
246 $ilTabs->setSubTabActive(
"cont_file_from_repository");
247 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
249 include_once(
"./Services/COPage/classes/class.ilPCFileItemFileSelectorGUI.php");
257 if (!$exp->handleCommand()) {
258 $tpl->setContent($exp->getHTML());
274 $ilTabs->setSubTabActive(
"cont_file_from_workspace");
276 include_once(
"./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorerGUI.php");
278 $ilCtrl->setParameter($this,
"subCmd",
"selectFile");
279 $exp->setCustomLinkTarget(
$ilCtrl->getLinkTarget($this, $a_cmd));
280 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
281 $exp->setTypeWhiteList(array(
"wsrt",
"wfld",
"file"));
282 $exp->setSelectableTypes(array(
"file"));
283 if ($exp->handleCommand()) {
286 $tpl->setContent($exp->getHTML());
297 if (isset(
$_GET[
"fl_wsp_id"])) {
299 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
301 $node =
$tree->getNodeData(
$_GET[
"fl_wsp_id"]);
303 include_once(
"./Modules/File/classes/class.ilObjFile.php");
304 $this->file_object =
new ilObjFile($node[
"obj_id"],
false);
305 } elseif ($a_file_ref_id == 0) {
308 include_once(
"./Modules/File/classes/class.ilObjFile.php");
309 $this->file_object =
new ilObjFile($a_file_ref_id);
312 $this->content_obj->newItemAfter(
313 $this->file_object->getId(),
314 $this->file_object->getTitle(),
315 $this->file_object->getFileType()
317 $this->updated = $this->pg_obj->update();
318 if ($this->updated ===
true) {
319 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
323 $_GET[
"subCmd"] =
"-";
334 if (
$_GET[
"subCmd"] ==
"insertNew") {
335 $_SESSION[
"cont_file_insert"] =
"insertNew";
337 if (
$_GET[
"subCmd"] ==
"insertFromRepository") {
338 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
340 if (
$_GET[
"subCmd"] ==
"insertFromWorkspace") {
341 $_SESSION[
"cont_file_insert"] =
"insertFromWorkspace";
343 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"") {
347 switch (
$_GET[
"subCmd"]) {
348 case "insertFromWorkspace":
352 case "insertFromRepository":
361 $this->
setTabs(
"newItemBefore");
362 $ilTabs->setSubTabActive(
"cont_new_file");
366 $this->tpl->setContent(
$form->getHTML());
370 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_item_edit.html",
"Services/COPage");
371 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_item"));
372 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
377 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
379 $this->tpl->parseCurrentBlock();
382 $this->tpl->setCurrentBlock(
"commands");
383 $this->tpl->setVariable(
"BTN_NAME",
"insertNewItemBefore");
384 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
385 $this->tpl->parseCurrentBlock();
398 if (isset(
$_GET[
"fl_wsp_id"])) {
400 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
402 $node =
$tree->getNodeData(
$_GET[
"fl_wsp_id"]);
404 include_once(
"./Modules/File/classes/class.ilObjFile.php");
405 $this->file_object =
new ilObjFile($node[
"obj_id"],
false);
406 } elseif ($a_file_ref_id == 0) {
409 include_once(
"./Modules/File/classes/class.ilObjFile.php");
410 $this->file_object =
new ilObjFile($a_file_ref_id);
413 $this->content_obj->newItemBefore(
414 $this->file_object->getId(),
415 $this->file_object->getTitle(),
416 $this->file_object->getFileType()
418 $this->updated = $this->pg_obj->update();
419 if ($this->updated ===
true) {
420 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
424 $_GET[
"subCmd"] =
"-";
433 $this->content_obj->deleteItem();
434 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
435 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
449 $this->ctrl->getParentReturn($this),
455 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
456 $ilTabs->addSubTabTarget(
458 $ilCtrl->getLinkTarget($this, $a_cmd),
462 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
463 $ilTabs->addSubTabTarget(
464 "cont_file_from_repository",
465 $ilCtrl->getLinkTarget($this, $a_cmd),
468 $ilCtrl->setParameter($this,
"subCmd",
"");
470 if (!
$ilSetting->get(
"disable_personal_workspace") &&
472 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
473 $ilTabs->addSubTabTarget(
474 "cont_file_from_workspace",
475 $ilCtrl->getLinkTarget($this, $a_cmd),
478 $ilCtrl->setParameter($this,
"subCmd",
"");
488 $this->content_obj->moveItemDown();
489 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
490 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
498 $this->content_obj->moveItemUp();
499 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
500 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
508 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
deleteItem()
delete a list item
initAddFileForm($a_before=true)
Init add file form.
moveItemUp()
move list item up
insertFromWorkspace($a_cmd="insert")
Insert file from personal workspace.
newItemBefore()
insert new list item before current one
__construct(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
Constructor public.
Tree handler for personal workspace.
setTabs($a_cmd="")
output tabs
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
Select files for file list.
foreach($_POST as $key=> $value) $res
if(isset($_POST['submit'])) $form
insertFromRepository($a_cmd)
Insert file from repository.
moveItemDown()
move list item down
Explorer for selecting a personal workspace item.
displayValidationError()
display validation errors
newFileItem()
insert new file item
cancelAddFile()
Cancel adding a file.
insertNewItemAfter($a_file_ref_id=0)
insert new file item after another item
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
newItemAfter()
insert new list item after current one
insertNewItemBefore($a_file_ref_id=0)
insert new list item before current one
executeCommand()
execute command