24 require_once(
"./Services/COPage/classes/class.ilPCListItem.php");
25 require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
44 function __construct(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id =
"")
46 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
55 $next_class = $this->ctrl->getNextClass($this);
58 $cmd = $this->ctrl->getCmd();
76 if ($_FILES[
"file"][
"name"] ==
"")
78 $_GET[
"subCmd"] =
"-";
86 include_once(
"./Modules/File/classes/class.ilObjFile.php");
88 $fileObj->setType(
"file");
89 $fileObj->setTitle($_FILES[
"file"][
"name"]);
90 $fileObj->setDescription(
"");
91 $fileObj->setFileName($_FILES[
"file"][
"name"]);
92 $fileObj->setFileType($_FILES[
"file"][
"type"]);
93 $fileObj->setFileSize($_FILES[
"file"][
"size"]);
94 $fileObj->setMode(
"filelist");
96 $fileObj->raiseUploadError(
false);
98 $fileObj->createDirectory();
99 $fileObj->getUploadFile($_FILES[
"file"][
"tmp_name"],
100 $_FILES[
"file"][
"name"]);
102 $this->file_object = $fileObj;
114 if (
$_GET[
"subCmd"] ==
"insertNew")
116 $_SESSION[
"cont_file_insert"] =
"insertNew";
118 if (
$_GET[
"subCmd"] ==
"insertFromRepository")
120 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
122 if (
$_GET[
"subCmd"] ==
"insertFromWorkspace")
124 $_SESSION[
"cont_file_insert"] =
"insertFromWorkspace";
126 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"")
131 switch (
$_GET[
"subCmd"])
133 case "insertFromWorkspace":
137 case "insertFromRepository":
146 $this->
setTabs(
"newItemAfter");
147 $ilTabs->setSubTabActive(
"cont_new_file");
151 $this->tpl->setContent($form->getHTML());
155 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_item_edit.html",
"Services/COPage");
156 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_item"));
157 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
162 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
164 $this->tpl->parseCurrentBlock();
167 $this->tpl->setCurrentBlock(
"commands");
168 $this->tpl->setVariable(
"BTN_NAME",
"insertNewItemAfter");
169 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
170 $this->tpl->parseCurrentBlock();
182 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
192 $form->addCommandButton(
"insertNewItemBefore", $lng->txt(
"save"));
196 $form->addCommandButton(
"insertNewItemAfter", $lng->txt(
"save"));
198 $form->addCommandButton(
"cancelAddFile", $lng->txt(
"cancel"));
200 $form->setTitle($lng->txt(
"cont_insert_file_item"));
202 $form->setFormAction($ilCtrl->getFormAction($this));
216 $ilTabs->setSubTabActive(
"cont_file_from_repository");
218 include_once
"./Services/COPage/classes/class.ilFileSelectorGUI.php";
223 if (
$_GET[
"expand"] ==
"")
225 $expanded = $tree->readRootId();
229 $expanded =
$_GET[
"expand"];
231 $exp->setExpand($expanded);
233 $exp->setTargetGet(
"sel_id");
235 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
236 $exp->setParamsGet($this->ctrl->getParameterArray($this, $a_cmd));
239 $exp->setFiltered(
true);
241 $exp->addFilter(
"root");
242 $exp->addFilter(
"cat");
243 $exp->addFilter(
"grp");
244 $exp->addFilter(
"fold");
245 $exp->addFilter(
"crs");
246 $exp->addFilter(
"file");
248 $sel_types =
array(
'file');
252 $tpl->setContent($exp->getOutput());
263 $ilTabs->setSubTabActive(
"cont_file_from_workspace");
266 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
270 include_once(
"./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php");
274 include_once(
"./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorer.php");
276 'filelist_wspexpand', $tree, $acc_handler);
277 $exp->setTargetGet(
'fl_wsp_id');
278 $exp->setFiltered(
false);
279 $exp->removeAllFormItemTypes();
282 $exp->setTypeClickable(
"file");
283 $ilCtrl->setParameter($this,
"subCmd",
"selectFile");
284 $exp->setCustomLinkTarget($ilCtrl->getLinkTarget($this, $a_cmd));
287 $exp->setFiltered(
true);
289 $exp->addFilter(
"wsrt");
290 $exp->addFilter(
"wfld");
291 $exp->addFilter(
"file");
294 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
295 $exp->setParamsGet($ilCtrl->getParameterArray($this, $a_cmd));
297 if(
$_GET[
'filelist_wspexpand'] ==
'')
299 $expanded = $tree->readRootId();
303 $expanded =
$_GET[
'filelist_wspexpand'];
305 $exp->setExpand($expanded);
308 $tpl->setContent($exp->getOutput());
319 if(isset(
$_GET[
"fl_wsp_id"]))
322 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
326 include_once(
"./Modules/File/classes/class.ilObjFile.php");
327 $this->file_object =
new ilObjFile($node[
"obj_id"],
false);
329 else if ($a_file_ref_id == 0)
335 include_once(
"./Modules/File/classes/class.ilObjFile.php");
336 $this->file_object =
new ilObjFile($a_file_ref_id);
340 $this->content_obj->newItemAfter($this->file_object->getId(),
341 $this->file_object->getTitle(), $this->file_object->getFileType());
342 $this->updated = $this->pg_obj->update();
343 if ($this->updated ===
true)
345 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
349 $_GET[
"subCmd"] =
"-";
360 if (
$_GET[
"subCmd"] ==
"insertNew")
362 $_SESSION[
"cont_file_insert"] =
"insertNew";
364 if (
$_GET[
"subCmd"] ==
"insertFromRepository")
366 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
368 if (
$_GET[
"subCmd"] ==
"insertFromWorkspace")
370 $_SESSION[
"cont_file_insert"] =
"insertFromWorkspace";
372 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"")
377 switch (
$_GET[
"subCmd"])
379 case "insertFromWorkspace":
383 case "insertFromRepository":
392 $this->
setTabs(
"newItemBefore");
393 $ilTabs->setSubTabActive(
"cont_new_file");
397 $this->tpl->setContent($form->getHTML());
401 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_item_edit.html",
"Services/COPage");
402 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_item"));
403 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
408 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
410 $this->tpl->parseCurrentBlock();
413 $this->tpl->setCurrentBlock(
"commands");
414 $this->tpl->setVariable(
"BTN_NAME",
"insertNewItemBefore");
415 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
416 $this->tpl->parseCurrentBlock();
430 if(isset(
$_GET[
"fl_wsp_id"]))
433 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
437 include_once(
"./Modules/File/classes/class.ilObjFile.php");
438 $this->file_object =
new ilObjFile($node[
"obj_id"],
false);
440 else if ($a_file_ref_id == 0)
446 include_once(
"./Modules/File/classes/class.ilObjFile.php");
447 $this->file_object =
new ilObjFile($a_file_ref_id);
451 $this->content_obj->newItemBefore($this->file_object->getId(),
452 $this->file_object->getTitle(), $this->file_object->getFileType());
453 $this->updated = $this->pg_obj->update();
454 if ($this->updated ===
true)
456 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
460 $_GET[
"subCmd"] =
"-";
469 $this->content_obj->deleteItem();
470 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
471 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
481 $ilTabs->addTarget(
"cont_back",
482 $this->ctrl->getParentReturn($this),
"",
487 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
488 $ilTabs->addSubTabTarget(
"cont_new_file",
489 $ilCtrl->getLinkTarget($this, $a_cmd), $a_cmd);
491 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
492 $ilTabs->addSubTabTarget(
"cont_file_from_repository",
493 $ilCtrl->getLinkTarget($this, $a_cmd), $a_cmd);
494 $ilCtrl->setParameter($this,
"subCmd",
"");
496 if(!$ilSetting->get(
"disable_personal_workspace") &&
497 !$ilSetting->get(
"disable_wsp_files"))
499 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
500 $ilTabs->addSubTabTarget(
"cont_file_from_workspace",
501 $ilCtrl->getLinkTarget($this, $a_cmd), $a_cmd);
502 $ilCtrl->setParameter($this,
"subCmd",
"");
512 $this->content_obj->moveItemDown();
513 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
514 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
522 $this->content_obj->moveItemUp();
523 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
524 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
532 $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
Access handler for personal workspace.
__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
Select file for being added into file lists.
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
insertFromRepository($a_cmd)
Insert file from repository.
moveItemDown()
move list item down
getNodeData($a_node_id, $a_tree_pk=null)
get all information of a node.
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
Create styles array
The data for the language used.
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