00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
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
00100 $_POST = array();
00101 $_GET["cmd"] = "";
00102 }
00103 }
00104
00105
00109 function &executeCommand()
00110 {
00111 global $tree, $rbacsystem, $ilias, $lng;
00112
00113
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
00121
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
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
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
00158 switch ($next_class)
00159 {
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196 default:
00197
00198
00199 if ($next_class != "" && $next_class != "iladministrationgui")
00200 {
00201 $class_path = $this->ctrl->lookupClassPath($next_class);
00202
00203
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
00259
00260 if ($_GET["admin_mode"] != "repository")
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
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
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
00300 if (!$tree->getChilds(RECOVERY_FOLDER_ID))
00301 {
00302 $explorer->addFilter("recf");
00303 }
00304
00305
00306 if ($_GET["admin_mode"] == "settings")
00307 {
00308 $explorer->addFilter("cat");
00309 }
00310 else
00311 {
00312 $explorer->addFilter("adm");
00313 }
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329 $explorer->setOutput(0);
00330 $output = $explorer->getOutput();
00331 $tpl->setCurrentBlock("content");
00332
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 }
00343
00344
00345 ?>