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();
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");
124 $fileObj->createDirectory();
126 $upload = $DIC->upload();
127 if ($upload->hasBeenProcessed() !==
true) {
130 $fileObj->getUploadFile(
131 $_FILES[
"file"][
"tmp_name"],
132 $_FILES[
"file"][
"name"]
135 $this->file_object = $fileObj;
147 if (
$_GET[
"subCmd"] ==
"insertNew") {
148 $_SESSION[
"cont_file_insert"] =
"insertNew";
150 if (
$_GET[
"subCmd"] ==
"insertFromRepository") {
151 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
153 if (
$_GET[
"subCmd"] ==
"insertFromWorkspace") {
154 $_SESSION[
"cont_file_insert"] =
"insertFromWorkspace";
156 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"") {
160 switch (
$_GET[
"subCmd"]) {
161 case "insertFromWorkspace":
165 case "insertFromRepository":
174 $this->
setTabs(
"newItemAfter");
175 $ilTabs->setSubTabActive(
"cont_new_file");
179 $this->tpl->setContent($form->getHTML());
183 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_item_edit.html",
"Services/COPage");
184 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_item"));
185 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
190 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
192 $this->tpl->parseCurrentBlock();
195 $this->tpl->setCurrentBlock(
"commands");
196 $this->tpl->setVariable(
"BTN_NAME",
"insertNewItemAfter");
197 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
198 $this->tpl->parseCurrentBlock();
212 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
221 $form->addCommandButton(
"insertNewItemBefore",
$lng->txt(
"save"));
223 $form->addCommandButton(
"insertNewItemAfter",
$lng->txt(
"save"));
225 $form->addCommandButton(
"cancelAddFile",
$lng->txt(
"cancel"));
227 $form->setTitle(
$lng->txt(
"cont_insert_file_item"));
229 $form->setFormAction($ilCtrl->getFormAction($this));
245 $ilTabs->setSubTabActive(
"cont_file_from_repository");
246 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
248 include_once(
"./Services/COPage/classes/class.ilPCFileItemFileSelectorGUI.php");
256 if (!$exp->handleCommand()) {
257 $tpl->setContent($exp->getHTML());
273 $ilTabs->setSubTabActive(
"cont_file_from_workspace");
275 include_once(
"./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorerGUI.php");
277 $ilCtrl->setParameter($this,
"subCmd",
"selectFile");
279 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
280 $exp->setTypeWhiteList(array(
"wsrt",
"wfld",
"file"));
281 $exp->setSelectableTypes(array(
"file"));
282 if ($exp->handleCommand()) {
285 $tpl->setContent($exp->getHTML());
296 if (isset(
$_GET[
"fl_wsp_id"])) {
298 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
300 $node =
$tree->getNodeData(
$_GET[
"fl_wsp_id"]);
302 include_once(
"./Modules/File/classes/class.ilObjFile.php");
303 $this->file_object =
new ilObjFile($node[
"obj_id"],
false);
304 } elseif ($a_file_ref_id == 0) {
307 include_once(
"./Modules/File/classes/class.ilObjFile.php");
308 $this->file_object =
new ilObjFile($a_file_ref_id);
311 $this->content_obj->newItemAfter(
312 $this->file_object->getId(),
313 $this->file_object->getTitle(),
314 $this->file_object->getFileType()
316 $this->updated = $this->pg_obj->update();
317 if ($this->updated ===
true) {
318 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
322 $_GET[
"subCmd"] =
"-";
333 if (
$_GET[
"subCmd"] ==
"insertNew") {
334 $_SESSION[
"cont_file_insert"] =
"insertNew";
336 if (
$_GET[
"subCmd"] ==
"insertFromRepository") {
337 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
339 if (
$_GET[
"subCmd"] ==
"insertFromWorkspace") {
340 $_SESSION[
"cont_file_insert"] =
"insertFromWorkspace";
342 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"") {
346 switch (
$_GET[
"subCmd"]) {
347 case "insertFromWorkspace":
351 case "insertFromRepository":
360 $this->
setTabs(
"newItemBefore");
361 $ilTabs->setSubTabActive(
"cont_new_file");
365 $this->tpl->setContent($form->getHTML());
369 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_item_edit.html",
"Services/COPage");
370 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_item"));
371 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
376 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
378 $this->tpl->parseCurrentBlock();
381 $this->tpl->setCurrentBlock(
"commands");
382 $this->tpl->setVariable(
"BTN_NAME",
"insertNewItemBefore");
383 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
384 $this->tpl->parseCurrentBlock();
397 if (isset(
$_GET[
"fl_wsp_id"])) {
399 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
401 $node =
$tree->getNodeData(
$_GET[
"fl_wsp_id"]);
403 include_once(
"./Modules/File/classes/class.ilObjFile.php");
404 $this->file_object =
new ilObjFile($node[
"obj_id"],
false);
405 } elseif ($a_file_ref_id == 0) {
408 include_once(
"./Modules/File/classes/class.ilObjFile.php");
409 $this->file_object =
new ilObjFile($a_file_ref_id);
412 $this->content_obj->newItemBefore(
413 $this->file_object->getId(),
414 $this->file_object->getTitle(),
415 $this->file_object->getFileType()
417 $this->updated = $this->pg_obj->update();
418 if ($this->updated ===
true) {
419 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
423 $_GET[
"subCmd"] =
"-";
432 $this->content_obj->deleteItem();
433 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
434 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
448 $this->ctrl->getParentReturn($this),
454 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
455 $ilTabs->addSubTabTarget(
457 $ilCtrl->getLinkTarget($this, $a_cmd),
461 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
462 $ilTabs->addSubTabTarget(
463 "cont_file_from_repository",
464 $ilCtrl->getLinkTarget($this, $a_cmd),
467 $ilCtrl->setParameter($this,
"subCmd",
"");
469 if (!
$ilSetting->get(
"disable_personal_workspace") &&
471 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
472 $ilTabs->addSubTabTarget(
473 "cont_file_from_workspace",
474 $ilCtrl->getLinkTarget($this, $a_cmd),
477 $ilCtrl->setParameter($this,
"subCmd",
"");
487 $this->content_obj->moveItemDown();
488 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
489 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
497 $this->content_obj->moveItemUp();
498 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
499 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
507 $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
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
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
__construct(Container $dic, ilPlugin $plugin)
newItemAfter()
insert new list item after current one
insertNewItemBefore($a_file_ref_id=0)
insert new list item before current one
setCustomLinkTarget($a_val)
Set custom link target.
executeCommand()
execute command