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[
"Fobject"][
"name"][
"file"] ==
"")
78 $_GET[
"subCmd"] =
"-";
82 include_once(
"./Modules/File/classes/class.ilObjFile.php");
84 $fileObj->setType(
"file");
85 $fileObj->setTitle($_FILES[
"Fobject"][
"name"][
"file"]);
86 $fileObj->setDescription(
"");
87 $fileObj->setFileName($_FILES[
"Fobject"][
"name"][
"file"]);
88 $fileObj->setFileType($_FILES[
"Fobject"][
"type"][
"file"]);
89 $fileObj->setFileSize($_FILES[
"Fobject"][
"size"][
"file"]);
90 $fileObj->setMode(
"filelist");
92 $fileObj->raiseUploadError(
false);
94 $fileObj->createDirectory();
95 $fileObj->getUploadFile($_FILES[
"Fobject"][
"tmp_name"][
"file"],
96 $_FILES[
"Fobject"][
"name"][
"file"]);
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");
146 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_item_edit.html",
"Services/COPage");
147 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_item"));
148 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
153 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
155 $this->tpl->parseCurrentBlock();
158 $this->tpl->setCurrentBlock(
"commands");
159 $this->tpl->setVariable(
"BTN_NAME",
"insertNewItemAfter");
160 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
161 $this->tpl->parseCurrentBlock();
174 $ilTabs->setSubTabActive(
"cont_file_from_repository");
176 include_once
"./Services/COPage/classes/class.ilFileSelectorGUI.php";
181 if (
$_GET[
"expand"] ==
"")
183 $expanded = $tree->readRootId();
187 $expanded =
$_GET[
"expand"];
189 $exp->setExpand($expanded);
191 $exp->setTargetGet(
"sel_id");
193 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
194 $exp->setParamsGet($this->ctrl->getParameterArray($this, $a_cmd));
197 $exp->setFiltered(
true);
199 $exp->addFilter(
"root");
200 $exp->addFilter(
"cat");
201 $exp->addFilter(
"grp");
202 $exp->addFilter(
"fold");
203 $exp->addFilter(
"crs");
204 $exp->addFilter(
"file");
206 $sel_types = array(
'file');
210 $tpl->setContent($exp->getOutput());
221 $ilTabs->setSubTabActive(
"cont_file_from_workspace");
224 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
228 include_once(
"./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php");
232 include_once(
"./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorer.php");
234 'filelist_wspexpand', $tree, $acc_handler);
235 $exp->setTargetGet(
'fl_wsp_id');
236 $exp->setFiltered(
false);
237 $exp->removeAllFormItemTypes();
240 $exp->setTypeClickable(
"file");
241 $ilCtrl->setParameter($this,
"subCmd",
"selectFile");
242 $exp->setCustomLinkTarget($ilCtrl->getLinkTarget($this, $a_cmd));
245 $exp->setFiltered(
true);
247 $exp->addFilter(
"wsrt");
248 $exp->addFilter(
"wfld");
249 $exp->addFilter(
"file");
252 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
253 $exp->setParamsGet($ilCtrl->getParameterArray($this, $a_cmd));
255 if(
$_GET[
'filelist_wspexpand'] ==
'')
257 $expanded = $tree->readRootId();
261 $expanded =
$_GET[
'filelist_wspexpand'];
263 $exp->setExpand($expanded);
266 $tpl->setContent($exp->getOutput());
277 if(isset(
$_GET[
"fl_wsp_id"]))
280 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
284 include_once(
"./Modules/File/classes/class.ilObjFile.php");
285 $this->file_object =
new ilObjFile($node[
"obj_id"],
false);
287 else if ($a_file_ref_id == 0)
293 include_once(
"./Modules/File/classes/class.ilObjFile.php");
294 $this->file_object =
new ilObjFile($a_file_ref_id);
298 $this->content_obj->newItemAfter($this->file_object->getId(),
299 $this->file_object->getTitle(), $this->file_object->getFileType());
300 $this->updated = $this->pg_obj->update();
301 if ($this->updated ===
true)
303 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
307 $_GET[
"subCmd"] =
"-";
318 if (
$_GET[
"subCmd"] ==
"insertNew")
320 $_SESSION[
"cont_file_insert"] =
"insertNew";
322 if (
$_GET[
"subCmd"] ==
"insertFromRepository")
324 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
326 if (
$_GET[
"subCmd"] ==
"insertFromWorkspace")
328 $_SESSION[
"cont_file_insert"] =
"insertFromWorkspace";
330 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"")
335 switch (
$_GET[
"subCmd"])
337 case "insertFromWorkspace":
341 case "insertFromRepository":
350 $this->
setTabs(
"newItemBefore");
351 $ilTabs->setSubTabActive(
"cont_new_file");
354 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_item_edit.html",
"Services/COPage");
355 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_item"));
356 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
361 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
363 $this->tpl->parseCurrentBlock();
366 $this->tpl->setCurrentBlock(
"commands");
367 $this->tpl->setVariable(
"BTN_NAME",
"insertNewItemBefore");
368 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
369 $this->tpl->parseCurrentBlock();
383 if(isset(
$_GET[
"fl_wsp_id"]))
386 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
390 include_once(
"./Modules/File/classes/class.ilObjFile.php");
391 $this->file_object =
new ilObjFile($node[
"obj_id"],
false);
393 else if ($a_file_ref_id == 0)
399 include_once(
"./Modules/File/classes/class.ilObjFile.php");
400 $this->file_object =
new ilObjFile($a_file_ref_id);
404 $this->content_obj->newItemBefore($this->file_object->getId(),
405 $this->file_object->getTitle(), $this->file_object->getFileType());
406 $this->updated = $this->pg_obj->update();
407 if ($this->updated ===
true)
409 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
413 $_GET[
"subCmd"] =
"-";
422 $this->content_obj->deleteItem();
423 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
424 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
434 $ilTabs->addTarget(
"cont_back",
435 $this->ctrl->getParentReturn($this),
"",
440 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
441 $ilTabs->addSubTabTarget(
"cont_new_file",
442 $ilCtrl->getLinkTarget($this, $a_cmd), $a_cmd);
444 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
445 $ilTabs->addSubTabTarget(
"cont_file_from_repository",
446 $ilCtrl->getLinkTarget($this, $a_cmd), $a_cmd);
447 $ilCtrl->setParameter($this,
"subCmd",
"");
449 if(!$ilSetting->get(
"disable_personal_workspace") &&
450 !$ilSetting->get(
"disable_wsp_files"))
452 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
453 $ilTabs->addSubTabTarget(
"cont_file_from_workspace",
454 $ilCtrl->getLinkTarget($this, $a_cmd), $a_cmd);
455 $ilCtrl->setParameter($this,
"subCmd",
"");
465 $this->content_obj->moveItemDown();
466 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
467 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
475 $this->content_obj->moveItemUp();
476 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
477 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);