24 require_once(
"./Services/COPage/classes/class.ilPCListItem.php");
25 require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
55 $next_class = $this->ctrl->getNextClass($this);
58 $cmd = $this->ctrl->getCmd();
76 if ($_FILES[
"file"][
"name"] ==
"")
78 $_GET[
"subCmd"] =
"-";
82 include_once(
"./Modules/File/classes/class.ilObjFile.php");
84 $fileObj->setType(
"file");
85 $fileObj->setTitle($_FILES[
"file"][
"name"]);
86 $fileObj->setDescription(
"");
87 $fileObj->setFileName($_FILES[
"file"][
"name"]);
88 $fileObj->setFileType($_FILES[
"file"][
"type"]);
89 $fileObj->setFileSize($_FILES[
"file"][
"size"]);
90 $fileObj->setMode(
"filelist");
92 $fileObj->raiseUploadError(
false);
94 $fileObj->createDirectory();
95 $fileObj->getUploadFile($_FILES[
"file"][
"tmp_name"],
96 $_FILES[
"file"][
"name"]);
98 $this->file_object =& $fileObj;
110 if (
$_GET[
"subCmd"] ==
"insertNew")
112 $_SESSION[
"cont_file_insert"] =
"insertNew";
114 if (
$_GET[
"subCmd"] ==
"insertFromRepository")
116 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
118 if (
$_GET[
"subCmd"] ==
"insertFromWorkspace")
120 $_SESSION[
"cont_file_insert"] =
"insertFromWorkspace";
122 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"")
127 switch (
$_GET[
"subCmd"])
129 case "insertFromWorkspace":
133 case "insertFromRepository":
142 $this->
setTabs(
"newItemAfter");
143 $ilTabs->setSubTabActive(
"cont_new_file");
147 $this->tpl->setContent($form->getHTML());
151 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_item_edit.html",
"Services/COPage");
152 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_item"));
153 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
158 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
160 $this->tpl->parseCurrentBlock();
163 $this->tpl->setCurrentBlock(
"commands");
164 $this->tpl->setVariable(
"BTN_NAME",
"insertNewItemAfter");
165 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
166 $this->tpl->parseCurrentBlock();
178 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
188 $form->addCommandButton(
"insertNewItemBefore", $lng->txt(
"save"));
192 $form->addCommandButton(
"insertNewItemAfter", $lng->txt(
"save"));
194 $form->addCommandButton(
"cancelAddFile", $lng->txt(
"cancel"));
196 $form->setTitle($lng->txt(
"cont_insert_file_item"));
198 $form->setFormAction($ilCtrl->getFormAction($this));
212 $ilTabs->setSubTabActive(
"cont_file_from_repository");
214 include_once
"./Services/COPage/classes/class.ilFileSelectorGUI.php";
219 if (
$_GET[
"expand"] ==
"")
221 $expanded = $tree->readRootId();
225 $expanded =
$_GET[
"expand"];
227 $exp->setExpand($expanded);
229 $exp->setTargetGet(
"sel_id");
231 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
232 $exp->setParamsGet($this->ctrl->getParameterArray($this, $a_cmd));
235 $exp->setFiltered(
true);
237 $exp->addFilter(
"root");
238 $exp->addFilter(
"cat");
239 $exp->addFilter(
"grp");
240 $exp->addFilter(
"fold");
241 $exp->addFilter(
"crs");
242 $exp->addFilter(
"file");
244 $sel_types = array(
'file');
248 $tpl->setContent($exp->getOutput());
259 $ilTabs->setSubTabActive(
"cont_file_from_workspace");
262 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
266 include_once(
"./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php");
270 include_once(
"./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorer.php");
272 'filelist_wspexpand', $tree, $acc_handler);
273 $exp->setTargetGet(
'fl_wsp_id');
274 $exp->setFiltered(
false);
275 $exp->removeAllFormItemTypes();
278 $exp->setTypeClickable(
"file");
279 $ilCtrl->setParameter($this,
"subCmd",
"selectFile");
280 $exp->setCustomLinkTarget($ilCtrl->getLinkTarget($this, $a_cmd));
283 $exp->setFiltered(
true);
285 $exp->addFilter(
"wsrt");
286 $exp->addFilter(
"wfld");
287 $exp->addFilter(
"file");
290 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
291 $exp->setParamsGet($ilCtrl->getParameterArray($this, $a_cmd));
293 if(
$_GET[
'filelist_wspexpand'] ==
'')
295 $expanded = $tree->readRootId();
299 $expanded =
$_GET[
'filelist_wspexpand'];
301 $exp->setExpand($expanded);
304 $tpl->setContent($exp->getOutput());
315 if(isset(
$_GET[
"fl_wsp_id"]))
318 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
322 include_once(
"./Modules/File/classes/class.ilObjFile.php");
323 $this->file_object =
new ilObjFile($node[
"obj_id"],
false);
325 else if ($a_file_ref_id == 0)
331 include_once(
"./Modules/File/classes/class.ilObjFile.php");
332 $this->file_object =
new ilObjFile($a_file_ref_id);
336 $this->content_obj->newItemAfter($this->file_object->getId(),
337 $this->file_object->getTitle(), $this->file_object->getFileType());
338 $this->updated = $this->pg_obj->update();
339 if ($this->updated ===
true)
341 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
345 $_GET[
"subCmd"] =
"-";
356 if (
$_GET[
"subCmd"] ==
"insertNew")
358 $_SESSION[
"cont_file_insert"] =
"insertNew";
360 if (
$_GET[
"subCmd"] ==
"insertFromRepository")
362 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
364 if (
$_GET[
"subCmd"] ==
"insertFromWorkspace")
366 $_SESSION[
"cont_file_insert"] =
"insertFromWorkspace";
368 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"")
373 switch (
$_GET[
"subCmd"])
375 case "insertFromWorkspace":
379 case "insertFromRepository":
388 $this->
setTabs(
"newItemBefore");
389 $ilTabs->setSubTabActive(
"cont_new_file");
393 $this->tpl->setContent($form->getHTML());
397 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_item_edit.html",
"Services/COPage");
398 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_item"));
399 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
404 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
406 $this->tpl->parseCurrentBlock();
409 $this->tpl->setCurrentBlock(
"commands");
410 $this->tpl->setVariable(
"BTN_NAME",
"insertNewItemBefore");
411 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
412 $this->tpl->parseCurrentBlock();
426 if(isset(
$_GET[
"fl_wsp_id"]))
429 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
433 include_once(
"./Modules/File/classes/class.ilObjFile.php");
434 $this->file_object =
new ilObjFile($node[
"obj_id"],
false);
436 else if ($a_file_ref_id == 0)
442 include_once(
"./Modules/File/classes/class.ilObjFile.php");
443 $this->file_object =
new ilObjFile($a_file_ref_id);
447 $this->content_obj->newItemBefore($this->file_object->getId(),
448 $this->file_object->getTitle(), $this->file_object->getFileType());
449 $this->updated = $this->pg_obj->update();
450 if ($this->updated ===
true)
452 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
456 $_GET[
"subCmd"] =
"-";
465 $this->content_obj->deleteItem();
466 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
467 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
477 $ilTabs->addTarget(
"cont_back",
478 $this->ctrl->getParentReturn($this),
"",
483 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
484 $ilTabs->addSubTabTarget(
"cont_new_file",
485 $ilCtrl->getLinkTarget($this, $a_cmd), $a_cmd);
487 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
488 $ilTabs->addSubTabTarget(
"cont_file_from_repository",
489 $ilCtrl->getLinkTarget($this, $a_cmd), $a_cmd);
490 $ilCtrl->setParameter($this,
"subCmd",
"");
492 if(!$ilSetting->get(
"disable_personal_workspace") &&
493 !$ilSetting->get(
"disable_wsp_files"))
495 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
496 $ilTabs->addSubTabTarget(
"cont_file_from_workspace",
497 $ilCtrl->getLinkTarget($this, $a_cmd), $a_cmd);
498 $ilCtrl->setParameter($this,
"subCmd",
"");
508 $this->content_obj->moveItemDown();
509 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
510 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
518 $this->content_obj->moveItemUp();
519 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
520 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
528 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);