00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00036 include_once "class.ilObjectGUI.php";
00037
00038 class ilObjStyleSettingsGUI extends ilObjectGUI
00039 {
00044 function ilObjStyleSettingsGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output = true)
00045 {
00046 global $lng;
00047
00048 $this->type = "stys";
00049 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
00050
00051 $lng->loadLanguageModule("style");
00052 }
00053
00054 function &executeCommand()
00055 {
00056 $next_class = $this->ctrl->getNextClass($this);
00057 $cmd = $this->ctrl->getCmd();
00058 $this->prepareOutput();
00059
00060 switch($next_class)
00061 {
00062 case 'ilpermissiongui':
00063 include_once("./classes/class.ilPermissionGUI.php");
00064 $perm_gui =& new ilPermissionGUI($this);
00065 $ret =& $this->ctrl->forwardCommand($perm_gui);
00066 break;
00067
00068 default:
00069 if ($cmd == "" || $cmd == "view")
00070 {
00071 $cmd = "editBasicSettings";
00072 }
00073 $cmd .= "Object";
00074 $this->$cmd();
00075
00076 break;
00077 }
00078 return true;
00079 }
00080
00085 function saveObject()
00086 {
00087 global $rbacadmin;
00088
00089
00090 $newObj = parent::saveObject();
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 sendInfo($this->lng->txt("object_added"),true);
00102
00103 ilUtil::redirect($this->getReturnLocation("save",$this->ctrl->getLinkTarget($this,"")));
00104 }
00105
00109 function editBasicSettingsObject()
00110 {
00111 global $rbacsystem;
00112
00113 if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00114 {
00115 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00116 }
00117
00118 $this->tpl->addBlockfile("ADM_CONTENT", "style_basic_settings", "tpl.stys_basic_settings.html");
00119 $this->tpl->setCurrentBlock("style_settings");
00120
00121 $settings = $this->ilias->getAllSettings();
00122
00123 $this->tpl->setVariable("FORMACTION_STYLESETTINGS", $this->ctrl->getFormAction($this));
00124
00125 $this->tpl->setVariable("TXT_TREE_FRAME", $this->lng->txt("tree_frame"));
00126 $this->tpl->setVariable("TXT_TREE_FRAME_INFO", $this->lng->txt("tree_frame_info"));
00127 $this->tpl->setVariable("TXT_FRAME_LEFT", $this->lng->txt("tree_left"));
00128 $this->tpl->setVariable("TXT_FRAME_RIGHT", $this->lng->txt("tree_right"));
00129
00130 $this->tpl->setVariable("TXT_STYLE_SETTINGS", $this->lng->txt("basic_settings"));
00131 $this->tpl->setVariable("TXT_ICONS_IN_TYPED_LISTS", $this->lng->txt("icons_in_typed_lists"));
00132 $this->tpl->setVariable("TXT_ICONS_IN_HEADER", $this->lng->txt("icons_in_header"));
00133 $this->tpl->setVariable("TXT_ICONS_IN_ITEM_ROWS", $this->lng->txt("icons_in_item_rows"));
00134 $this->tpl->setVariable("TXT_ICONS_IN_TYPED_LISTS_INFO", $this->lng->txt("icons_in_typed_lists_info"));
00135
00136 $this->tpl->setVariable("TXT_ENABLE_CUSTOM_ICONS", $this->lng->txt("enable_custom_icons"));
00137 $this->tpl->setVariable("TXT_ENABLE_CUSTOM_ICONS_INFO", $this->lng->txt("enable_custom_icons_info"));
00138 $this->tpl->setVariable("TXT_CUSTOM_ICON_SIZE_BIG", $this->lng->txt("custom_icon_size_big"));
00139 $this->tpl->setVariable("TXT_CUSTOM_ICON_SIZE_SMALL", $this->lng->txt("custom_icon_size_small"));
00140 $this->tpl->setVariable("TXT_WIDTH_X_HEIGHT", $this->lng->txt("width_x_height"));
00141 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
00142
00143
00144 if ($settings["tree_frame"] == "right")
00145 {
00146 $this->tpl->setVariable("SEL_FRAME_RIGHT","selected=\"selected\"");
00147 }
00148 else
00149 {
00150 $this->tpl->setVariable("SEL_FRAME_LEFT","selected=\"selected\"");
00151 }
00152
00153 if ($settings["custom_icons"])
00154 {
00155 $this->tpl->setVariable("CHK_CUSTOM_ICONS","checked=\"checked\"");
00156 }
00157 if ($settings["icon_position_in_lists"] == "item_rows")
00158 {
00159 $this->tpl->setVariable("SEL_ICON_POS_ITEM_ROWS","selected=\"selected\"");
00160 }
00161 else
00162 {
00163 $this->tpl->setVariable("SEL_ICON_POS_HEADER","selected=\"selected\"");
00164 }
00165 $this->tpl->setVariable("CUST_ICON_BIG_WIDTH", $settings["custom_icon_big_width"]);
00166 $this->tpl->setVariable("CUST_ICON_BIG_HEIGHT", $settings["custom_icon_big_height"]);
00167 $this->tpl->setVariable("CUST_ICON_SMALL_WIDTH", $settings["custom_icon_small_width"]);
00168 $this->tpl->setVariable("CUST_ICON_SMALL_HEIGHT", $settings["custom_icon_small_height"]);
00169
00170 $this->tpl->parseCurrentBlock();
00171 }
00172
00176 function saveBasicStyleSettingsObject()
00177 {
00178 $this->ilias->setSetting("tree_frame", $_POST["tree_frame"]);
00179 $this->ilias->setSetting("icon_position_in_lists", $_POST["icon_position_in_lists"]);
00180 $this->ilias->setSetting("custom_icons", $_POST["custom_icons"]);
00181 $this->ilias->setSetting("custom_icon_big_width", (int) $_POST["custom_icon_big_width"]);
00182 $this->ilias->setSetting("custom_icon_big_height", (int) $_POST["custom_icon_big_height"]);
00183 $this->ilias->setSetting("custom_icon_small_width", (int) $_POST["custom_icon_small_width"]);
00184 $this->ilias->setSetting("custom_icon_small_height", (int) $_POST["custom_icon_small_height"]);
00185 sendInfo($this->lng->txt("msg_obj_modified"), true);
00186 ilUtil::redirect($this->ctrl->getLinkTarget($this,"editBasicSettings"));
00187 }
00188
00192 function editContentStylesObject()
00193 {
00194 global $rbacsystem, $ilias;
00195
00196 if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00197 {
00198 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00199 }
00200
00201 include_once "./classes/class.ilTableGUI.php";
00202
00203
00204 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.styf_content_styles.html");
00205
00206
00207 $this->tpl->addBlockfile("STYLE_TABLE", "style_table", "tpl.table.html");
00208
00209
00210 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.styf_row.html");
00211
00212 $num = 0;
00213
00214 $this->tpl->setVariable("FORMACTION",
00215 $this->ctrl->getFormAction($this));
00216
00217
00218 $tbl = new ilTableGUI();
00219
00220
00221 $tbl->setTitle($this->lng->txt("content_styles"),"icon_sty.gif",
00222 $this->lng->txt("content_styles"));
00223
00224
00225
00226
00227 $header_names = array("", $this->lng->txt("title"),
00228 $this->lng->txt("sty_nr_learning_modules"),
00229 $this->lng->txt("purpose"), $this->lng->txt("sty_scope"),
00230 $this->lng->txt("active"));
00231 $tbl->setHeaderNames($header_names);
00232
00233 $header_params = array("ref_id" => $this->ref_id);
00234 $tbl->setHeaderVars(array("", "title", "nr_lms", "purpose", "scope", "active"), $header_params);
00235 $tbl->setColumnWidth(array("1px", "", "", "", ""));
00236
00237
00238 $tbl->setOrderColumn($_GET["sort_by"]);
00239 $tbl->setOrderDirection($_GET["sort_order"]);
00240 $tbl->setLimit($_GET["limit"]);
00241 $tbl->setOffset($_GET["offset"]);
00242 $tbl->disable("sort");
00243
00244
00245 $style_entries = array();
00246 $styles = $this->object->getStyles();
00247 foreach($styles as $style)
00248 {
00249 $style_entries[$style["title"].":".$style["id"]]
00250 = $style;
00251 }
00252 ksort($style_entries);
00253 $from_styles = $to_styles = array();
00254
00255 include_once("content/classes/class.ilObjContentObject.php");
00256
00257
00258 if ($fixed_style <= 0)
00259 {
00260 $style_entries[-1] =
00261 array("title" => $this->lng->txt("sty_individual_styles"),
00262 "id" => 0, "nr" => ilObjContentObject::_getNrLMsIndividualStyles());
00263 $from_styles[-1] = $this->lng->txt("sty_individual_styles");
00264 }
00265
00266
00267 if ($default_style <= 0 && $fixed_style <= 0)
00268 {
00269 $style_entries[0] =
00270 array("title" => $this->lng->txt("sty_default_style"),
00271 "id" => 0, "nr" => ilObjContentObject::_getNrLMsNoStyle());
00272 $from_styles[0] = $this->lng->txt("sty_default_style");
00273 $to_styles[0] = $this->lng->txt("sty_default_style");
00274 }
00275
00276
00277 $tbl->setMaxCount(count($style_entries));
00278
00279 $this->tpl->setVariable("COLUMN_COUNTS", 6);
00280
00281
00282 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00283
00284 $this->showActions(true);
00285 $table_empty = true;
00286
00287 include_once ("classes/class.ilObjStyleSheet.php");
00288
00289 $fixed_style = $ilias->getSetting("fixed_content_style_id");
00290 $default_style = $ilias->getSetting("default_content_style_id");
00291
00292 foreach ($style_entries as $style)
00293 {
00294
00295 $css_row = ($css_row == "tblrow2")
00296 ? "tblrow1"
00297 : "tblrow2";
00298
00299
00300 if ($style["id"] > 0)
00301 {
00302 $this->tpl->setCurrentBlock("check_box");
00303 $this->tpl->setVariable("CHECKBOX_ID", $style["id"]);
00304 $this->tpl->parseCurrentBlock();
00305 }
00306
00307
00308 if ($fixed_style <= 0 && $style["id"] > 0)
00309 {
00310 $this->tpl->setCurrentBlock("active_box");
00311 if (ilObjStyleSheet::_lookupActive($style["id"]))
00312 {
00313 $this->tpl->setVariable("CHECKED_STY", 'checked="checked"');
00314 }
00315 $this->tpl->setVariable("ACTIVE_ID", $style["id"]);
00316 $this->tpl->parseCurrentBlock();
00317 }
00318
00319
00320 if ($style["id"] > 0)
00321 {
00322 $this->ctrl->setParameterByClass("ilobjstylesheetgui", "obj_id", $style["id"]);
00323 $this->tpl->setCurrentBlock("linka");
00324 $this->tpl->setVariable("TXT_TITLE", $style["title"]);
00325 $this->tpl->setVariable("LINK_STYLE",
00326 $this->ctrl->getLinkTargetByClass("ilobjstylesheetgui"), "view");
00327 $this->tpl->parseCurrentBlock();
00328 }
00329 else
00330 {
00331 $this->tpl->setCurrentBlock("texta");
00332 $this->tpl->setVariable("TXT_TEXT", $style["title"]);
00333 $this->tpl->parseCurrentBlock();
00334 }
00335
00336 $this->tpl->setCurrentBlock("style_row");
00337
00338
00339 if ($style["id"] > 0)
00340 {
00341 $nr_lm = ilObjContentObject::_getNrOfAssignedLMs($style["id"]);
00342
00343
00344 if ($nr_lm > 0)
00345 {
00346 $from_styles[$style["id"]] = $style["title"];
00347 }
00348 if (ilObjStyleSheet::_lookupActive($style["id"]))
00349 {
00350 $to_styles[$style["id"]] = $style["title"];
00351 }
00352
00353 $this->tpl->setVariable("TXT_NR_LEARNING_MODULES", $nr_lm);
00354 $this->tpl->setVariable("TXT_DESC", ilObject::_lookupDescription($style["id"]));
00355 }
00356 else
00357 {
00358 $this->tpl->setVariable("TXT_NR_LEARNING_MODULES", $style["nr"]);
00359 }
00360
00361 $this->tpl->setVariable("ROWCOL", $css_row);
00362
00363
00364 if ($style["id"] > 0)
00365 {
00366 if ($style["id"] == $fixed_style)
00367 {
00368 $this->tpl->setVariable("TXT_PURPOSE", $this->lng->txt("global_fixed"));
00369 }
00370 if ($style["id"] == $default_style)
00371 {
00372 $this->tpl->setVariable("TXT_PURPOSE", $this->lng->txt("global_default"));
00373 }
00374 if ($style["category"] > 0)
00375 {
00376 $this->tpl->setVariable("TXT_SCOPE",
00377 ilObject::_lookupTitle(
00378 ilObject::_lookupObjId($style["category"])
00379 ));
00380 }
00381 }
00382 $this->tpl->parseCurrentBlock();
00383
00384 $this->tpl->setCurrentBlock("tbl_content");
00385 $this->tpl->parseCurrentBlock();
00386
00387 }
00388
00389 if (count($style_entries) == 0)
00390 {
00391 $tbl->disable("header");
00392 $tbl->disable("footer");
00393
00394 $this->tpl->setCurrentBlock("text");
00395 $this->tpl->setVariable("TXT_CONTENT", $this->lng->txt("obj_not_found"));
00396 $this->tpl->parseCurrentBlock();
00397
00398 $this->tpl->setCurrentBlock("tbl_content");
00399 $this->tpl->parseCurrentBlock();
00400 }
00401
00402
00403 $tbl->render();
00404
00405
00406
00407 $this->tpl->setCurrentBlock("adm_content");
00408 $this->tpl->setVariable("TXT_MOVE_LM_STYLE", $this->lng->txt("sty_move_lm_styles"));
00409 $this->tpl->setVariable("TXT_FROM", $this->lng->txt("from"));
00410 $this->tpl->setVariable("TXT_TO", $this->lng->txt("to"));
00411 $this->tpl->setVariable("TXT_MOVE_LM_STYLE", $this->lng->txt("sty_move_lm_styles"));
00412 $this->tpl->setVariable("TXT_MOVE_STYLE", $this->lng->txt("sty_move_style"));
00413 $this->tpl->setVariable("SELECT_FROM",
00414 ilUtil::formSelect("", "from_style", $from_styles, false, true));
00415 $this->tpl->setVariable("SELECT_TO",
00416 ilUtil::formSelect("", "to_style", $to_styles, false, true));
00417 $this->tpl->setVariable("FORMACTION2", $this->ctrl->getFormAction($this));
00418 $this->tpl->parseCurrentBlock();
00419 }
00420
00424 function moveLMStylesObject()
00425 {
00426 if ($_POST["from_style"] == -1)
00427 {
00428 $this->confirmDeleteIndividualStyles();
00429 return;
00430 }
00431
00432 include_once("./content/classes/class.ilObjContentObject.php");
00433 ilObjContentObject::_moveLMStyles($_POST["from_style"], $_POST["to_style"]);
00434 $this->ctrl->redirect($this, "editContentStyles");
00435 }
00436
00437
00441 function moveIndividualStylesObject()
00442 {
00443 include_once("./content/classes/class.ilObjContentObject.php");
00444 ilObjContentObject::_moveLMStyles(-1, $_GET["to_style"]);
00445 $this->ctrl->redirect($this, "editContentStyles");
00446 }
00447
00448
00452 function confirmDeleteIndividualStyles()
00453 {
00454
00455 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.confirm.html");
00456 $this->tpl->setVariable("CMD_OK", "moveIndividualStyles");
00457 $this->tpl->setVariable("TXT_OK", $this->lng->txt("ok"));
00458 $this->tpl->setVariable("CMD_CANCEL", "editContentStyles");
00459 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00460 $this->tpl->setVariable("TXT_CONFIRM", $this->lng->txt("sty_confirm_del_ind_styles"));
00461 $this->tpl->setVariable("TXT_CONTENT",
00462 sprintf($this->lng->txt("sty_confirm_del_ind_styles_desc"),
00463 ilObject::_lookupTitle($_POST["to_style"])));
00464 $this->ctrl->setParameter($this, "to_style", $_POST["to_style"]);
00465 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormaction($this));
00466 $this->tpl->parseCurrentBlock();
00467 }
00468
00469
00473 function editSystemStylesObject()
00474 {
00475 global $rbacsystem, $ilias, $styleDefinition;;
00476
00477 if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00478 {
00479 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00480 }
00481
00482 $this->tpl->addBlockfile("ADM_CONTENT", "style_settings", "tpl.stys_settings.html");
00483 $this->tpl->setCurrentBlock("style_settings");
00484
00485 $settings = $this->ilias->getAllSettings();
00486
00487 $this->tpl->setVariable("FORMACTION_STYLESETTINGS", $this->ctrl->getFormAction($this));
00488 $this->tpl->setVariable("TXT_STYLE_SETTINGS", $this->lng->txt("system_style_settings"));
00489 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
00490 $this->tpl->setVariable("TXT_DEFAULT_SKIN_STYLE", $this->lng->txt("default_skin_style"));
00491 $this->tpl->setVariable("TXT_SKIN_STYLE_ACTIVATION", $this->lng->txt("style_activation"));
00492 $this->tpl->setVariable("TXT_NUMBER_OF_USERS", $this->lng->txt("num_users"));
00493 $this->tpl->setVariable("TXT_MOVE_USERS_TO_STYLE", $this->lng->txt("move_users_to_style"));
00494
00495
00496 $templates = $styleDefinition->getAllTemplates();
00497
00498 $all_styles = array();
00499
00500 foreach ($templates as $template)
00501 {
00502
00503 $styleDef =& new ilStyleDefinition($template["id"]);
00504 $styleDef->startParsing();
00505 $styles = $styleDef->getStyles();
00506
00507 foreach ($styles as $style)
00508 {
00509 if ($this->ilias->ini->readVariable("layout","skin") == $template["id"] &&
00510 $this->ilias->ini->readVariable("layout","style") == $style["id"])
00511 {
00512 $this->tpl->setVariable("SKINSELECTED", "selected=\"selected\"");
00513 }
00514
00515
00516 $this->tpl->setCurrentBlock("selectskin");
00517 $this->tpl->setVariable("SKINVALUE", $template["id"].":".$style["id"]);
00518 $this->tpl->setVariable("SKINOPTION", $styleDef->getTemplateName()." / ".$style["name"]);
00519 $this->tpl->parseCurrentBlock();
00520
00521
00522 foreach ($templates as $template2)
00523 {
00524
00525 $styleDef2 =& new ilStyleDefinition($template2["id"]);
00526 $styleDef2->startParsing();
00527 $styles2 = $styleDef2->getStyles();
00528
00529 foreach ($styles2 as $style2)
00530 {
00531 if (ilObjStyleSettings::_lookupActivatedStyle($template2["id"], $style2["id"]))
00532 {
00533 $this->tpl->setCurrentBlock("move_to_skin");
00534 $this->tpl->setVariable("TOSKINVALUE", $template2["id"].":".$style2["id"]);
00535 $this->tpl->setVariable("TOSKINOPTION", $styleDef2->getTemplateName()." / ".$style2["name"]);
00536 $this->tpl->parseCurrentBlock();
00537 }
00538 }
00539 }
00540
00541
00542 $this->tpl->setCurrentBlock("activation_checkbox");
00543 $this->tpl->setVariable("VAL_SKIN_STYLE", $template["id"].":".$style["id"]);
00544 if (ilObjStyleSettings::_lookupActivatedStyle($template["id"], $style["id"]))
00545 {
00546 $this->tpl->setVariable("CHK_SKIN_STYLE", " checked=\"1\" ");
00547 }
00548 $this->tpl->parseCurrentBlock();
00549
00550
00551 $this->tpl->setCurrentBlock("style_activation");
00552 $this->tpl->setVariable("VAL_MOVE_SKIN_STYLE", $template["id"].":".$style["id"]);
00553 $this->tpl->setVariable("TXT_SKIN_STYLE_TITLE",
00554 $styleDef->getTemplateName()." / ".$style["name"]);
00555 $num_users = ilObjUser::_getNumberOfUsersForStyle($template["id"], $style["id"]);
00556 $this->tpl->setVariable("VAL_NUM_USERS", $num_users);
00557 $this->tpl->parseCurrentBlock();
00558
00559 $all_styles[] = $template["id"].":".$style["id"];
00560 }
00561 }
00562
00563
00564 $all_user_styles = ilObjUser::_getAllUserAssignedStyles();
00565
00566
00567
00568 $users_missing_styles = 0;
00569 foreach($all_user_styles as $style)
00570 {
00571 if (!in_array($style, $all_styles))
00572 {
00573 $style_arr = explode(":", $style);
00574 $users_missing_styles += ilObjUser::_getNumberOfUsersForStyle($style_arr[0], $style_arr[1]);
00575 }
00576 }
00577
00578 if ($users_missing_styles > 0)
00579 {
00580
00581 foreach ($templates as $template2)
00582 {
00583
00584 $styleDef2 =& new ilStyleDefinition($template2["id"]);
00585 $styleDef2->startParsing();
00586 $styles2 = $styleDef2->getStyles();
00587
00588 foreach ($styles2 as $style2)
00589 {
00590 if (ilObjStyleSettings::_lookupActivatedStyle($template2["id"], $style2["id"]))
00591 {
00592 $this->tpl->setCurrentBlock("move_to_skin");
00593 $this->tpl->setVariable("TOSKINVALUE", $template2["id"].":".$style2["id"]);
00594 $this->tpl->setVariable("TOSKINOPTION", $styleDef2->getTemplateName()." / ".$style2["name"]);
00595 $this->tpl->parseCurrentBlock();
00596 }
00597 }
00598 }
00599
00600 $this->tpl->setCurrentBlock("style_activation");
00601 $this->tpl->setVariable("TXT_SKIN_STYLE_TITLE",
00602 $this->lng->txt("other"));
00603 $this->tpl->setVariable("VAL_NUM_USERS",
00604 $users_missing_styles);
00605 $this->tpl->setVariable("VAL_MOVE_SKIN_STYLE", "other");
00606 $this->tpl->parseCurrentBlock();
00607 }
00608
00609 $this->tpl->parseCurrentBlock();
00610 }
00611
00612
00616 function saveStyleSettingsObject()
00617 {
00618 global $styleDefinition;
00619
00620
00621 if (count($_POST["st_act"]) < 1)
00622 {
00623 $this->ilias->raiseError($this->lng->txt("at_least_one_style"), $this->ilias->error_obj->MESSAGE);
00624 }
00625
00626
00627
00628 $templates = $styleDefinition->getAllTemplates();
00629 $all_styles = array();
00630 foreach ($templates as $template)
00631 {
00632
00633 $styleDef =& new ilStyleDefinition($template["id"]);
00634 $styleDef->startParsing();
00635 $styles = $styleDef->getStyles();
00636 foreach ($styles as $style)
00637 {
00638 if (!isset($_POST["st_act"][$template["id"].":".$style["id"]]))
00639 {
00640 if (ilObjUser::_getNumberOfUsersForStyle($template["id"], $style["id"]) > 1)
00641 {
00642 $this->ilias->raiseError($this->lng->txt("cant_deactivate_if_users_assigned"), $this->ilias->error_obj->MESSAGE);
00643 }
00644 else
00645 {
00646 ilObjStyleSettings::_deactivateStyle($template["id"], $style["id"]);
00647 }
00648 }
00649 else
00650 {
00651 ilObjStyleSettings::_activateStyle($template["id"], $style["id"]);
00652 }
00653 $all_styles[] = $template["id"].":".$style["id"];
00654 }
00655 }
00656
00657
00658 foreach($_POST["move_users"] as $key => $value)
00659 {
00660 if ($value != "")
00661 {
00662 $to = explode(":", $value);
00663
00664 if ($key != "other")
00665 {
00666 $from = explode(":", $key);
00667 ilObjUser::_moveUsersToStyle($from[0],$from[1],$to[0],$to[1]);
00668 }
00669 else
00670 {
00671
00672 $all_user_styles = ilObjUser::_getAllUserAssignedStyles();
00673
00674
00675
00676 foreach($all_user_styles as $style)
00677 {
00678 if (!in_array($style, $all_styles))
00679 {
00680 $style_arr = explode(":", $style);
00681 ilObjUser::_moveUsersToStyle($style_arr[0],$style_arr[1],$to[0],$to[1]);
00682 }
00683 }
00684 }
00685 }
00686 }
00687
00688
00689 if ($_POST["default_skin_style"] != "")
00690 {
00691 $sknst = explode(":", $_POST["default_skin_style"]);
00692
00693 if ($this->ilias->ini->readVariable("layout","style") != $sknst[1] ||
00694 $this->ilias->ini->readVariable("layout","skin") != $sknst[0])
00695 {
00696 $this->ilias->ini->setVariable("layout","skin", $sknst[0]);
00697 $this->ilias->ini->setVariable("layout","style",$sknst[1]);
00698 }
00699 }
00700 $this->ilias->ini->write();
00701
00702 sendInfo($this->lng->txt("msg_obj_modified"), true);
00703 ilUtil::redirect($this->ctrl->getLinkTarget($this,"editSystemStyles"));
00704 }
00705
00711 function deleteStyleObject($a_error = false)
00712 {
00713 if (!isset($_POST["id"]))
00714 {
00715 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00716 }
00717
00718
00719 $_SESSION["saved_post"] = $_POST["id"];
00720
00721 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html");
00722
00723 if(!$a_error)
00724 {
00725 sendInfo($this->lng->txt("info_delete_sure"));
00726 }
00727
00728 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00729
00730
00731 $this->tpl->setCurrentBlock("table_header");
00732 $this->tpl->setVariable("TEXT", $this->lng->txt("objects"));
00733 $this->tpl->parseCurrentBlock();
00734
00735
00736
00737
00738 $counter = 0;
00739
00740 foreach ($_POST["id"] as $id)
00741 {
00742 $this->tpl->setCurrentBlock("table_row");
00743 $this->tpl->setVariable("IMG_OBJ",ilUtil::getImagePath("icon_sty.gif"));
00744 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
00745 $this->tpl->setVariable("TEXT_CONTENT",ilObject::_lookupTitle($id));
00746 $this->tpl->parseCurrentBlock();
00747 }
00748
00749
00750
00751
00752 $buttons = array("confirmedDelete" => $this->lng->txt("confirm"),
00753 "cancelDelete" => $this->lng->txt("cancel"));
00754 foreach ($buttons as $name => $value)
00755 {
00756 $this->tpl->setCurrentBlock("operation_btn");
00757 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
00758 $this->tpl->setVariable("BTN_NAME",$name);
00759 $this->tpl->setVariable("BTN_VALUE",$value);
00760 $this->tpl->parseCurrentBlock();
00761 }
00762 }
00763
00764
00768 function confirmedDeleteObject()
00769 {
00770 global $ilias;
00771
00772 foreach($_SESSION["saved_post"] as $id)
00773 {
00774 $this->object->removeStyle($id);
00775 $style_obj =& $ilias->obj_factory->getInstanceByObjId($id);
00776 $style_obj->delete();
00777 }
00778 $this->object->update();
00779
00780 ilUtil::redirect($this->getReturnLocation("delete",
00781 $this->ctrl->getLinkTarget($this,"editContentStyles")));
00782 }
00783
00784
00790 function toggleGlobalDefaultObject()
00791 {
00792 global $ilias;
00793
00794 if (!isset($_POST["id"]))
00795 {
00796 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00797 }
00798 if(count($_POST["id"]) > 1)
00799 {
00800 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
00801 }
00802
00803 $ilias->deleteSetting("fixed_content_style_id");
00804 $def_style = $ilias->getSetting("default_content_style_id");
00805
00806 if ($def_style != $_POST["id"][0])
00807 {
00808 $ilias->setSetting("default_content_style_id", $_POST["id"][0]);
00809 }
00810 else
00811 {
00812 $ilias->deleteSetting("default_content_style_id");
00813 }
00814
00815 ilUtil::redirect($this->ctrl->getLinkTarget($this, "editContentStyles"));
00816 }
00817
00823 function toggleGlobalFixedObject()
00824 {
00825 global $ilias;
00826
00827 if (!isset($_POST["id"]))
00828 {
00829 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00830 }
00831 if(count($_POST["id"]) > 1)
00832 {
00833 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
00834 }
00835
00836 $ilias->deleteSetting("default_content_style_id");
00837 $fixed_style = $ilias->getSetting("fixed_content_style_id");
00838 if ($fixed_style == $_POST["id"][0])
00839 {
00840 $ilias->deleteSetting("fixed_content_style_id");
00841 }
00842 else
00843 {
00844 $ilias->setSetting("fixed_content_style_id", $_POST["id"][0]);
00845 }
00846 ilUtil::redirect($this->ctrl->getLinkTarget($this, "editContentStyles"));
00847 }
00848
00849
00853 function saveActiveStylesObject()
00854 {
00855 include_once("classes/class.ilObjStyleSheet.php");
00856 $styles = $this->object->getStyles();
00857 foreach($styles as $style)
00858 {
00859 if ($_POST["std_".$style["id"]] == 1)
00860 {
00861 ilObjStyleSheet::_writeActive($style["id"], 1);
00862 }
00863 else
00864 {
00865 ilObjStyleSheet::_writeActive($style["id"], 0);
00866 }
00867 }
00868 ilUtil::redirect($this->ctrl->getLinkTarget($this, "editContentStyles"));
00869 }
00870
00877 function showActions($with_subobjects = false)
00878 {
00879
00880
00881 $this->tpl->setCurrentBlock("tbl_action_btn");
00882 $this->tpl->setVariable("BTN_NAME", "deleteStyle");
00883 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
00884 $this->tpl->parseCurrentBlock();
00885
00886
00887 $this->tpl->setCurrentBlock("tbl_action_btn");
00888 $this->tpl->setVariable("BTN_NAME", "toggleGlobalDefault");
00889 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("toggleGlobalDefault"));
00890 $this->tpl->parseCurrentBlock();
00891
00892
00893 $this->tpl->setCurrentBlock("tbl_action_btn");
00894 $this->tpl->setVariable("BTN_NAME", "toggleGlobalFixed");
00895 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("toggleGlobalFixed"));
00896 $this->tpl->parseCurrentBlock();
00897
00898
00899 $this->tpl->setCurrentBlock("tbl_action_btn");
00900 $this->tpl->setVariable("BTN_NAME", "setScope");
00901 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("sty_set_scope"));
00902 $this->tpl->parseCurrentBlock();
00903
00904
00905 $this->tpl->setCurrentBlock("tbl_action_btn");
00906 $this->tpl->setVariable("BTN_NAME", "saveActiveStyles");
00907 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("sty_save_active_styles"));
00908 $this->tpl->parseCurrentBlock();
00909
00910 if ($with_subobjects === true)
00911 {
00912 $this->showPossibleSubObjects();
00913 }
00914
00915 $this->tpl->setCurrentBlock("tbl_action_row");
00916 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00917 $this->tpl->parseCurrentBlock();
00918 }
00919
00925 function cancelDeleteObject()
00926 {
00927 session_unregister("saved_post");
00928
00929 sendInfo($this->lng->txt("msg_cancel"),true);
00930 $this->ctrl->redirect($this, "editContentStyles");
00931
00932 }
00933
00934 function setScopeObject()
00935 {
00936
00937
00938
00939 include_once ("classes/class.ilStyleScopeExplorer.php");
00940 $exp = new ilStyleScopeExplorer("repository.php?cmd=goto");
00941 $exp->setExpandTarget("repository.php?cmd=showTree");
00942 $exp->setTargetGet("ref_id");
00943 $exp->setFilterMode(IL_FM_POSITIVE);
00944 $exp->forceExpandAll(true, false);
00945 $exp->addFilter("root");
00946 $exp->addFilter("cat");
00947
00948 if ($_GET["expand"] == "")
00949 {
00950 $expanded = $this->tree->readRootId();
00951 }
00952 else
00953 {
00954 $expanded = $_GET["expand"];
00955 }
00956
00957 $exp->setExpand($expanded);
00958
00959
00960 $exp->setOutput(0);
00961 $output = $exp->getOutput();
00962
00963 $this->tpl->setVariable("ADM_CONTENT", $output);
00964 }
00965
00969 function saveScopeObject()
00970 {
00971 global $ilias;
00972
00973 include_once("classes/class.ilObjStyleSheet.php");
00974 if ($_GET["cat"] == 0)
00975 {
00976 $_GET["cat"] == "";
00977 }
00978 ilObjStyleSheet::_writeScope($_GET["style_id"], $_GET["cat"]);
00979
00980 ilUtil::redirect($this->ctrl->getLinkTarget($this, "editContentStyles"));
00981 }
00982
00983
00984 function setTabs()
00985 {
00986 echo "settings_setTabs";
00987 }
00988
00989 function getAdminTabs(&$tabs_gui)
00990 {
00991 $this->getTabs($tabs_gui);
00992 }
00993
00999 function getTabs(&$tabs_gui)
01000 {
01001 global $rbacsystem;
01002
01003 if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
01004 {
01005 $tabs_gui->addTarget("basic_settings",
01006 $this->ctrl->getLinkTarget($this, "editBasicSettings"), array("editBasicSettings","", "view"), "", "");
01007
01008 $tabs_gui->addTarget("system_styles",
01009 $this->ctrl->getLinkTarget($this, "editSystemStyles"), "editSystemStyles", "", "");
01010
01011 $tabs_gui->addTarget("content_styles",
01012 $this->ctrl->getLinkTarget($this, "editContentStyles"), "editContentStyles", "", "");
01013 }
01014
01015 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
01016 {
01017 $tabs_gui->addTarget("perm_settings",
01018 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
01019 }
01020 }
01021 }
01022 ?>