4 require_once(
"./Services/COPage/classes/class.ilPCFileList.php");
5 require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
27 $this->
setCharacteristics(array(
"FileListItem" => $this->lng->txt(
"cont_FileListItem")));
36 $next_class = $this->ctrl->getNextClass($this);
41 $cmd = $this->ctrl->getCmd();
58 global $ilUser, $ilTabs;
60 if (
$_GET[
"subCmd"] ==
"insertNew")
62 $_SESSION[
"cont_file_insert"] =
"insertNew";
64 if (
$_GET[
"subCmd"] ==
"insertFromRepository")
66 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
68 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"")
73 switch (
$_GET[
"subCmd"])
75 case "insertFromRepository":
85 $ilTabs->setSubTabActive(
"cont_new_file");
88 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_list_new.html",
"Services/COPage");
90 $this->tpl->setCurrentBlock(
"new_file");
91 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
92 $this->tpl->parseCurrentBlock();
94 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_list"));
95 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
101 $s_lang =
$_SESSION[
"il_text_lang_".$_GET[
"ref_id"]];
105 $s_lang = $ilUser->getLanguage();
110 $this->tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"title"));
111 $this->tpl->setVariable(
"INPUT_TITLE",
"flst_title");
114 $this->tpl->setVariable(
"TXT_LANGUAGE", $this->lng->txt(
"language"));
115 require_once(
"Services/MetaData/classes/class.ilMDLanguageItem.php");
118 $this->tpl->setVariable(
"SELECT_LANGUAGE", $select_lang);
121 $this->tpl->parseCurrentBlock();
124 $this->tpl->setCurrentBlock(
"commands");
125 $this->tpl->setVariable(
"BTN_NAME",
"create_flst");
126 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
127 $this->tpl->setVariable(
"BTN_CANCEL",
"cancelCreate");
128 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
129 $this->tpl->parseCurrentBlock();
140 global $ilTabs, $ilUser;
143 $ilTabs->setSubTabActive(
"cont_file_from_repository");
146 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_list_new.html",
"Services/COPage");
148 $this->tpl->setCurrentBlock(
"rep_file");
149 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
150 include_once(
"./Modules/File/classes/class.ilObjFile.php");
152 if (is_object($file_obj))
154 $this->tpl->setVariable(
"TXT_FILE_TITLE", $file_obj->getTitle());
155 $this->tpl->setVariable(
"FILE_REF_ID", $file_obj->getRefId());
157 $this->tpl->parseCurrentBlock();
159 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_list"));
160 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
166 $s_lang =
$_SESSION[
"il_text_lang_".$_GET[
"ref_id"]];
170 $s_lang = $ilUser->getLanguage();
174 $this->tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"title"));
175 $this->tpl->setVariable(
"INPUT_TITLE",
"flst_title");
178 $this->tpl->setVariable(
"TXT_LANGUAGE", $this->lng->txt(
"language"));
179 require_once(
"Services/MetaData/classes/class.ilMDLanguageItem.php");
182 $this->tpl->setVariable(
"SELECT_LANGUAGE", $select_lang);
187 $this->tpl->setCurrentBlock(
"commands");
188 $this->tpl->setVariable(
"BTN_NAME",
"create_flst");
189 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
190 $this->tpl->setVariable(
"BTN_CANCEL",
"cancelCreate");
191 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
192 $this->tpl->parseCurrentBlock();
202 if ($a_cmd ==
"insert")
211 $ilTabs->setSubTabActive(
"cont_file_from_repository");
213 include_once
"./Services/COPage/classes/class.ilFileSelectorGUI.php";
217 if (
$_GET[
"expand"] ==
"")
219 $expanded = $tree->readRootId();
223 $expanded =
$_GET[
"expand"];
225 $exp->setExpand($expanded);
227 $exp->setTargetGet(
"sel_id");
229 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
230 $exp->setParamsGet($this->ctrl->getParameterArray($this, $a_cmd));
233 $exp->setFiltered(
true);
235 $exp->addFilter(
"root");
236 $exp->addFilter(
"cat");
237 $exp->addFilter(
"grp");
238 $exp->addFilter(
"fold");
239 $exp->addFilter(
"crs");
240 $exp->addFilter(
"file");
242 $sel_types = array(
'file');
246 $tpl->setContent($exp->getOutput());
255 include_once(
"./Modules/File/classes/class.ilObjFile.php");
257 if (
$_POST[
"file_ref_id"] == 0)
260 $fileObj->setType(
"file");
261 $fileObj->setTitle($_FILES[
"Fobject"][
"name"][
"file"]);
262 $fileObj->setDescription(
"");
263 $fileObj->setFileName($_FILES[
"Fobject"][
"name"][
"file"]);
264 $fileObj->setFileType($_FILES[
"Fobject"][
"type"][
"file"]);
265 $fileObj->setFileSize($_FILES[
"Fobject"][
"size"][
"file"]);
266 $fileObj->setMode(
"filelist");
269 $fileObj->createDirectory();
270 $fileObj->raiseUploadError(
false);
271 $fileObj->getUploadFile($_FILES[
"Fobject"][
"tmp_name"][
"file"],
272 $_FILES[
"Fobject"][
"name"][
"file"]);
282 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
284 $this->content_obj->appendItem($fileObj->getId(), $fileObj->getFileName(),
285 $fileObj->getFileType());
287 $this->updated = $this->pg_obj->update();
288 if ($this->updated ===
true)
290 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
306 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_list_edit.html",
"Services/COPage");
307 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_edit_file_list_properties"));
308 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
313 $this->tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"title"));
314 $this->tpl->setVariable(
"INPUT_TITLE",
"flst_title");
318 $this->tpl->setVariable(
"VALUE_TITLE", $this->content_obj->getListTitle());
321 $this->tpl->setVariable(
"TXT_LANGUAGE", $this->lng->txt(
"language"));
322 require_once(
"Services/MetaData/classes/class.ilMDLanguageItem.php");
325 $this->tpl->setVariable(
"SELECT_LANGUAGE", $select_lang);
331 $this->tpl->setCurrentBlock(
"commands");
332 $this->tpl->setVariable(
"BTN_NAME",
"saveProperties");
333 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
334 $this->tpl->setVariable(
"BTN_CANCEL",
"cancelUpdate");
335 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
336 $this->tpl->parseCurrentBlock();
348 $this->updated = $this->pg_obj->update();
349 if ($this->updated ===
true)
351 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
355 $this->pg_obj->addHierIDs();
368 include_once(
"./Services/COPage/classes/class.ilPCFileListTableGUI.php");
370 $tpl->setContent($table_gui->getHTML());
384 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
385 $ilTabs->addSubTabTarget(
"cont_new_file",
386 $ilCtrl->getLinkTarget($this,
$cmd),
$cmd);
388 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
389 $ilTabs->addSubTabTarget(
"cont_file_from_repository",
390 $ilCtrl->getLinkTarget($this,
$cmd),
$cmd);
391 $ilCtrl->setParameter($this,
"subCmd",
"");
395 $ilTabs->setBackTarget($lng->txt(
"pg"),
396 $this->ctrl->getParentReturn($this));
398 $ilTabs->addTarget(
"cont_ed_edit_prop",
399 $ilCtrl->getLinkTarget($this,
"edit"),
"edit",
402 $ilTabs->addTarget(
"cont_ed_edit_files",
403 $ilCtrl->getLinkTarget($this,
"editFiles"),
"editFiles",
416 $files = $this->content_obj->getFileList();
420 $ilCtrl->setParameterByClass(
"ilpcfileitemgui",
"hier_id",
422 $ilCtrl->setParameterByClass(
"ilpcfileitemgui",
"pc_id",
424 $ilCtrl->redirectByClass(
"ilpcfileitemgui",
"newItemAfter");
428 $ilCtrl->redirect($this,
"newFileItem");
439 if (is_array(
$_POST[
"fid"]))
442 foreach(
$_POST[
"fid"] as $k => $v)
446 $this->content_obj->deleteFileItems($ids);
448 $this->updated = $this->pg_obj->update();
449 $ilCtrl->redirect($this,
"editFiles");
459 if (is_array(
$_POST[
"position"]))
461 $this->content_obj->savePositions(
$_POST[
"position"]);
463 $this->updated = $this->pg_obj->update();
464 $ilCtrl->redirect($this,
"editFiles");
474 if (is_array(
$_POST[
"position"]))
476 $this->content_obj->savePositions(
$_POST[
"position"]);
478 if (is_array(
$_POST[
"class"]))
480 $this->content_obj->saveStyleClasses(
$_POST[
"class"]);
482 $this->updated = $this->pg_obj->update();
483 $ilCtrl->redirect($this,
"editFiles");
494 $classes = $this->content_obj->getAllClasses();
495 if (count($chars) > 1)
499 foreach ($classes as $class)
501 if ($class !=
"" && $class !=
"FileListItem")
525 if (
$_GET[
"subCmd"] ==
"insertNew")
527 $_SESSION[
"cont_file_insert"] =
"insertNew";
529 if (
$_GET[
"subCmd"] ==
"insertFromRepository")
531 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
533 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"")
538 switch (
$_GET[
"subCmd"])
540 case "insertFromRepository":
550 $ilTabs->setSubTabActive(
"cont_new_file");
553 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.file_item_edit.html",
"Services/COPage");
554 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_file_item"));
555 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
560 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file"));
562 $this->tpl->parseCurrentBlock();
565 $this->tpl->setCurrentBlock(
"commands");
566 $this->tpl->setVariable(
"BTN_NAME",
"insertNewFileItem");
567 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
568 $this->tpl->parseCurrentBlock();
578 if ($a_file_ref_id == 0)
584 include_once(
"./Modules/File/classes/class.ilObjFile.php");
585 $file_obj =
new ilObjFile($a_file_ref_id);
587 if (is_object($file_obj))
589 $this->content_obj->appendItem($file_obj->getId(),
590 $file_obj->getTitle(), $file_obj->getFileType());
591 $this->updated = $this->pg_obj->update();
592 if ($this->updated ===
true)
594 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
598 $_GET[
"subCmd"] =
"-";
609 if ($_FILES[
"Fobject"][
"name"][
"file"] ==
"")
611 $_GET[
"subCmd"] =
"-";
615 include_once(
"./Modules/File/classes/class.ilObjFile.php");
617 $fileObj->setType(
"file");
618 $fileObj->setTitle($_FILES[
"Fobject"][
"name"][
"file"]);
619 $fileObj->setDescription(
"");
620 $fileObj->setFileName($_FILES[
"Fobject"][
"name"][
"file"]);
621 $fileObj->setFileType($_FILES[
"Fobject"][
"type"][
"file"]);
622 $fileObj->setFileSize($_FILES[
"Fobject"][
"size"][
"file"]);
623 $fileObj->setMode(
"filelist");
625 $fileObj->raiseUploadError(
false);
627 $fileObj->createDirectory();
628 $fileObj->getUploadFile($_FILES[
"Fobject"][
"tmp_name"][
"file"],
629 $_FILES[
"Fobject"][
"name"][
"file"]);
642 $ilTabs->addTarget(
"cont_back",
643 $this->ctrl->getParentReturn($this),
"",
648 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
649 $ilTabs->addSubTabTarget(
"cont_new_file",
650 $ilCtrl->getLinkTarget($this, $a_cmd), $a_cmd);
652 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
653 $ilTabs->addSubTabTarget(
"cont_file_from_repository",
654 $ilCtrl->getLinkTarget($this, $a_cmd), $a_cmd);
655 $ilCtrl->setParameter($this,
"subCmd",
"");