Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 require_once("./content/classes/Pages/class.ilPCListItem.php");
00025 require_once("./content/classes/Pages/class.ilPageContentGUI.php");
00026
00037 class ilPCFileItemGUI extends ilPageContentGUI
00038 {
00039
00044 function ilPCFileItemGUI(&$a_pg_obj, &$a_content_obj, $a_hier_id)
00045 {
00046 parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id);
00047 }
00048
00052 function &executeCommand()
00053 {
00054
00055 $next_class = $this->ctrl->getNextClass($this);
00056
00057
00058 $cmd = $this->ctrl->getCmd();
00059
00060 switch($next_class)
00061 {
00062 default:
00063 $ret =& $this->$cmd();
00064 break;
00065 }
00066
00067 return $ret;
00068 }
00069
00073 function newFileItem()
00074 {
00075 include_once("classes/class.ilObjFile.php");
00076 $fileObj = new ilObjFile();
00077 $fileObj->setType("file");
00078 $fileObj->setTitle($_FILES["Fobject"]["name"]["file"]);
00079 $fileObj->setDescription("");
00080 $fileObj->setFileName($_FILES["Fobject"]["name"]["file"]);
00081 $fileObj->setFileType($_FILES["Fobject"]["type"]["file"]);
00082 $fileObj->setMode("filelist");
00083 $fileObj->create();
00084 $fileObj->raiseUploadError(false);
00085
00086 $fileObj->createDirectory();
00087 $fileObj->getUploadFile($_FILES["Fobject"]["tmp_name"]["file"],
00088 $_FILES["Fobject"]["name"]["file"]);
00089
00090 $this->file_object =& $fileObj;
00091 }
00092
00093
00097 function newItemAfter()
00098 {
00099 $this->setTabs();
00100
00101
00102 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.file_item_edit.html", "content");
00103 $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_insert_file_item"));
00104 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00105
00106 $this->displayValidationError();
00107
00108
00109 $this->tpl->setVariable("TXT_FILE", $this->lng->txt("file"));
00110
00111 $this->tpl->parseCurrentBlock();
00112
00113
00114 $this->tpl->setCurrentBlock("commands");
00115 $this->tpl->setVariable("BTN_NAME", "insertNewItemAfter");
00116 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
00117 $this->tpl->parseCurrentBlock();
00118
00119 }
00120
00124 function insertNewItemAfter()
00125 {
00126 $this->newFileItem();
00127 $this->content_obj->newItemAfter($this->file_object->getId(),
00128 $this->file_object->getFileName(), $this->file_object->getFileType());
00129 $this->updated = $this->pg_obj->update();
00130 if ($this->updated === true)
00131 {
00132 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
00133 }
00134 else
00135 {
00136 $this->newItemAfter();
00137 }
00138 }
00139
00143 function newItemBefore()
00144 {
00145 $this->setTabs();
00146
00147
00148 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.file_item_edit.html", "content");
00149 $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_insert_file_item"));
00150 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00151
00152 $this->displayValidationError();
00153
00154
00155 $this->tpl->setVariable("TXT_FILE", $this->lng->txt("file"));
00156
00157 $this->tpl->parseCurrentBlock();
00158
00159
00160 $this->tpl->setCurrentBlock("commands");
00161 $this->tpl->setVariable("BTN_NAME", "insertNewItemBefore");
00162 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
00163 $this->tpl->parseCurrentBlock();
00164
00165 }
00166
00170 function insertNewItemBefore()
00171 {
00172 $this->newFileItem();
00173 $this->content_obj->newItemBefore($this->file_object->getId(),
00174 $this->file_object->getFileName(), $this->file_object->getFileType());
00175 $this->updated = $this->pg_obj->update();
00176 if ($this->updated === true)
00177 {
00178 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
00179 }
00180 else
00181 {
00182 $this->newItemBefore();
00183 }
00184 }
00185
00189 function deleteItem()
00190 {
00191 $this->content_obj->deleteItem();
00192 $_SESSION["il_pg_error"] = $this->pg_obj->update();
00193 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
00194 }
00195
00199 function setTabs()
00200 {
00201 global $ilTabs;
00202
00203 #include_once("classes/class.ilTabsGUI.php");
00204 #$tabs_gui =& new ilTabsGUI();
00205 $this->getTabs($ilTabs);
00206 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
00207 }
00208
00214 function getTabs(&$tabs_gui)
00215 {
00216
00217 $tabs_gui->addTarget("cont_back",
00218 $this->ctrl->getParentReturn($this), "",
00219 "");
00220 }
00221
00225 function moveItemDown()
00226 {
00227 $this->content_obj->moveItemDown();
00228 $_SESSION["il_pg_error"] = $this->pg_obj->update();
00229 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
00230 }
00231
00235 function moveItemUp()
00236 {
00237 $this->content_obj->moveItemUp();
00238 $_SESSION["il_pg_error"] = $this->pg_obj->update();
00239 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
00240 }
00241
00242
00243 }
00244 ?>