00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00034
00035
00036
00037
00038
00039 include_once "class.ilObjectGUI.php";
00040
00041 class ilObjStyleSheetFolderGUI extends ilObjectGUI
00042 {
00047 function ilObjStyleSheetFolderGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output = true)
00048 {
00049 $this->type = "styf";
00050 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
00051 }
00052
00057 function saveObject()
00058 {
00059 global $rbacadmin;
00060
00061
00062 $newObj = parent::saveObject();
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 ilUtil::sendInfo($this->lng->txt("object_added"),true);
00074
00075 ilUtil::redirect($this->getReturnLocation("save",$this->ctrl->getLinkTarget($this,"")));
00076 }
00077
00081 function viewObject()
00082 {
00083 global $rbacsystem, $ilias;
00084
00085 if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00086 {
00087 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00088 }
00089
00090 include_once "./Services/Table/classes/class.ilTableGUI.php";
00091
00092
00093 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00094
00095
00096 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.styf_row.html");
00097
00098 $num = 0;
00099
00100
00101
00102
00103 $tbl = new ilTableGUI();
00104
00105
00106 $tbl->setTitle($this->object->getTitle(),"icon_styf.gif",
00107 $this->lng->txt("obj_".$this->object->getType()));
00108
00109
00110
00111
00112 $header_names = array("", $this->lng->txt("title"),
00113 $this->lng->txt("purpose"));
00114 $tbl->setHeaderNames($header_names);
00115
00116 $header_params = array("ref_id" => $this->ref_id);
00117 $tbl->setHeaderVars(array("", "title", "purpose"), $header_params);
00118 $tbl->setColumnWidth(array("0%", "80%", "20%"));
00119
00120
00121 $tbl->setOrderColumn($_GET["sort_by"]);
00122 $tbl->setOrderDirection($_GET["sort_order"]);
00123 $tbl->setLimit($_GET["limit"]);
00124 $tbl->setOffset($_GET["offset"]);
00125
00126
00127 $style_entries = array();
00128 $styles = $this->object->getStyles();
00129 foreach($styles as $style)
00130 {
00131 $style_entries[$style["title"].":".$style["id"]]
00132 = $style;
00133 }
00134 ksort($style_entries);
00135
00136
00137 $tbl->setMaxCount(count($style_entries));
00138
00139 $this->tpl->setVariable("COLUMN_COUNTS", 3);
00140
00141
00142 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00143
00144 $this->showActions(true);
00145
00146 include_once ("classes/class.ilObjStyleSheet.php");
00147
00148 $fixed_style = $ilias->getSetting("fixed_content_style_id");
00149 $default_style = $ilias->getSetting("default_content_style_id");
00150
00151 foreach ($style_entries as $style)
00152 {
00153 $this->tpl->setCurrentBlock("style_row");
00154
00155
00156 $css_row = ($css_row == "tblrow2")
00157 ? "tblrow1"
00158 : "tblrow2";
00159
00160 $this->tpl->setVariable("CHECKBOX_ID", $style["id"]);
00161 $this->tpl->setVariable("TXT_TITLE", $style["title"]);
00162 $this->tpl->setVariable("TXT_DESC", ilObject::_lookupDescription($style["id"]));
00163
00164
00165
00166 $this->tpl->setVariable("ROWCOL", $css_row);
00167 if ($style["id"] == $fixed_style)
00168 {
00169 $this->tpl->setVariable("TXT_PURPOSE", $this->lng->txt("global_fixed"));
00170 }
00171 if ($style["id"] == $default_style)
00172 {
00173 $this->tpl->setVariable("TXT_PURPOSE", $this->lng->txt("global_default"));
00174 }
00175 $this->tpl->parseCurrentBlock();
00176
00177 $this->tpl->setCurrentBlock("tbl_content");
00178 $this->tpl->parseCurrentBlock();
00179
00180 }
00181
00182 if (count($style_entries) == 0)
00183 {
00184 $tbl->disable("header");
00185 $tbl->disable("footer");
00186
00187 $this->tpl->setCurrentBlock("text");
00188 $this->tpl->setVariable("TXT_CONTENT", $this->lng->txt("obj_not_found"));
00189 $this->tpl->parseCurrentBlock();
00190
00191 $this->tpl->setCurrentBlock("tbl_content");
00192 $this->tpl->parseCurrentBlock();
00193 }
00194
00195
00196
00197
00198 $tbl->render();
00199 }
00200
00206 function deleteStyleObject($a_error = false)
00207 {
00208 if (!isset($_POST["id"]))
00209 {
00210 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00211 }
00212
00213
00214 $_SESSION["saved_post"] = $_POST["id"];
00215
00216 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html");
00217
00218 if(!$a_error)
00219 {
00220 ilUtil::sendInfo($this->lng->txt("info_delete_sure"));
00221 }
00222
00223
00224
00225
00226
00227 $this->tpl->setCurrentBlock("table_header");
00228 $this->tpl->setVariable("TEXT", $this->lng->txt("objects"));
00229 $this->tpl->parseCurrentBlock();
00230
00231
00232
00233
00234 $counter = 0;
00235
00236 foreach ($_POST["id"] as $id)
00237 {
00238 $this->tpl->setCurrentBlock("table_row");
00239 $this->tpl->setVariable("IMG_OBJ",ilUtil::getImagePath("icon_styf.gif"));
00240 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
00241 $this->tpl->setVariable("TEXT_CONTENT",ilObject::_lookupTitle($id));
00242 $this->tpl->parseCurrentBlock();
00243 }
00244
00245
00246
00247
00248 $buttons = array("confirmedDelete" => $this->lng->txt("confirm"),
00249 "cancelDelete" => $this->lng->txt("cancel"));
00250 foreach ($buttons as $name => $value)
00251 {
00252 $this->tpl->setCurrentBlock("operation_btn");
00253 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
00254 $this->tpl->setVariable("BTN_NAME",$name);
00255 $this->tpl->setVariable("BTN_VALUE",$value);
00256 $this->tpl->parseCurrentBlock();
00257 }
00258 }
00259
00260
00264 function confirmedDeleteObject()
00265 {
00266 global $ilias;
00267
00268 foreach($_SESSION["saved_post"] as $id)
00269 {
00270 $this->object->removeStyle($id);
00271 $style_obj =& $ilias->obj_factory->getInstanceByObjId($id);
00272 $style_obj->delete();
00273 }
00274 $this->object->update();
00275
00276 ilUtil::redirect($this->getReturnLocation("delete",$this->ctrl->getLinkTarget($this,"")));
00277 }
00278
00279
00285 function toggleGlobalDefaultObject()
00286 {
00287 global $ilias;
00288
00289 if (!isset($_POST["id"]))
00290 {
00291 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00292 }
00293 if(count($_POST["id"]) > 1)
00294 {
00295 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
00296 }
00297
00298 $ilias->deleteSetting("fixed_content_style_id");
00299 $def_style = $ilias->getSetting("default_content_style_id");
00300
00301 if ($def_style != $_POST["id"][0])
00302 {
00303 $ilias->setSetting("default_content_style_id", $_POST["id"][0]);
00304 }
00305 else
00306 {
00307 $ilias->deleteSetting("default_content_style_id");
00308 }
00309
00310 ilUtil::redirect($this->ctrl->getLinkTarget($this,"view"));
00311 }
00312
00318 function toggleGlobalFixedObject()
00319 {
00320 global $ilias;
00321
00322 if (!isset($_POST["id"]))
00323 {
00324 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00325 }
00326 if(count($_POST["id"]) > 1)
00327 {
00328 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
00329 }
00330
00331 $ilias->deleteSetting("default_content_style_id");
00332 $fixed_style = $ilias->getSetting("fixed_content_style_id");
00333 if ($fixed_style == $_POST["id"][0])
00334 {
00335 $ilias->deleteSetting("fixed_content_style_id");
00336 }
00337 else
00338 {
00339 $ilias->setSetting("fixed_content_style_id", $_POST["id"][0]);
00340 }
00341 ilUtil::redirect($this->ctrl->getLinkTarget($this,"view"));
00342 }
00343
00344
00351 function showActions($with_subobjects = false)
00352 {
00353
00354
00355 $this->tpl->setCurrentBlock("tbl_action_btn");
00356 $this->tpl->setVariable("BTN_NAME", "deleteStyle");
00357 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
00358 $this->tpl->parseCurrentBlock();
00359
00360
00361 $this->tpl->setCurrentBlock("tbl_action_btn");
00362 $this->tpl->setVariable("BTN_NAME", "toggleGlobalDefault");
00363 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("toggleGlobalDefault"));
00364 $this->tpl->parseCurrentBlock();
00365
00366
00367 $this->tpl->setCurrentBlock("tbl_action_btn");
00368 $this->tpl->setVariable("BTN_NAME", "toggleGlobalFixed");
00369 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("toggleGlobalFixed"));
00370 $this->tpl->parseCurrentBlock();
00371
00372 if ($with_subobjects === true)
00373 {
00374 $this->showPossibleSubObjects();
00375 }
00376
00377 $this->tpl->setCurrentBlock("tbl_action_row");
00378 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00379 $this->tpl->parseCurrentBlock();
00380 }
00381
00382
00388 function getTabs(&$tabs_gui)
00389 {
00390
00391
00392 }
00393 }
00394 ?>