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.ilPCFileList.php");
00025 require_once("./content/classes/Pages/class.ilPageContentGUI.php");
00026
00037 class ilPCFileListGUI extends ilPageContentGUI
00038 {
00039
00044 function ilPCFileListGUI(&$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 insert()
00074 {
00075 global $ilUser;
00076
00077 $this->setTabs();
00078
00079
00080 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.file_list_new.html", "content");
00081 $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_insert_file_list"));
00082 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00083
00084 $this->displayValidationError();
00085
00086 if ($_SESSION["il_text_lang_".$_GET["ref_id"]] != "")
00087 {
00088 $s_lang = $_SESSION["il_text_lang_".$_GET["ref_id"]];
00089 }
00090 else
00091 {
00092 $s_lang = $ilUser->getLanguage();
00093 }
00094
00095
00096
00097 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("title"));
00098 $this->tpl->setVariable("INPUT_TITLE", "flst_title");
00099 $this->tpl->setVariable("TXT_FILE", $this->lng->txt("file"));
00100
00101
00102 $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
00103 $lang = ilMetaData::getLanguages();
00104 $select_lang = ilUtil::formSelect ($s_lang, "flst_language",$lang,false,true);
00105 $this->tpl->setVariable("SELECT_LANGUAGE", $select_lang);
00106
00107
00108 $this->tpl->parseCurrentBlock();
00109
00110
00111 $this->tpl->setCurrentBlock("commands");
00112 $this->tpl->setVariable("BTN_NAME", "create_flst");
00113 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
00114 $this->tpl->setVariable("BTN_CANCEL", "cancelCreate");
00115 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00116 $this->tpl->parseCurrentBlock();
00117
00118 }
00119
00120
00124 function create()
00125 {
00126 include_once("classes/class.ilObjFile.php");
00127 $fileObj = new ilObjFile();
00128 $fileObj->setType("file");
00129 $fileObj->setTitle($_FILES["Fobject"]["name"]["file"]);
00130 $fileObj->setDescription("");
00131 $fileObj->setFileName($_FILES["Fobject"]["name"]["file"]);
00132 $fileObj->setFileType($_FILES["Fobject"]["type"]["file"]);
00133 $fileObj->setMode("filelist");
00134 $fileObj->create();
00135
00136 $fileObj->createDirectory();
00137 $fileObj->raiseUploadError(false);
00138 $fileObj->getUploadFile($_FILES["Fobject"]["tmp_name"]["file"],
00139 $_FILES["Fobject"]["name"]["file"]);
00140
00141 $_SESSION["il_text_lang_".$_GET["ref_id"]] = $_POST["flst_language"];
00142
00143
00144 $this->content_obj = new ilPCFileList($this->dom);
00145 $this->content_obj->create($this->pg_obj, $this->hier_id);
00146 $this->content_obj->setListTitle(ilUtil::stripSlashes($_POST["flst_title"]), $_POST["flst_language"]);
00147 $this->content_obj->appendItem($fileObj->getId(), $fileObj->getFileName(),
00148 $fileObj->getFileType());
00149 $this->updated = $this->pg_obj->update();
00150 if ($this->updated === true)
00151 {
00152 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
00153 }
00154 else
00155 {
00156 $this->insert();
00157 }
00158 }
00159
00163 function edit()
00164 {
00165 $this->setTabs();
00166
00167
00168 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.file_list_edit.html", "content");
00169 $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_edit_file_list_properties"));
00170 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00171
00172 $this->displayValidationError();
00173
00174
00175 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("title"));
00176 $this->tpl->setVariable("INPUT_TITLE", "flst_title");
00177
00178
00179
00180 $this->tpl->setVariable("VALUE_TITLE", $this->content_obj->getListTitle());
00181
00182
00183 $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
00184 $lang = ilMetaData::getLanguages();
00185 $select_lang = ilUtil::formSelect ($this->content_obj->getLanguage(),"flst_language",$lang,false,true);
00186 $this->tpl->setVariable("SELECT_LANGUAGE", $select_lang);
00187
00188
00189 $this->tpl->parseCurrentBlock();
00190
00191
00192 $this->tpl->setCurrentBlock("commands");
00193 $this->tpl->setVariable("BTN_NAME", "saveProperties");
00194 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
00195 $this->tpl->setVariable("BTN_CANCEL", "cancelUpdate");
00196 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00197 $this->tpl->parseCurrentBlock();
00198
00199 }
00200
00201
00205 function saveProperties()
00206 {
00207 $this->content_obj->setListTitle(ilUtil::stripSlashes($_POST["flst_title"]),
00208 $_POST["flst_language"]);
00209 $this->updated = $this->pg_obj->update();
00210 if ($this->updated === true)
00211 {
00212 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
00213 }
00214 else
00215 {
00216 $this->pg_obj->addHierIDs();
00217 $this->edit();
00218 }
00219 }
00220
00224 function setTabs()
00225 {
00226 global $ilTabs;
00227
00228
00229 #include_once("classes/class.ilTabsGUI.php");
00230 #$tabs_gui =& new ilTabsGUI();
00231 $this->getTabs($ilTabs);
00232 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
00233 }
00234
00240 function getTabs(&$tabs_gui)
00241 {
00242
00243
00244
00245
00246
00247
00248 }
00249
00250 }
00251 ?>