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

Generated on Fri Dec 13 2013 13:52:06 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1