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"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"")
123 switch (
$_GET[
"subCmd"])
125 case "insertFromRepository":
134 $this->
setTabs(
"newItemAfter");
135 $ilTabs->setSubTabActive(
"cont_new_file");
138 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_item_edit.html",
"Services/COPage");
139 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_item"));
140 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
145 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
147 $this->tpl->parseCurrentBlock();
150 $this->tpl->setCurrentBlock(
"commands");
151 $this->tpl->setVariable(
"BTN_NAME",
"insertNewItemAfter");
152 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
153 $this->tpl->parseCurrentBlock();
166 $ilTabs->setSubTabActive(
"cont_file_from_repository");
168 include_once
"./Services/COPage/classes/class.ilFileSelectorGUI.php";
173 if (
$_GET[
"expand"] ==
"")
175 $expanded = $tree->readRootId();
179 $expanded =
$_GET[
"expand"];
181 $exp->setExpand($expanded);
183 $exp->setTargetGet(
"sel_id");
185 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
186 $exp->setParamsGet($this->ctrl->getParameterArray($this, $a_cmd));
189 $exp->setFiltered(
true);
191 $exp->addFilter(
"root");
192 $exp->addFilter(
"cat");
193 $exp->addFilter(
"grp");
194 $exp->addFilter(
"fold");
195 $exp->addFilter(
"crs");
196 $exp->addFilter(
"file");
198 $sel_types = array(
'file');
202 $tpl->setContent($exp->getOutput());
211 if ($a_file_ref_id == 0)
217 include_once(
"./Modules/File/classes/class.ilObjFile.php");
218 $this->file_object =
new ilObjFile($a_file_ref_id);
222 $this->content_obj->newItemAfter($this->file_object->getId(),
223 $this->file_object->getTitle(), $this->file_object->getFileType());
224 $this->updated = $this->pg_obj->update();
225 if ($this->updated ===
true)
227 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
231 $_GET[
"subCmd"] =
"-";
242 if (
$_GET[
"subCmd"] ==
"insertNew")
244 $_SESSION[
"cont_file_insert"] =
"insertNew";
246 if (
$_GET[
"subCmd"] ==
"insertFromRepository")
248 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
250 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"")
255 switch (
$_GET[
"subCmd"])
257 case "insertFromRepository":
266 $this->
setTabs(
"newItemBefore");
267 $ilTabs->setSubTabActive(
"cont_new_file");
270 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_item_edit.html",
"Services/COPage");
271 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_item"));
272 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
277 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
279 $this->tpl->parseCurrentBlock();
282 $this->tpl->setCurrentBlock(
"commands");
283 $this->tpl->setVariable(
"BTN_NAME",
"insertNewItemBefore");
284 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
285 $this->tpl->parseCurrentBlock();
297 if ($a_file_ref_id == 0)
303 include_once(
"./Modules/File/classes/class.ilObjFile.php");
304 $this->file_object =
new ilObjFile($a_file_ref_id);
308 $this->content_obj->newItemBefore($this->file_object->getId(),
309 $this->file_object->getTitle(), $this->file_object->getFileType());
310 $this->updated = $this->pg_obj->update();
311 if ($this->updated ===
true)
313 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
317 $_GET[
"subCmd"] =
"-";
326 $this->content_obj->deleteItem();
327 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
328 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
338 $ilTabs->addTarget(
"cont_back",
339 $this->ctrl->getParentReturn($this),
"",
344 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
345 $ilTabs->addSubTabTarget(
"cont_new_file",
346 $ilCtrl->getLinkTarget($this, $a_cmd), $a_cmd);
348 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
349 $ilTabs->addSubTabTarget(
"cont_file_from_repository",
350 $ilCtrl->getLinkTarget($this, $a_cmd), $a_cmd);
351 $ilCtrl->setParameter($this,
"subCmd",
"");
360 $this->content_obj->moveItemDown();
361 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
362 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
370 $this->content_obj->moveItemUp();
371 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
372 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);