• Main Page
  • Related Pages
  • 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 
00035 //
00036 //
00037 // THIS CLASS IS CURRENTLY NOT IN USE
00038 //
00039 //
00040 include_once "class.ilObjectGUI.php";
00041 
00042 class ilObjStyleSheetFolderGUI extends ilObjectGUI
00043 {
00048         function ilObjStyleSheetFolderGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output = true)
00049         {
00050                 $this->type = "styf";
00051                 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
00052         }
00053         
00058         function saveObject()
00059         {
00060                 global $rbacadmin;
00061 
00062                 // create and insert forum in objecttree
00063                 $newObj = parent::saveObject();
00064 
00065                 // setup rolefolder & default local roles
00066                 //$roles = $newObj->initDefaultRoles();
00067 
00068                 // ...finally assign role to creator of object
00069                 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "y");
00070 
00071                 // put here object specific stuff
00072                         
00073                 // always send a message
00074                 sendInfo($this->lng->txt("object_added"),true);
00075                 
00076                 ilUtil::redirect($this->getReturnLocation("save",$this->ctrl->getLinkTarget($this,"")));
00077         }
00078         
00082         function viewObject()
00083         {
00084                 global $rbacsystem, $ilias;
00085                 
00086                 if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00087                 {
00088                         $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00089                 }
00090                 
00091                 include_once "./classes/class.ilTableGUI.php";
00092 
00093                 // load template for table
00094                 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00095                 
00096                 // load template for table content data
00097                 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.styf_row.html");
00098 
00099                 $num = 0;
00100 
00101 //              $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$this->ref_id."$obj_str&cmd=gateway");
00102 
00103                 // create table
00104                 $tbl = new ilTableGUI();
00105 
00106                 // title & header columns
00107                 $tbl->setTitle($this->object->getTitle(),"icon_styf.gif",
00108                         $this->lng->txt("obj_".$this->object->getType()));
00109 
00110                 //$tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));
00111 
00112                 // title
00113                 $header_names = array("", $this->lng->txt("title"),
00114                         $this->lng->txt("purpose"));
00115                 $tbl->setHeaderNames($header_names);
00116 
00117                 $header_params = array("ref_id" => $this->ref_id);
00118                 $tbl->setHeaderVars(array("", "title", "purpose"), $header_params);
00119                 $tbl->setColumnWidth(array("0%", "80%", "20%"));
00120 
00121                 // control
00122                 $tbl->setOrderColumn($_GET["sort_by"]);
00123                 $tbl->setOrderDirection($_GET["sort_order"]);
00124                 $tbl->setLimit($_GET["limit"]);
00125                 $tbl->setOffset($_GET["offset"]);
00126                 
00127                 // get style ids
00128                 $style_entries = array();
00129                 $styles = $this->object->getStyles();
00130                 foreach($styles as $style)
00131                 {
00132                         $style_entries[$style["title"].":".$style["id"]]
00133                                 = $style;
00134                 }
00135                 ksort($style_entries);
00136                 
00137                 // todo
00138                 $tbl->setMaxCount(count($style_entries));
00139 
00140                 $this->tpl->setVariable("COLUMN_COUNTS", 3);
00141 
00142                 // footer
00143                 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00144 
00145                 $this->showActions(true);
00146 
00147                 include_once ("classes/class.ilObjStyleSheet.php");
00148                 
00149                 $fixed_style = $ilias->getSetting("fixed_content_style_id");
00150                 $default_style = $ilias->getSetting("default_content_style_id");
00151 
00152                 foreach ($style_entries as $style)
00153                 {
00154                         $this->tpl->setCurrentBlock("style_row");
00155                 
00156                         // color changing
00157                         $css_row = ($css_row == "tblrow2")
00158                                 ? "tblrow1"
00159                                 : "tblrow2";
00160 
00161                         $this->tpl->setVariable("CHECKBOX_ID", $style["id"]);
00162                         $this->tpl->setVariable("TXT_TITLE", $style["title"]);
00163                         $this->tpl->setVariable("TXT_DESC", ilObject::_lookupDescription($style["id"]));
00164 //                      $this->tpl->setVariable("LINK_STYLE",
00165 //                              "adm_object.php?ref_id=".$_GET["ref_id"].
00166 //                              "&obj_id=".$style["id"]);
00167                         $this->tpl->setVariable("ROWCOL", $css_row);
00168                         if ($style["id"] == $fixed_style)
00169                         {
00170                                 $this->tpl->setVariable("TXT_PURPOSE", $this->lng->txt("global_fixed"));
00171                         }
00172                         if ($style["id"] == $default_style)
00173                         {
00174                                 $this->tpl->setVariable("TXT_PURPOSE", $this->lng->txt("global_default"));
00175                         }
00176                         $this->tpl->parseCurrentBlock();
00177 
00178                         $this->tpl->setCurrentBlock("tbl_content");
00179                         $this->tpl->parseCurrentBlock();
00180 
00181                 } //if is_array
00182                 
00183                 if (count($style_entries) == 0)
00184                 {
00185             $tbl->disable("header");
00186                         $tbl->disable("footer");
00187                         
00188                         $this->tpl->setCurrentBlock("text");
00189                         $this->tpl->setVariable("TXT_CONTENT", $this->lng->txt("obj_not_found"));
00190                         $this->tpl->parseCurrentBlock();
00191                         
00192                         $this->tpl->setCurrentBlock("tbl_content");
00193                         $this->tpl->parseCurrentBlock();
00194                 }
00195                 
00196                 
00197 
00198                 // render table
00199                 $tbl->render();
00200         }
00201         
00207         function deleteStyleObject($a_error = false)
00208         {
00209                 if (!isset($_POST["id"]))
00210                 {
00211                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00212                 }
00213 
00214                 // SAVE POST VALUES
00215                 $_SESSION["saved_post"] = $_POST["id"];
00216 
00217                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html");
00218 
00219                 if(!$a_error)
00220                 {
00221                         sendInfo($this->lng->txt("info_delete_sure"));
00222                 }
00223 
00224 //              $this->tpl->setVariable("FORMACTION", $this->getFormAction("delete",
00225 //                      "adm_object.php?ref_id=".$_GET["ref_id"]."&cmd=gateway"));
00226 
00227                 // BEGIN TABLE HEADER
00228                 $this->tpl->setCurrentBlock("table_header");
00229                 $this->tpl->setVariable("TEXT", $this->lng->txt("objects"));
00230                 $this->tpl->parseCurrentBlock();
00231                 
00232                 // END TABLE HEADER
00233 
00234                 // BEGIN TABLE DATA
00235                 $counter = 0;
00236 
00237                 foreach ($_POST["id"] as $id)
00238                 {
00239                         $this->tpl->setCurrentBlock("table_row");
00240                         $this->tpl->setVariable("IMG_OBJ",ilUtil::getImagePath("icon_styf.gif"));
00241                         $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
00242                         $this->tpl->setVariable("TEXT_CONTENT",ilObject::_lookupTitle($id));
00243                         $this->tpl->parseCurrentBlock();
00244                 }
00245                 
00246                 // END TABLE DATA
00247 
00248                 // BEGIN OPERATION_BTN
00249                 $buttons = array("confirmedDelete"  => $this->lng->txt("confirm"),
00250                         "cancelDelete"  => $this->lng->txt("cancel"));
00251                 foreach ($buttons as $name => $value)
00252                 {
00253                         $this->tpl->setCurrentBlock("operation_btn");
00254                         $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
00255                         $this->tpl->setVariable("BTN_NAME",$name);
00256                         $this->tpl->setVariable("BTN_VALUE",$value);
00257                         $this->tpl->parseCurrentBlock();
00258                 }
00259         }
00260         
00261         
00265         function confirmedDeleteObject()
00266         {
00267                 global $ilias;
00268                 
00269                 foreach($_SESSION["saved_post"] as $id)
00270                 {
00271                         $this->object->removeStyle($id);
00272                         $style_obj =& $ilias->obj_factory->getInstanceByObjId($id);
00273                         $style_obj->delete();
00274                 }
00275                 $this->object->update();
00276                 
00277                 ilUtil::redirect($this->getReturnLocation("delete",$this->ctrl->getLinkTarget($this,"")));
00278         }
00279         
00280         
00286         function toggleGlobalDefaultObject()
00287         {
00288                 global $ilias;
00289                 
00290                 if (!isset($_POST["id"]))
00291                 {
00292                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00293                 }
00294                 if(count($_POST["id"]) > 1)
00295                 {
00296                         $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
00297                 }
00298 
00299                 $ilias->deleteSetting("fixed_content_style_id");
00300                 $def_style = $ilias->getSetting("default_content_style_id");
00301                 
00302                 if ($def_style != $_POST["id"][0])
00303                 {
00304                         $ilias->setSetting("default_content_style_id", $_POST["id"][0]);
00305                 }
00306                 else
00307                 {
00308                         $ilias->deleteSetting("default_content_style_id");
00309                 }
00310                 
00311                 ilUtil::redirect($this->ctrl->getLinkTarget($this,"view"));
00312         }
00313 
00319         function toggleGlobalFixedObject()
00320         {
00321                 global $ilias;
00322                 
00323                 if (!isset($_POST["id"]))
00324                 {
00325                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00326                 }
00327                 if(count($_POST["id"]) > 1)
00328                 {
00329                         $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
00330                 }
00331 
00332                 $ilias->deleteSetting("default_content_style_id");
00333                 $fixed_style = $ilias->getSetting("fixed_content_style_id");
00334                 if ($fixed_style == $_POST["id"][0])
00335                 {
00336                         $ilias->deleteSetting("fixed_content_style_id");
00337                 }
00338                 else
00339                 {
00340                         $ilias->setSetting("fixed_content_style_id", $_POST["id"][0]);
00341                 }
00342                 ilUtil::redirect($this->ctrl->getLinkTarget($this,"view"));
00343         }
00344 
00345         
00352         function showActions($with_subobjects = false)
00353         {
00354 
00355                 // delete
00356                 $this->tpl->setCurrentBlock("tbl_action_btn");
00357                 $this->tpl->setVariable("BTN_NAME", "deleteStyle");
00358                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
00359                 $this->tpl->parseCurrentBlock();
00360 
00361                 // set global default
00362                 $this->tpl->setCurrentBlock("tbl_action_btn");
00363                 $this->tpl->setVariable("BTN_NAME", "toggleGlobalDefault");
00364                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("toggleGlobalDefault"));
00365                 $this->tpl->parseCurrentBlock();
00366                 
00367                 // set global default
00368                 $this->tpl->setCurrentBlock("tbl_action_btn");
00369                 $this->tpl->setVariable("BTN_NAME", "toggleGlobalFixed");
00370                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("toggleGlobalFixed"));
00371                 $this->tpl->parseCurrentBlock();
00372 
00373                 if ($with_subobjects === true)
00374                 {
00375                         $this->showPossibleSubObjects();
00376                 }
00377                 
00378                 $this->tpl->setCurrentBlock("tbl_action_row");
00379                 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00380                 $this->tpl->parseCurrentBlock();
00381         }
00382 
00383         
00389         function getTabs(&$tabs_gui)
00390         {
00391                 // tabs are defined manually here. The autogeneration via objects.xml will be deprecated in future
00392                 // for usage examples see ilObjGroupGUI or ilObjSystemFolderGUI
00393         }
00394 } // END class.ilObjStyleSheetFolder
00395 ?>

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