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

classes/class.ilObjStyleSheetFolderGUI.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 
00034 //
00035 //
00036 // THIS CLASS IS CURRENTLY NOT IN USE
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                 // create and insert forum in objecttree
00062                 $newObj = parent::saveObject();
00063 
00064                 // setup rolefolder & default local roles
00065                 //$roles = $newObj->initDefaultRoles();
00066 
00067                 // ...finally assign role to creator of object
00068                 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "y");
00069 
00070                 // put here object specific stuff
00071                         
00072                 // always send a message
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                 // load template for table
00093                 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00094                 
00095                 // load template for table content data
00096                 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.styf_row.html");
00097 
00098                 $num = 0;
00099 
00100 //              $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$this->ref_id."$obj_str&cmd=gateway");
00101 
00102                 // create table
00103                 $tbl = new ilTableGUI();
00104 
00105                 // title & header columns
00106                 $tbl->setTitle($this->object->getTitle(),"icon_styf.gif",
00107                         $this->lng->txt("obj_".$this->object->getType()));
00108 
00109                 //$tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));
00110 
00111                 // title
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                 // control
00121                 $tbl->setOrderColumn($_GET["sort_by"]);
00122                 $tbl->setOrderDirection($_GET["sort_order"]);
00123                 $tbl->setLimit($_GET["limit"]);
00124                 $tbl->setOffset($_GET["offset"]);
00125                 
00126                 // get style ids
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                 // todo
00137                 $tbl->setMaxCount(count($style_entries));
00138 
00139                 $this->tpl->setVariable("COLUMN_COUNTS", 3);
00140 
00141                 // footer
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                         // color changing
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 //                      $this->tpl->setVariable("LINK_STYLE",
00164 //                              "adm_object.php?ref_id=".$_GET["ref_id"].
00165 //                              "&obj_id=".$style["id"]);
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                 } //if is_array
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                 // render table
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                 // SAVE POST VALUES
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 //              $this->tpl->setVariable("FORMACTION", $this->getFormAction("delete",
00224 //                      "adm_object.php?ref_id=".$_GET["ref_id"]."&cmd=gateway"));
00225 
00226                 // BEGIN TABLE HEADER
00227                 $this->tpl->setCurrentBlock("table_header");
00228                 $this->tpl->setVariable("TEXT", $this->lng->txt("objects"));
00229                 $this->tpl->parseCurrentBlock();
00230                 
00231                 // END TABLE HEADER
00232 
00233                 // BEGIN TABLE DATA
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                 // END TABLE DATA
00246 
00247                 // BEGIN OPERATION_BTN
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                 // delete
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                 // set global default
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                 // set global default
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                 // tabs are defined manually here. The autogeneration via objects.xml will be deprecated in future
00391                 // for usage examples see ilObjGroupGUI or ilObjSystemFolderGUI
00392         }
00393 } // END class.ilObjStyleSheetFolder
00394 ?>

Generated on Fri Dec 13 2013 17:56:48 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1