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();
126 $fileObj->getUploadFile(
127 $_FILES[
"file"][
"tmp_name"],
128 $_FILES[
"file"][
"name"]
131 $this->file_object = $fileObj;
143 if (
$_GET[
"subCmd"] ==
"insertNew") {
144 $_SESSION[
"cont_file_insert"] =
"insertNew";
146 if (
$_GET[
"subCmd"] ==
"insertFromRepository") {
147 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
149 if (
$_GET[
"subCmd"] ==
"insertFromWorkspace") {
150 $_SESSION[
"cont_file_insert"] =
"insertFromWorkspace";
152 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"") {
156 switch (
$_GET[
"subCmd"]) {
157 case "insertFromWorkspace":
161 case "insertFromRepository":
170 $this->
setTabs(
"newItemAfter");
171 $ilTabs->setSubTabActive(
"cont_new_file");
175 $this->tpl->setContent(
$form->getHTML());
179 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_item_edit.html",
"Services/COPage");
180 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_item"));
181 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
186 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
188 $this->tpl->parseCurrentBlock();
191 $this->tpl->setCurrentBlock(
"commands");
192 $this->tpl->setVariable(
"BTN_NAME",
"insertNewItemAfter");
193 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
194 $this->tpl->parseCurrentBlock();
208 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
217 $form->addCommandButton(
"insertNewItemBefore",
$lng->txt(
"save"));
219 $form->addCommandButton(
"insertNewItemAfter",
$lng->txt(
"save"));
221 $form->addCommandButton(
"cancelAddFile",
$lng->txt(
"cancel"));
223 $form->setTitle(
$lng->txt(
"cont_insert_file_item"));
241 $ilTabs->setSubTabActive(
"cont_file_from_repository");
242 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
244 include_once(
"./Services/COPage/classes/class.ilPCFileItemFileSelectorGUI.php");
252 if (!$exp->handleCommand()) {
253 $tpl->setContent($exp->getHTML());
269 $ilTabs->setSubTabActive(
"cont_file_from_workspace");
271 include_once(
"./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorerGUI.php");
273 $ilCtrl->setParameter($this,
"subCmd",
"selectFile");
274 $exp->setCustomLinkTarget(
$ilCtrl->getLinkTarget($this, $a_cmd));
275 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
276 $exp->setTypeWhiteList(
array(
"wsrt",
"wfld",
"file"));
277 $exp->setSelectableTypes(
array(
"file"));
278 if ($exp->handleCommand()) {
281 $tpl->setContent($exp->getHTML());
292 if (isset(
$_GET[
"fl_wsp_id"])) {
294 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
296 $node =
$tree->getNodeData(
$_GET[
"fl_wsp_id"]);
298 include_once(
"./Modules/File/classes/class.ilObjFile.php");
299 $this->file_object =
new ilObjFile($node[
"obj_id"],
false);
300 } elseif ($a_file_ref_id == 0) {
303 include_once(
"./Modules/File/classes/class.ilObjFile.php");
304 $this->file_object =
new ilObjFile($a_file_ref_id);
307 $this->content_obj->newItemAfter(
308 $this->file_object->getId(),
309 $this->file_object->getTitle(),
310 $this->file_object->getFileType()
312 $this->updated = $this->pg_obj->update();
313 if ($this->updated ===
true) {
314 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
318 $_GET[
"subCmd"] =
"-";
329 if (
$_GET[
"subCmd"] ==
"insertNew") {
330 $_SESSION[
"cont_file_insert"] =
"insertNew";
332 if (
$_GET[
"subCmd"] ==
"insertFromRepository") {
333 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
335 if (
$_GET[
"subCmd"] ==
"insertFromWorkspace") {
336 $_SESSION[
"cont_file_insert"] =
"insertFromWorkspace";
338 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"") {
342 switch (
$_GET[
"subCmd"]) {
343 case "insertFromWorkspace":
347 case "insertFromRepository":
356 $this->
setTabs(
"newItemBefore");
357 $ilTabs->setSubTabActive(
"cont_new_file");
361 $this->tpl->setContent(
$form->getHTML());
365 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_item_edit.html",
"Services/COPage");
366 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_item"));
367 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
372 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
374 $this->tpl->parseCurrentBlock();
377 $this->tpl->setCurrentBlock(
"commands");
378 $this->tpl->setVariable(
"BTN_NAME",
"insertNewItemBefore");
379 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
380 $this->tpl->parseCurrentBlock();
393 if (isset(
$_GET[
"fl_wsp_id"])) {
395 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
397 $node =
$tree->getNodeData(
$_GET[
"fl_wsp_id"]);
399 include_once(
"./Modules/File/classes/class.ilObjFile.php");
400 $this->file_object =
new ilObjFile($node[
"obj_id"],
false);
401 } elseif ($a_file_ref_id == 0) {
404 include_once(
"./Modules/File/classes/class.ilObjFile.php");
405 $this->file_object =
new ilObjFile($a_file_ref_id);
408 $this->content_obj->newItemBefore(
409 $this->file_object->getId(),
410 $this->file_object->getTitle(),
411 $this->file_object->getFileType()
413 $this->updated = $this->pg_obj->update();
414 if ($this->updated ===
true) {
415 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
419 $_GET[
"subCmd"] =
"-";
428 $this->content_obj->deleteItem();
429 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
430 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
444 $this->ctrl->getParentReturn($this),
450 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
451 $ilTabs->addSubTabTarget(
453 $ilCtrl->getLinkTarget($this, $a_cmd),
457 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
458 $ilTabs->addSubTabTarget(
459 "cont_file_from_repository",
460 $ilCtrl->getLinkTarget($this, $a_cmd),
463 $ilCtrl->setParameter($this,
"subCmd",
"");
465 if (!
$ilSetting->get(
"disable_personal_workspace") &&
467 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
468 $ilTabs->addSubTabTarget(
469 "cont_file_from_workspace",
470 $ilCtrl->getLinkTarget($this, $a_cmd),
473 $ilCtrl->setParameter($this,
"subCmd",
"");
483 $this->content_obj->moveItemDown();
484 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
485 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
493 $this->content_obj->moveItemUp();
494 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
495 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
503 $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
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