• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

classes/class.ilObjStyleSettingsGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2005 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
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                 $this->type = "stys";
00047                 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
00048         }
00049         
00050         function &executeCommand()
00051         {
00052                 $next_class = $this->ctrl->getNextClass($this);
00053                 $cmd = $this->ctrl->getCmd();
00054                 $this->prepareOutput();
00055 
00056                 switch($next_class)
00057                 {
00058                         case 'ilpermissiongui':
00059                                 include_once("./classes/class.ilPermissionGUI.php");
00060                                 $perm_gui =& new ilPermissionGUI($this);
00061                                 $ret =& $this->ctrl->forwardCommand($perm_gui);
00062                                 break;
00063 
00064                         default:
00065                                 if ($cmd == "" || $cmd == "view")
00066                                 {
00067                                         $cmd = "editBasicSettings";
00068                                 }
00069                                 $cmd .= "Object";
00070                                 $this->$cmd();
00071 
00072                                 break;
00073                 }
00074                 return true;
00075         }
00076         
00081         function saveObject()
00082         {
00083                 global $rbacadmin;
00084 
00085                 // create and insert forum in objecttree
00086                 $newObj = parent::saveObject();
00087 
00088                 // setup rolefolder & default local roles
00089                 //$roles = $newObj->initDefaultRoles();
00090 
00091                 // ...finally assign role to creator of object
00092                 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "y");
00093 
00094                 // put here object specific stuff
00095                         
00096                 // always send a message
00097                 sendInfo($this->lng->txt("object_added"),true);
00098                 
00099                 ilUtil::redirect($this->getReturnLocation("save",$this->ctrl->getLinkTarget($this,"")));
00100         }
00101         
00105         function editBasicSettingsObject()
00106         {
00107                 global $rbacsystem;
00108 
00109                 if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00110                 {
00111                         $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00112                 }
00113                 
00114                 $this->tpl->addBlockfile("ADM_CONTENT", "style_basic_settings", "tpl.stys_basic_settings.html");
00115                 $this->tpl->setCurrentBlock("style_settings");
00116 
00117                 $settings = $this->ilias->getAllSettings();
00118 
00119                 $this->tpl->setVariable("FORMACTION_STYLESETTINGS", $this->ctrl->getFormAction($this));         
00120                 $this->tpl->setVariable("TXT_STYLE_SETTINGS", $this->lng->txt("basic_settings"));
00121                 $this->tpl->setVariable("TXT_ICONS_IN_TYPED_LISTS", $this->lng->txt("icons_in_typed_lists"));
00122                 $this->tpl->setVariable("TXT_ICONS_IN_HEADER", $this->lng->txt("icons_in_header"));
00123                 $this->tpl->setVariable("TXT_ICONS_IN_ITEM_ROWS", $this->lng->txt("icons_in_item_rows"));
00124                 $this->tpl->setVariable("TXT_ICONS_IN_TYPED_LISTS_INFO", $this->lng->txt("icons_in_typed_lists_info"));
00125                 
00126                 $this->tpl->setVariable("TXT_ENABLE_CUSTOM_ICONS", $this->lng->txt("enable_custom_icons"));
00127                 $this->tpl->setVariable("TXT_ENABLE_CUSTOM_ICONS_INFO", $this->lng->txt("enable_custom_icons_info"));
00128                 $this->tpl->setVariable("TXT_CUSTOM_ICON_SIZE_BIG", $this->lng->txt("custom_icon_size_big"));
00129                 $this->tpl->setVariable("TXT_CUSTOM_ICON_SIZE_SMALL", $this->lng->txt("custom_icon_size_small"));
00130                 $this->tpl->setVariable("TXT_WIDTH_X_HEIGHT", $this->lng->txt("width_x_height"));
00131                 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
00132                 
00133                 // set current values
00134                 if ($settings["custom_icons"])
00135                 {
00136                         $this->tpl->setVariable("CHK_CUSTOM_ICONS","checked=\"checked\"");
00137                 }
00138                 if ($settings["icon_position_in_lists"] == "item_rows")
00139                 {
00140                         $this->tpl->setVariable("SEL_ICON_POS_ITEM_ROWS","selected=\"selected\"");
00141                 }
00142                 else
00143                 {
00144                         $this->tpl->setVariable("SEL_ICON_POS_HEADER","selected=\"selected\"");
00145                 }
00146                 $this->tpl->setVariable("CUST_ICON_BIG_WIDTH", $settings["custom_icon_big_width"]);
00147                 $this->tpl->setVariable("CUST_ICON_BIG_HEIGHT", $settings["custom_icon_big_height"]);
00148                 $this->tpl->setVariable("CUST_ICON_SMALL_WIDTH", $settings["custom_icon_small_width"]);
00149                 $this->tpl->setVariable("CUST_ICON_SMALL_HEIGHT", $settings["custom_icon_small_height"]);
00150 
00151                 $this->tpl->parseCurrentBlock();
00152         }
00153         
00157         function saveBasicStyleSettingsObject()
00158         {
00159                 $this->ilias->setSetting("icon_position_in_lists", $_POST["icon_position_in_lists"]);
00160                 $this->ilias->setSetting("custom_icons", $_POST["custom_icons"]);
00161                 $this->ilias->setSetting("custom_icon_big_width", (int) $_POST["custom_icon_big_width"]);
00162                 $this->ilias->setSetting("custom_icon_big_height", (int) $_POST["custom_icon_big_height"]);
00163                 $this->ilias->setSetting("custom_icon_small_width", (int) $_POST["custom_icon_small_width"]);
00164                 $this->ilias->setSetting("custom_icon_small_height", (int) $_POST["custom_icon_small_height"]);
00165                 sendInfo($this->lng->txt("msg_obj_modified"), true);
00166                 ilUtil::redirect($this->ctrl->getLinkTarget($this,"editBasicSettings"));                
00167         }
00168         
00172         function editContentStylesObject()
00173         {
00174                 global $rbacsystem, $ilias;
00175                 
00176                 if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00177                 {
00178                         $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00179                 }
00180                 
00181                 include_once "./classes/class.ilTableGUI.php";
00182 
00183                 // load template for table
00184                 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00185                 
00186                 // load template for table content data
00187                 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.styf_row.html");
00188 
00189                 $num = 0;
00190 
00191                 $this->tpl->setVariable("FORMACTION",
00192                         $this->ctrl->getFormAction($this));
00193 
00194                 // create table
00195                 $tbl = new ilTableGUI();
00196 
00197                 // title & header columns
00198                 $tbl->setTitle($this->lng->txt("content_styles"),"icon_sty.gif",
00199                         $this->lng->txt("content_styles"));
00200 
00201                 //$tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));
00202 
00203                 // title
00204                 $header_names = array("", $this->lng->txt("title"),
00205                         $this->lng->txt("purpose"));
00206                 $tbl->setHeaderNames($header_names);
00207 
00208                 $header_params = array("ref_id" => $this->ref_id);
00209                 $tbl->setHeaderVars(array("", "title", "purpose"), $header_params);
00210                 $tbl->setColumnWidth(array("0%", "80%", "20%"));
00211 
00212                 // control
00213                 $tbl->setOrderColumn($_GET["sort_by"]);
00214                 $tbl->setOrderDirection($_GET["sort_order"]);
00215                 $tbl->setLimit($_GET["limit"]);
00216                 $tbl->setOffset($_GET["offset"]);
00217                 
00218                 // get style ids
00219                 $style_entries = array();
00220                 $styles = $this->object->getStyles();
00221                 foreach($styles as $style)
00222                 {
00223                         $style_entries[$style["title"].":".$style["id"]]
00224                                 = $style;
00225                 }
00226                 ksort($style_entries);
00227                 
00228                 // todo
00229                 $tbl->setMaxCount(count($style_entries));
00230 
00231                 $this->tpl->setVariable("COLUMN_COUNTS", 3);
00232 
00233                 // footer
00234                 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00235 
00236                 $this->showActions(true);
00237 
00238                 include_once ("classes/class.ilObjStyleSheet.php");
00239                 
00240                 $fixed_style = $ilias->getSetting("fixed_content_style_id");
00241                 $default_style = $ilias->getSetting("default_content_style_id");
00242 
00243                 foreach ($style_entries as $style)
00244                 {
00245                         $this->tpl->setCurrentBlock("style_row");
00246                 
00247                         // color changing
00248                         $css_row = ($css_row == "tblrow2")
00249                                 ? "tblrow1"
00250                                 : "tblrow2";
00251 
00252                         $this->tpl->setVariable("CHECKBOX_ID", $style["id"]);
00253                         $this->tpl->setVariable("TXT_TITLE", $style["title"]);
00254                         $this->tpl->setVariable("TXT_DESC", ilObject::_lookupDescription($style["id"]));
00255                         $this->ctrl->setParameterByClass("ilobjstylesheetgui", "obj_id", $style["id"]); 
00256                         $this->tpl->setVariable("LINK_STYLE",
00257                                 $this->ctrl->getLinkTargetByClass("ilobjstylesheetgui"), "view");
00258                         $this->tpl->setVariable("ROWCOL", $css_row);
00259                         if ($style["id"] == $fixed_style)
00260                         {
00261                                 $this->tpl->setVariable("TXT_PURPOSE", $this->lng->txt("global_fixed"));
00262                         }
00263                         if ($style["id"] == $default_style)
00264                         {
00265                                 $this->tpl->setVariable("TXT_PURPOSE", $this->lng->txt("global_default"));
00266                         }
00267                         $this->tpl->parseCurrentBlock();
00268 
00269                         $this->tpl->setCurrentBlock("tbl_content");
00270                         $this->tpl->parseCurrentBlock();
00271 
00272                 } //if is_array
00273                 
00274                 if (count($style_entries) == 0)
00275                 {
00276             $tbl->disable("header");
00277                         $tbl->disable("footer");
00278                         
00279                         $this->tpl->setCurrentBlock("text");
00280                         $this->tpl->setVariable("TXT_CONTENT", $this->lng->txt("obj_not_found"));
00281                         $this->tpl->parseCurrentBlock();
00282                         
00283                         $this->tpl->setCurrentBlock("tbl_content");
00284                         $this->tpl->parseCurrentBlock();
00285                 }
00286 
00287                 // render table
00288                 $tbl->render();
00289                 
00290         }
00291         
00295         function editSystemStylesObject()
00296         {
00297                 global $rbacsystem, $ilias, $styleDefinition;;
00298                 
00299                 if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00300                 {
00301                         $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00302                 }
00303                 
00304                 $this->tpl->addBlockfile("ADM_CONTENT", "style_settings", "tpl.stys_settings.html");
00305                 $this->tpl->setCurrentBlock("style_settings");
00306 
00307                 $settings = $this->ilias->getAllSettings();
00308 
00309                 $this->tpl->setVariable("FORMACTION_STYLESETTINGS", $this->ctrl->getFormAction($this));         
00310                 $this->tpl->setVariable("TXT_STYLE_SETTINGS", $this->lng->txt("system_style_settings"));
00311                 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
00312                 $this->tpl->setVariable("TXT_DEFAULT_SKIN_STYLE", $this->lng->txt("default_skin_style"));
00313                 $this->tpl->setVariable("TXT_SKIN_STYLE_ACTIVATION", $this->lng->txt("style_activation"));
00314                 $this->tpl->setVariable("TXT_NUMBER_OF_USERS", $this->lng->txt("num_users"));
00315                 $this->tpl->setVariable("TXT_MOVE_USERS_TO_STYLE", $this->lng->txt("move_users_to_style"));
00316                 
00317                 // get all templates
00318                 $templates = $styleDefinition->getAllTemplates();
00319 
00320                 $all_styles = array();
00321                 
00322                 foreach ($templates as $template)
00323                 {
00324                         // get styles definition for template
00325                         $styleDef =& new ilStyleDefinition($template["id"]);
00326                         $styleDef->startParsing();
00327                         $styles = $styleDef->getStyles();
00328 
00329                         foreach ($styles as $style)
00330                         {
00331                                 if ($this->ilias->ini->readVariable("layout","skin") == $template["id"] &&
00332                                         $this->ilias->ini->readVariable("layout","style") == $style["id"])
00333                                 {
00334                                         $this->tpl->setVariable("SKINSELECTED", "selected=\"selected\"");
00335                                 }
00336 
00337                                 // default selection list
00338                                 $this->tpl->setCurrentBlock("selectskin");
00339                                 $this->tpl->setVariable("SKINVALUE", $template["id"].":".$style["id"]);
00340                                 $this->tpl->setVariable("SKINOPTION", $styleDef->getTemplateName()." / ".$style["name"]);
00341                                 $this->tpl->parseCurrentBlock();
00342                                 
00343                                 // can be optimized
00344                                 foreach ($templates as $template2)
00345                                 {
00346                                         // get styles definition for template
00347                                         $styleDef2 =& new ilStyleDefinition($template2["id"]);
00348                                         $styleDef2->startParsing();
00349                                         $styles2 = $styleDef2->getStyles();
00350                 
00351                                         foreach ($styles2 as $style2)
00352                                         {
00353                                                 if (ilObjStyleSettings::_lookupActivatedStyle($template2["id"], $style2["id"]))
00354                                                 {
00355                                                         $this->tpl->setCurrentBlock("move_to_skin");
00356                                                         $this->tpl->setVariable("TOSKINVALUE", $template2["id"].":".$style2["id"]);
00357                                                         $this->tpl->setVariable("TOSKINOPTION", $styleDef2->getTemplateName()." / ".$style2["name"]);
00358                                                         $this->tpl->parseCurrentBlock();
00359                                                 }
00360                                         }
00361                                 }
00362                                 
00363                                 // activation checkbox
00364                                 $this->tpl->setCurrentBlock("activation_checkbox");
00365                                 $this->tpl->setVariable("VAL_SKIN_STYLE", $template["id"].":".$style["id"]);
00366                                 if (ilObjStyleSettings::_lookupActivatedStyle($template["id"], $style["id"]))
00367                                 {
00368                                         $this->tpl->setVariable("CHK_SKIN_STYLE", " checked=\"1\" ");
00369                                 }
00370                                 $this->tpl->parseCurrentBlock();
00371                                 
00372                                 // activation row
00373                                 $this->tpl->setCurrentBlock("style_activation");
00374                                 $this->tpl->setVariable("VAL_MOVE_SKIN_STYLE", $template["id"].":".$style["id"]);
00375                                 $this->tpl->setVariable("TXT_SKIN_STYLE_TITLE", 
00376                                         $styleDef->getTemplateName()." / ".$style["name"]);
00377                                 $num_users = ilObjUser::_getNumberOfUsersForStyle($template["id"], $style["id"]);
00378                                 $this->tpl->setVariable("VAL_NUM_USERS", $num_users);
00379                                 $this->tpl->parseCurrentBlock();
00380                                 
00381                                 $all_styles[] = $template["id"].":".$style["id"];
00382                         }
00383                 }
00384                 
00385                 // get all user assigned styles
00386                 $all_user_styles = ilObjUser::_getAllUserAssignedStyles();
00387                 
00388                 // output "other" row for all users, that are not assigned to
00389                 // any existing style
00390                 $users_missing_styles = 0;
00391                 foreach($all_user_styles as $style)
00392                 {
00393                         if (!in_array($style, $all_styles))
00394                         {
00395                                 $style_arr = explode(":", $style);
00396                                 $users_missing_styles += ilObjUser::_getNumberOfUsersForStyle($style_arr[0], $style_arr[1]);
00397                         }
00398                 }
00399 
00400                 if ($users_missing_styles > 0)
00401                 {                       
00402                         // can be optimized
00403                         foreach ($templates as $template2)
00404                         {
00405                                 // get styles definition for template
00406                                 $styleDef2 =& new ilStyleDefinition($template2["id"]);
00407                                 $styleDef2->startParsing();
00408                                 $styles2 = $styleDef2->getStyles();
00409         
00410                                 foreach ($styles2 as $style2)
00411                                 {
00412                                         if (ilObjStyleSettings::_lookupActivatedStyle($template2["id"], $style2["id"]))
00413                                         {
00414                                                 $this->tpl->setCurrentBlock("move_to_skin");
00415                                                 $this->tpl->setVariable("TOSKINVALUE", $template2["id"].":".$style2["id"]);
00416                                                 $this->tpl->setVariable("TOSKINOPTION", $styleDef2->getTemplateName()." / ".$style2["name"]);
00417                                                 $this->tpl->parseCurrentBlock();
00418                                         }
00419                                 }
00420                         }
00421                         
00422                         $this->tpl->setCurrentBlock("style_activation");
00423                         $this->tpl->setVariable("TXT_SKIN_STYLE_TITLE",
00424                                 $this->lng->txt("other"));
00425                         $this->tpl->setVariable("VAL_NUM_USERS",
00426                                 $users_missing_styles);
00427                         $this->tpl->setVariable("VAL_MOVE_SKIN_STYLE", "other");
00428                         $this->tpl->parseCurrentBlock();
00429                 }
00430 
00431                 $this->tpl->parseCurrentBlock();
00432         }
00433         
00434 
00438         function saveStyleSettingsObject()
00439         {
00440                 global $styleDefinition;
00441                 
00442                 // check if one style is activated
00443                 if (count($_POST["st_act"]) < 1)
00444                 {
00445                         $this->ilias->raiseError($this->lng->txt("at_least_one_style"), $this->ilias->error_obj->MESSAGE);
00446                 }
00447                 
00448                 // check if a style should be deactivated, that still has
00449                 // a user assigned to
00450                 $templates = $styleDefinition->getAllTemplates();
00451                 $all_styles = array();
00452                 foreach ($templates as $template)
00453                 {
00454                         // get styles definition for template
00455                         $styleDef =& new ilStyleDefinition($template["id"]);
00456                         $styleDef->startParsing();
00457                         $styles = $styleDef->getStyles();
00458                         foreach ($styles as $style)
00459                         {
00460                                 if (!isset($_POST["st_act"][$template["id"].":".$style["id"]]))
00461                                 {
00462                                         if (ilObjUser::_getNumberOfUsersForStyle($template["id"], $style["id"]) > 1)
00463                                         {
00464                                                 $this->ilias->raiseError($this->lng->txt("cant_deactivate_if_users_assigned"), $this->ilias->error_obj->MESSAGE);
00465                                         }
00466                                         else
00467                                         {
00468                                                 ilObjStyleSettings::_deactivateStyle($template["id"], $style["id"]);
00469                                         }
00470                                 }
00471                                 else
00472                                 {
00473                                         ilObjStyleSettings::_activateStyle($template["id"], $style["id"]);
00474                                 }
00475                                 $all_styles[] = $template["id"].":".$style["id"];
00476                         }
00477                 }
00478                 
00479                 // move users to other skin
00480                 foreach($_POST["move_users"] as $key => $value)
00481                 {
00482                         if ($value != "")
00483                         {
00484                                 $to = explode(":", $value);
00485                                 
00486                                 if ($key != "other")
00487                                 {
00488                                         $from = explode(":", $key);
00489                                         ilObjUser::_moveUsersToStyle($from[0],$from[1],$to[0],$to[1]);
00490                                 }
00491                                 else
00492                                 {
00493                                         // get all user assigned styles
00494                                         $all_user_styles = ilObjUser::_getAllUserAssignedStyles();
00495                                         
00496                                         // move users that are not assigned to
00497                                         // currently existing style
00498                                         foreach($all_user_styles as $style)
00499                                         {
00500                                                 if (!in_array($style, $all_styles))
00501                                                 {
00502                                                         $style_arr = explode(":", $style);
00503                                                         ilObjUser::_moveUsersToStyle($style_arr[0],$style_arr[1],$to[0],$to[1]);
00504                                                 }
00505                                         }
00506                                 }
00507                         }
00508                 }
00509                 
00510                 //set default skin and style
00511                 if ($_POST["default_skin_style"] != "")
00512                 {
00513                         $sknst = explode(":", $_POST["default_skin_style"]);
00514 
00515                         if ($this->ilias->ini->readVariable("layout","style") != $sknst[1] ||
00516                                 $this->ilias->ini->readVariable("layout","skin") != $sknst[0])
00517                         {
00518                                 $this->ilias->ini->setVariable("layout","skin", $sknst[0]);
00519                                 $this->ilias->ini->setVariable("layout","style",$sknst[1]);
00520                         }
00521                 }
00522                 $this->ilias->ini->write();
00523 //echo "redirect-".$this->ctrl->getLinkTarget($this,"editSystemStyles")."-";
00524                 sendInfo($this->lng->txt("msg_obj_modified"), true);
00525                 ilUtil::redirect($this->ctrl->getLinkTarget($this,"editSystemStyles"));
00526         }
00527         
00533         function deleteStyleObject($a_error = false)
00534         {
00535                 if (!isset($_POST["id"]))
00536                 {
00537                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00538                 }
00539 
00540                 // SAVE POST VALUES
00541                 $_SESSION["saved_post"] = $_POST["id"];
00542 
00543                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html");
00544 
00545                 if(!$a_error)
00546                 {
00547                         sendInfo($this->lng->txt("info_delete_sure"));
00548                 }
00549 
00550                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00551 
00552                 // BEGIN TABLE HEADER
00553                 $this->tpl->setCurrentBlock("table_header");
00554                 $this->tpl->setVariable("TEXT", $this->lng->txt("objects"));
00555                 $this->tpl->parseCurrentBlock();
00556                 
00557                 // END TABLE HEADER
00558 
00559                 // BEGIN TABLE DATA
00560                 $counter = 0;
00561 
00562                 foreach ($_POST["id"] as $id)
00563                 {
00564                         $this->tpl->setCurrentBlock("table_row");
00565                         $this->tpl->setVariable("IMG_OBJ",ilUtil::getImagePath("icon_sty.gif"));
00566                         $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
00567                         $this->tpl->setVariable("TEXT_CONTENT",ilObject::_lookupTitle($id));
00568                         $this->tpl->parseCurrentBlock();
00569                 }
00570                 
00571                 // END TABLE DATA
00572 
00573                 // BEGIN OPERATION_BTN
00574                 $buttons = array("confirmedDelete"  => $this->lng->txt("confirm"),
00575                         "cancelDelete"  => $this->lng->txt("cancel"));
00576                 foreach ($buttons as $name => $value)
00577                 {
00578                         $this->tpl->setCurrentBlock("operation_btn");
00579                         $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
00580                         $this->tpl->setVariable("BTN_NAME",$name);
00581                         $this->tpl->setVariable("BTN_VALUE",$value);
00582                         $this->tpl->parseCurrentBlock();
00583                 }
00584         }
00585         
00586         
00590         function confirmedDeleteObject()
00591         {
00592                 global $ilias;
00593                 
00594                 foreach($_SESSION["saved_post"] as $id)
00595                 {
00596                         $this->object->removeStyle($id);
00597                         $style_obj =& $ilias->obj_factory->getInstanceByObjId($id);
00598                         $style_obj->delete();
00599                 }
00600                 $this->object->update();
00601                 
00602                 ilUtil::redirect($this->getReturnLocation("delete",
00603                         $this->ctrl->getLinkTarget($this,"editContentStyles")));
00604         }
00605         
00606         
00612         function toggleGlobalDefaultObject()
00613         {
00614                 global $ilias;
00615                 
00616                 if (!isset($_POST["id"]))
00617                 {
00618                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00619                 }
00620                 if(count($_POST["id"]) > 1)
00621                 {
00622                         $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
00623                 }
00624 
00625                 $ilias->deleteSetting("fixed_content_style_id");
00626                 $def_style = $ilias->getSetting("default_content_style_id");
00627                 
00628                 if ($def_style != $_POST["id"][0])
00629                 {
00630                         $ilias->setSetting("default_content_style_id", $_POST["id"][0]);
00631                 }
00632                 else
00633                 {
00634                         $ilias->deleteSetting("default_content_style_id");
00635                 }
00636                 
00637                 ilUtil::redirect($this->ctrl->getLinkTarget($this, "editContentStyles"));
00638         }
00639 
00645         function toggleGlobalFixedObject()
00646         {
00647                 global $ilias;
00648                 
00649                 if (!isset($_POST["id"]))
00650                 {
00651                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00652                 }
00653                 if(count($_POST["id"]) > 1)
00654                 {
00655                         $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
00656                 }
00657 
00658                 $ilias->deleteSetting("default_content_style_id");
00659                 $fixed_style = $ilias->getSetting("fixed_content_style_id");
00660                 if ($fixed_style == $_POST["id"][0])
00661                 {
00662                         $ilias->deleteSetting("fixed_content_style_id");
00663                 }
00664                 else
00665                 {
00666                         $ilias->setSetting("fixed_content_style_id", $_POST["id"][0]);
00667                 }
00668                 ilUtil::redirect($this->ctrl->getLinkTarget($this, "editContentStyles"));
00669         }
00670 
00671         
00678         function showActions($with_subobjects = false)
00679         {
00680 
00681                 // delete
00682                 $this->tpl->setCurrentBlock("tbl_action_btn");
00683                 $this->tpl->setVariable("BTN_NAME", "deleteStyle");
00684                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
00685                 $this->tpl->parseCurrentBlock();
00686 
00687                 // set global default
00688                 $this->tpl->setCurrentBlock("tbl_action_btn");
00689                 $this->tpl->setVariable("BTN_NAME", "toggleGlobalDefault");
00690                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("toggleGlobalDefault"));
00691                 $this->tpl->parseCurrentBlock();
00692                 
00693                 // set global default
00694                 $this->tpl->setCurrentBlock("tbl_action_btn");
00695                 $this->tpl->setVariable("BTN_NAME", "toggleGlobalFixed");
00696                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("toggleGlobalFixed"));
00697                 $this->tpl->parseCurrentBlock();
00698 
00699                 if ($with_subobjects === true)
00700                 {
00701                         $this->showPossibleSubObjects();
00702                 }
00703                 
00704                 $this->tpl->setCurrentBlock("tbl_action_row");
00705                 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00706                 $this->tpl->parseCurrentBlock();
00707         }
00708 
00714         function cancelDeleteObject()
00715         {
00716                 session_unregister("saved_post");
00717 
00718                 sendInfo($this->lng->txt("msg_cancel"),true);
00719                 $this->ctrl->redirect($this, "editContentStyles");
00720 
00721         }
00722 
00723         
00724         function setTabs()
00725         {
00726                 echo "settings_setTabs";
00727         }
00728         
00729         function getAdminTabs(&$tabs_gui)
00730         {
00731                 $this->getTabs($tabs_gui);
00732         }
00733                 
00739         function getTabs(&$tabs_gui)
00740         {
00741                 global $rbacsystem;
00742 
00743                 if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00744                 {
00745                         $tabs_gui->addTarget("basic_settings",
00746                                 $this->ctrl->getLinkTarget($this, "editBasicSettings"), array("editBasicSettings","", "view"), "", "");
00747 
00748                         $tabs_gui->addTarget("system_styles",
00749                                 $this->ctrl->getLinkTarget($this, "editSystemStyles"), "editSystemStyles", "", "");
00750                                 
00751                         $tabs_gui->addTarget("content_styles",
00752                                 $this->ctrl->getLinkTarget($this, "editContentStyles"), "editContentStyles", "", "");
00753                 }
00754 
00755                 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
00756                 {
00757                         $tabs_gui->addTarget("perm_settings",
00758                                 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
00759                 }
00760         }
00761 } // END class.ilObjStyleSettingsGUI
00762 ?>

Generated on Fri Dec 13 2013 11:57:55 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1