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

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