4 require_once(
"./Services/COPage/classes/class.ilPCFileList.php");
5 require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
49 public function __construct(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id =
"")
53 $this->
user = $DIC->user();
54 $this->tabs = $DIC->tabs();
55 $this->ctrl = $DIC->ctrl();
56 $this->tpl = $DIC[
"tpl"];
57 $this->tree = $DIC->repositoryTree();
58 $this->lng = $DIC->language();
59 $this->toolbar = $DIC->toolbar();
61 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
71 $next_class = $this->ctrl->getNextClass($this);
76 $cmd = $this->ctrl->getCmd();
78 switch ($next_class) {
90 public function insert($a_form = null)
95 if (
$_GET[
"subCmd"] ==
"insertNew") {
96 $_SESSION[
"cont_file_insert"] =
"insertNew";
98 if (
$_GET[
"subCmd"] ==
"insertFromRepository") {
99 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
101 if (
$_GET[
"subCmd"] ==
"insertFromWorkspace") {
102 $_SESSION[
"cont_file_insert"] =
"insertFromWorkspace";
104 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"") {
108 switch (
$_GET[
"subCmd"]) {
109 case "insertFromWorkspace":
113 case "insertFromRepository":
123 $ilTabs->setSubTabActive(
"cont_new_file");
127 if ($a_form != null) {
132 $this->tpl->setContent(
$form->getHTML());
146 $ilTabs->setSubTabActive(
"cont_file_from_repository");
151 $this->tpl->setContent(
$form->getHTML());
163 if ($a_cmd ==
"insert") {
169 $ilTabs->setSubTabActive(
"cont_file_from_repository");
170 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
172 include_once(
"./Services/COPage/classes/class.ilPCFileItemFileSelectorGUI.php");
180 if (!$exp->handleCommand()) {
181 $tpl->setContent($exp->getHTML());
196 if ($a_cmd ==
"insert") {
202 $ilTabs->setSubTabActive(
"cont_file_from_workspace");
204 include_once(
"./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorerGUI.php");
206 $ilCtrl->setParameter($this,
"subCmd",
"selectFile");
207 $exp->setCustomLinkTarget(
$ilCtrl->getLinkTarget($this, $a_cmd));
208 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
209 $exp->setTypeWhiteList(
array(
"wsrt",
"wfld",
"file"));
210 $exp->setSelectableTypes(
array(
"file"));
211 if ($exp->handleCommand()) {
214 $tpl->setContent($exp->getHTML());
222 include_once(
"./Modules/File/classes/class.ilObjFile.php");
224 $mode = (
$_POST[
"file_ref_id"] !=
"")
228 if (!
$form->checkInput()) {
229 $form->setValuesByPost();
235 if (substr(
$_POST[
"file_ref_id"], 0, 4) ==
"wsp_") {
239 elseif (
$_POST[
"file_ref_id"] == 0) {
241 $fileObj->setType(
"file");
242 $fileObj->setTitle($_FILES[
"file"][
"name"]);
243 $fileObj->setDescription(
"");
244 $fileObj->setFileName($_FILES[
"file"][
"name"]);
245 $fileObj->setFileType($_FILES[
"file"][
"type"]);
246 $fileObj->setFileSize($_FILES[
"file"][
"size"]);
247 $fileObj->setMode(
"filelist");
250 $fileObj->createDirectory();
251 $fileObj->raiseUploadError(
false);
252 $fileObj->getUploadFile(
253 $_FILES[
"file"][
"tmp_name"],
254 $_FILES[
"file"][
"name"]
265 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
267 $this->content_obj->appendItem(
269 $fileObj->getFileName(),
270 $fileObj->getFileType()
273 $this->updated = $this->pg_obj->update();
274 if ($this->updated ===
true) {
275 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
289 $this->tpl->setContent(
$form->getHTML());
303 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
306 if ($a_mode !=
"add_file") {
314 require_once(
"Services/MetaData/classes/class.ilMDLanguageItem.php");
321 if (in_array($a_mode,
array(
"create",
"add_file"))) {
326 } elseif (in_array($a_mode,
array(
"select_file"))) {
330 if (isset(
$_GET[
"file_ref_id"])) {
331 include_once(
"./Modules/File/classes/class.ilObjFile.php");
333 if (is_object($file_obj)) {
336 $hi->setValue((
int) $_GET[
"file_ref_id"]);
339 $ne->setValue($file_obj->getTitle());
341 } elseif (isset(
$_GET[
"fl_wsp_id"])) {
343 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
345 $node =
$tree->getNodeData((
int)
$_GET[
"fl_wsp_id"]);
347 include_once(
"./Modules/File/classes/class.ilObjFile.php");
348 $file_obj =
new ilObjFile($node[
"obj_id"],
false);
349 if (is_object($file_obj)) {
352 $hi->setValue(
"wsp_" . (
int) $node[
"obj_id"]);
355 $ne->setValue($file_obj->getTitle());
357 $this->tpl->parseCurrentBlock();
366 $ti->setValue($this->content_obj->getListTitle());
367 $si->setValue($this->content_obj->getLanguage());
368 $form->addCommandButton(
"saveProperties",
$lng->txt(
"save"));
369 $form->addCommandButton(
"cancelUpdate",
$lng->txt(
"cancel"));
370 $form->setTitle(
$lng->txt(
"cont_edit_file_list_properties"));
378 $s_lang =
$ilUser->getLanguage();
380 $si->setValue($s_lang);
381 $form->addCommandButton(
"create_flst",
$lng->txt(
"save"));
382 $form->addCommandButton(
"cancelCreate",
$lng->txt(
"cancel"));
383 $form->setTitle(
$lng->txt(
"cont_insert_file_list"));
387 $form->addCommandButton(
"insertNewFileItem",
$lng->txt(
"save"));
388 $form->addCommandButton(
"editFiles",
$lng->txt(
"cancel"));
389 $form->setTitle(
$lng->txt(
"cont_insert_file_item"));
404 $this->content_obj->setListTitle(
408 $this->updated = $this->pg_obj->update();
409 if ($this->updated ===
true) {
410 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
412 $this->pg_obj->addHierIDs();
429 $ilToolbar->addButton(
430 $lng->txt(
"cont_add_file"),
431 $ilCtrl->getLinkTarget($this,
"addFileItem")
434 include_once(
"./Services/COPage/classes/class.ilPCFileListTableGUI.php");
436 $tpl->setContent($table_gui->getHTML());
452 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
453 $ilTabs->addSubTabTarget(
455 $ilCtrl->getLinkTarget($this, $cmd),
459 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
460 $ilTabs->addSubTabTarget(
461 "cont_file_from_repository",
462 $ilCtrl->getLinkTarget($this, $cmd),
465 $ilCtrl->setParameter($this,
"subCmd",
"");
467 if (!
$ilSetting->get(
"disable_personal_workspace") &&
469 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
470 $ilTabs->addSubTabTarget(
471 "cont_file_from_workspace",
472 $ilCtrl->getLinkTarget($this, $cmd),
475 $ilCtrl->setParameter($this,
"subCmd",
"");
478 $ilTabs->setBackTarget(
480 $this->ctrl->getParentReturn($this)
484 "cont_ed_edit_files",
485 $ilCtrl->getLinkTarget($this,
"editFiles"),
492 $ilCtrl->getLinkTarget($this,
"edit"),
507 $files = $this->content_obj->getFileList();
520 $ilCtrl->redirectByClass(
"ilpcfileitemgui",
"newItemAfter");
522 $ilCtrl->redirect($this,
"newFileItem");
533 if (is_array(
$_POST[
"fid"])) {
535 foreach (
$_POST[
"fid"] as $k => $v) {
538 $this->content_obj->deleteFileItems($ids);
540 $this->updated = $this->pg_obj->update();
541 $ilCtrl->redirect($this,
"editFiles");
551 if (is_array(
$_POST[
"position"])) {
552 $this->content_obj->savePositions(
$_POST[
"position"]);
554 $this->updated = $this->pg_obj->update();
555 $ilCtrl->redirect($this,
"editFiles");
565 if (is_array(
$_POST[
"position"])) {
566 $this->content_obj->savePositions(
$_POST[
"position"]);
568 if (is_array(
$_POST[
"class"])) {
569 $this->content_obj->saveStyleClasses(
$_POST[
"class"]);
571 $this->updated = $this->pg_obj->update();
572 $ilCtrl->redirect($this,
"editFiles");
583 $classes = $this->content_obj->getAllClasses();
584 if (count($chars) > 1) {
587 foreach ($classes as $class) {
588 if ($class !=
"" && $class !=
"FileListItem") {
611 if (
$_GET[
"subCmd"] ==
"insertNew") {
612 $_SESSION[
"cont_file_insert"] =
"insertNew";
614 if (
$_GET[
"subCmd"] ==
"insertFromRepository") {
615 $_SESSION[
"cont_file_insert"] =
"insertFromRepository";
617 if (
$_GET[
"subCmd"] ==
"insertFromWorkspace") {
618 $_SESSION[
"cont_file_insert"] =
"insertFromWorkspace";
620 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_file_insert"] !=
"") {
624 switch (
$_GET[
"subCmd"]) {
625 case "insertFromWorkspace":
629 case "insertFromRepository":
639 $ilTabs->setSubTabActive(
"cont_new_file");
644 $this->tpl->setContent(
$form->getHTML());
657 if (isset(
$_GET[
"fl_wsp_id"])) {
659 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
661 $node =
$tree->getNodeData(
$_GET[
"fl_wsp_id"]);
663 include_once(
"./Modules/File/classes/class.ilObjFile.php");
664 $file_obj =
new ilObjFile($node[
"obj_id"],
false);
667 elseif ($a_file_ref_id == 0) {
672 include_once(
"./Modules/File/classes/class.ilObjFile.php");
673 $file_obj =
new ilObjFile($a_file_ref_id);
675 if (is_object($file_obj)) {
676 $this->content_obj->appendItem(
678 $file_obj->getTitle(),
679 $file_obj->getFileType()
681 $this->updated = $this->pg_obj->update();
682 if ($this->updated ===
true) {
684 $this->ctrl->redirect($this,
"editFiles");
688 $_GET[
"subCmd"] =
"-";
699 if ($_FILES[
"file"][
"name"] ==
"") {
700 $_GET[
"subCmd"] =
"-";
709 include_once(
"./Modules/File/classes/class.ilObjFile.php");
711 $fileObj->setType(
"file");
712 $fileObj->setTitle($_FILES[
"file"][
"name"]);
713 $fileObj->setDescription(
"");
714 $fileObj->setFileName($_FILES[
"file"][
"name"]);
715 $fileObj->setFileType($_FILES[
"file"][
"type"]);
716 $fileObj->setFileSize($_FILES[
"file"][
"size"]);
717 $fileObj->setMode(
"filelist");
719 $fileObj->raiseUploadError(
false);
721 $fileObj->createDirectory();
722 $fileObj->getUploadFile(
723 $_FILES[
"file"][
"tmp_name"],
724 $_FILES[
"file"][
"name"]
742 $this->ctrl->getParentReturn($this),
748 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
749 $ilTabs->addSubTabTarget(
751 $ilCtrl->getLinkTarget($this, $a_cmd),
755 $ilCtrl->setParameter($this,
"subCmd",
"insertFromRepository");
756 $ilTabs->addSubTabTarget(
757 "cont_file_from_repository",
758 $ilCtrl->getLinkTarget($this, $a_cmd),
761 $ilCtrl->setParameter($this,
"subCmd",
"");
763 if (!
$ilSetting->get(
"disable_personal_workspace") &&
765 $ilCtrl->setParameter($this,
"subCmd",
"insertFromWorkspace");
766 $ilTabs->addSubTabTarget(
767 "cont_file_from_workspace",
768 $ilCtrl->getLinkTarget($this, $a_cmd),
771 $ilCtrl->setParameter($this,
"subCmd",
"");
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
edit()
edit properties form
newFileItem()
New file item (called, if there is no file item in an existing)
insertFromWorkspace($a_cmd="insert")
Insert file from personal workspace.
setTabs($a_create=true)
Set Tabs.
setItemTabs($a_cmd="")
output tabs
initEditForm($a_mode="edit")
Init edit form.
createFileItem()
insert new file item
deleteFileItem()
Delete file items from list.
__construct(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
Constructor public.
Tree handler for personal workspace.
setCharacteristics($a_chars)
Set Characteristics.
insert($a_form=null)
insert new file list form
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
executeCommand()
execute command
Select files for file list.
insertNewFileItem($a_file_ref_id=0)
insert new file item after another item
if(isset($_POST['submit'])) $form
Explorer for selecting a personal workspace item.
displayValidationError()
display validation errors
This class represents a text property in a property form.
insertFromRepository($a_cmd="insert")
Insert file from repository.
setMaxLength($a_maxlength)
Set Max Length.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
getCharacteristics()
Get characteristics.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
checkStyleSelection()
Checks whether style selection shoudl be available or not.
This class represents a non editable value in a property form.
create()
create new file list in dom and update page in db
saveProperties()
save table properties in db and return to page edit screen
TableGUI class for file list.
savePositionsAndClasses()
Save positions of file items and style classes.
addFileItem()
Add file item.
savePositions()
Save positions of file items.