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

classes/class.ilAdministrationGUI.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 
00024 include_once("classes/class.ilTableGUI.php");
00025 include_once("classes/class.ilTabsGUI.php");
00026 
00050 class ilAdministrationGUI
00051 {
00052         var $lng;
00053         var $ilias;
00054         var $tpl;
00055         var $tree;
00056         var $rbacsystem;
00057         var $cur_ref_id;
00058         var $cmd;
00059         var $mode;
00060         var $ctrl;
00061 
00066         function ilAdministrationGUI()
00067         {
00068                 global $lng, $ilias, $tpl, $tree, $rbacsystem, $objDefinition,
00069                         $_GET, $ilCtrl, $ilLog;;
00070 
00071                 $this->lng =& $lng;
00072                 $this->ilias =& $ilias;
00073                 $this->tpl =& $tpl;
00074                 $this->tree =& $tree;
00075                 $this->rbacsystem =& $rbacsystem;
00076                 $this->objDefinition =& $objDefinition;
00077 
00078                 $this->ctrl =& $ilCtrl;
00079                 
00080                 $this->creation_mode = false;
00081 
00082                 $this->ctrl->saveParameter($this, array("ref_id", "admin_mode"));
00083                 
00084                 if ($_GET["admin_mode"] != "repository")
00085                 {
00086                         $_GET["admin_mode"] = "settings";
00087                 }
00088                 
00089                 if (!ilUtil::isAPICall())
00090                         $this->ctrl->setReturn($this,"");
00091 
00092                 // determine current ref id and mode
00093                 if (!empty($_GET["ref_id"]) && $tree->isInTree($_GET["ref_id"]))
00094                 {
00095                         $this->cur_ref_id = $_GET["ref_id"];
00096                 }
00097                 else
00098                 {
00099                         //$this->cur_ref_id = $this->tree->getRootId();
00100                         $_POST = array();
00101                         $_GET["cmd"] = "";
00102                 }
00103         }
00104 
00105         
00109         function &executeCommand()
00110         {
00111                 global $tree, $rbacsystem, $ilias, $lng;
00112                 
00113                 // permission checks
00114                 include_once './classes/class.ilMainMenuGUI.php';
00115                 if(!ilMainMenuGUI::_checkAdministrationPermission())
00116                 {
00117                         $ilias->raiseError("You are not entitled to access this page!",$ilias->error_obj->WARNING);
00118                 }
00119 
00120                 // check creation mode
00121                 // determined by "new_type" parameter
00122                 $new_type = $_POST["new_type"]
00123                         ? $_POST["new_type"]
00124                         : $_GET["new_type"];
00125                 if ($new_type != "" && $this->ctrl->getCmd() == "create")
00126                 {
00127                         $this->creation_mode = true;
00128                 }
00129 
00130                 // determine next class
00131                 if ($this->creation_mode)
00132                 {
00133                         $obj_type = $new_type;
00134                         $class_name = $this->objDefinition->getClassName($obj_type);
00135                         $next_class = strtolower("ilObj".$class_name."GUI");
00136                         $this->ctrl->setCmdClass($next_class);
00137                 }
00138                 else
00139                 {
00140                         $next_class = $this->ctrl->getNextClass($this);
00141                 }
00142 
00143                 if (($next_class == "iladministrationgui" || $next_class == ""
00144                         ) && ($this->ctrl->getCmd() == "return"))
00145                 {
00146 
00147                         // get GUI of current object
00148                         $obj_type = ilObject::_lookupType($this->cur_ref_id,true);
00149                         $class_name = $this->objDefinition->getClassName($obj_type);
00150                         $next_class = strtolower("ilObj".$class_name."GUI");
00151                         $this->ctrl->setCmdClass($next_class);
00152                         $this->ctrl->setCmd("view");
00153                 }
00154                 
00155                 $cmd = $this->ctrl->getCmd("frameset");
00156                 
00157 //echo "<br>cmd:$cmd:nextclass:$next_class:-".$_GET["cmdClass"]."-".$_GET["cmd"]."-";
00158                 switch ($next_class)
00159                 {
00160                         /*
00161                         case "ilobjusergui":
00162                                 include_once("./classes/class.ilObjUserGUI.php");
00163 
00164                                 if(!$_GET['obj_id'])
00165                                 {
00166                                         $this->gui_obj = new ilObjUserGUI("",$_GET['ref_id'],true, false);
00167                                         $this->gui_obj->setCreationMode($this->creation_mode);
00168 
00169                                         $this->prepareOutput(false);
00170                                         $ret =& $this->ctrl->forwardCommand($this->gui_obj);
00171                                 }
00172                                 else
00173                                 {
00174                                         $this->gui_obj = new ilObjUserGUI("", $_GET['obj_id'],false, false);
00175                                         $this->gui_obj->setCreationMode($this->creation_mode);
00176 
00177                                         $this->prepareOutput(false);
00178                                         $ret =& $this->ctrl->forwardCommand($this->gui_obj);
00179                                 }
00180                                 $this->tpl->show();
00181                                 break;
00182                         */
00183                                 
00184                         /*
00185                         case "ilobjuserfoldergui":
00186                                 include_once("./classes/class.ilObjUserFolderGUI.php");
00187 
00188                                 $this->gui_obj = new ilObjUserFolderGUI("", $_GET['ref_id'],true, false);
00189                                 $this->gui_obj->setCreationMode($this->creation_mode);
00190 
00191                                 $this->prepareOutput(false);
00192                                 $ret =& $this->ctrl->forwardCommand($this->gui_obj);
00193                                 $this->tpl->show();
00194                                 break;*/
00195 
00196                         default:
00197                         
00198                                 // forward all other classes to gui commands
00199                                 if ($next_class != "" && $next_class != "iladministrationgui")
00200                                 {
00201                                         $class_path = $this->ctrl->lookupClassPath($next_class);
00202 
00203                                         // get gui class instance
00204                                         include_once($class_path);
00205                                         $class_name = $this->ctrl->getClassForClasspath($class_path);
00206                                         
00207                                         if (($next_class == "ilobjrolegui" || $next_class == "ilobjusergui"
00208                                                 || $next_class == "ilobjroletemplategui"
00209                                                 || $next_class == "ilobjstylesheetgui"))
00210                                         {
00211                                                 if ($_GET["obj_id"] != "")
00212                                                 {
00213                                                         $this->gui_obj = new $class_name("", $_GET["obj_id"], false, false);
00214                                                         $this->gui_obj->setCreationMode(false);
00215                                                 }
00216                                                 else
00217                                                 {
00218                                                         $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
00219                                                         $this->gui_obj->setCreationMode(true);
00220                                                 }
00221                                         }
00222                                         else
00223                                         {
00224                                                 $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
00225                                                 $this->gui_obj->setCreationMode($this->creation_mode);
00226                                         }
00227                                         $tabs_out = ($new_type == "")
00228                                                 ? true
00229                                                 : false;
00230                                         
00231                                         $this->ctrl->setReturn($this, "return");                                        
00232                                         $ret =& $this->ctrl->forwardCommand($this->gui_obj);
00233                                         $html = $this->gui_obj->getHTML();
00234                                         if ($html != "")
00235                                         {
00236                                                 $this->tpl->setVariable("OBJECTS", $html);
00237                                         }
00238                                         $this->tpl->show();
00239                                 }
00240                                 else    // 
00241                                 {
00242                                         $cmd = $this->ctrl->getCmd("frameset");
00243                                         $this->$cmd();
00244                                 }
00245                                 break;
00246                 }
00247         }
00248 
00252         function frameset()
00253         {
00254                 global $tree;
00255 
00256                 $tpl = new ilTemplate("tpl.adm_frameset.html", false, false);
00257                 $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00258 //echo "<br>-".$this->ctrl->getLinkTarget($this, "view")."-";
00259 
00260                 if ($_GET["admin_mode"] != "repository")        // settings
00261                 {
00262                         $this->ctrl->setParameter($this, "ref_id", SYSTEM_FOLDER_ID);
00263                         $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "settings");
00264                         $tpl->setVariable("MAIN_CONTENT", $this->ctrl->getLinkTargetByClass("ilobjsystemfoldergui", "view"));
00265                         $this->ctrl->setParameter($this, "expand", "1");
00266                         $tpl->setVariable("TREE_CONTENT", $this->ctrl->getLinkTarget($this, "showTree"));
00267         //echo "<br>+".$this->ctrl->getLinkTarget($this, "showTree")."+";
00268                         $tpl->parseCurrentBlock();
00269                         $tpl->show();
00270                 }
00271                 else
00272                 {
00273                         $this->ctrl->setParameter($this, "ref_id", ROOT_FOLDER_ID);
00274                         $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "repository");
00275                         $tpl->setVariable("MAIN_CONTENT", $this->ctrl->getLinkTargetByClass("ilobjrootfoldergui", "view"));
00276                         $this->ctrl->setParameter($this, "expand", "1");
00277                         $tpl->setVariable("TREE_CONTENT", $this->ctrl->getLinkTarget($this, "showTree"));
00278         //echo "<br>+".$this->ctrl->getLinkTarget($this, "showTree")."+";
00279                         $tpl->parseCurrentBlock();
00280                         $tpl->show();
00281                 }
00282         }
00283 
00287         function showTree()
00288         {
00289                 global $tpl, $tree, $lng;
00290 
00291                 require_once "classes/class.ilAdministrationExplorer.php";
00292 
00293                 $tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
00294                 
00295                 $explorer = new ilAdministrationExplorer("ilias.php?baseClass=ilAdministrationGUI&cmd=view");           
00296                 $explorer->setExpand($_GET["expand"]);
00297                 $explorer->setExpandTarget($this->ctrl->getLinkTarget($this, "showTree"));
00298                 
00299                 // hide RecoveryFolder if empty
00300                 if (!$tree->getChilds(RECOVERY_FOLDER_ID))
00301                 {
00302                         $explorer->addFilter("recf");
00303                 }
00304                 //$explorer->addFilter("rolf");
00305 
00306                 if ($_GET["admin_mode"] == "settings")
00307                 {
00308                         $explorer->addFilter("cat");
00309                 }
00310                 else
00311                 {
00312                         $explorer->addFilter("adm");
00313                 }
00314                 /*
00315                 $explorer->addFilter("root");
00316                 $explorer->addFilter("cat");
00317                 $explorer->addFilter("grp");
00318                 $explorer->addFilter("crs");
00319                 $explorer->addFilter("le");
00320                 $explorer->addFilter("frm");
00321                 $explorer->addFilter("lo");
00322                 $explorer->addFilter("rolf");
00323                 $explorer->addFilter("adm");
00324                 $explorer->addFilter("lngf");
00325                 $explorer->addFilter("usrf");
00326                 $explorer->addFilter("objf");
00327                 */
00328                 //$explorer->setFiltered(false);
00329                 $explorer->setOutput(0);                
00330                 $output = $explorer->getOutput();               
00331                 $tpl->setCurrentBlock("content");
00332                 //$tpl->setVariable("TXT_EXPLORER_HEADER", $lng->txt("all_objects"));
00333                 $tpl->setVariable("EXP_REFRESH", $lng->txt("refresh"));
00334                 $tpl->setVariable("EXPLORER",$output);
00335                 $this->ctrl->setParameter($this, "expand", $_GET["expand"]);
00336                 $tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, "showTree"));
00337                 $tpl->parseCurrentBlock();
00338                 
00339                 $tpl->show(false);
00340         }
00341 
00342 } // END class.ilRepository
00343 
00344 
00345 ?>

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