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
00025
00039 require_once "class.ilContainerGUI.php";
00040
00041 class ilObjFolderGUI extends ilContainerGUI
00042 {
00043 var $folder_tree;
00044
00049 function ilObjFolderGUI($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = false)
00050 {
00051 $this->type = "fold";
00052 $this->ilContainerGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output, false);
00053 }
00054
00055
00056 function viewObject()
00057 {
00058 global $tree;
00059
00060 if (strtolower($_GET["baseClass"]) == "iladministrationgui")
00061 {
00062 parent::viewObject();
00063 return true;
00064 }
00065 else if(!$tree->checkForParentType($this->ref_id,'crs'))
00066 {
00067
00068 $this->renderObject();
00069 }
00070 else
00071 {
00072 include_once './course/classes/class.ilCourseContentGUI.php';
00073 $course_content_obj = new ilCourseContentGUI($this);
00074
00075 $this->ctrl->setCmdClass(get_class($course_content_obj));
00076 $this->ctrl->forwardCommand($course_content_obj);
00077 }
00078 $this->tabs_gui->setTabActive('view_content');
00079 return true;
00080 }
00081
00082
00083
00084 function &executeCommand()
00085 {
00086 global $ilUser;
00087
00088 $next_class = $this->ctrl->getNextClass($this);
00089 $cmd = $this->ctrl->getCmd();
00090 $this->prepareOutput();
00091
00092 switch ($next_class)
00093 {
00094 case "ilconditionhandlerinterface":
00095 include_once './classes/class.ilConditionHandlerInterface.php';
00096
00097 if($_GET['item_id'])
00098 {
00099 $this->ctrl->saveParameter($this,'item_id',$_GET['item_id']);
00100 $this->__setSubTabs('activation');
00101 $this->tabs_gui->setTabActive('view_content');
00102
00103 $new_gui =& new ilConditionHandlerInterface($this,(int) $_GET['item_id']);
00104 $this->ctrl->forwardCommand($new_gui);
00105 }
00106 else
00107 {
00108 $new_gui =& new ilConditionHandlerInterface($this);
00109 $this->ctrl->forwardCommand($new_gui);
00110 }
00111 break;
00112
00113 case 'ilpermissiongui':
00114 include_once("./classes/class.ilPermissionGUI.php");
00115 $perm_gui =& new ilPermissionGUI($this);
00116 $ret =& $this->ctrl->forwardCommand($perm_gui);
00117 break;
00118
00119 case 'ilcoursecontentgui':
00120
00121 include_once './course/classes/class.ilCourseContentGUI.php';
00122 $course_content_obj = new ilCourseContentGUI($this);
00123 $this->ctrl->forwardCommand($course_content_obj);
00124 break;
00125
00126 case "illearningprogressgui":
00127 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
00128
00129 $new_gui =& new ilLearningProgressGUI(LP_MODE_REPOSITORY,
00130 $this->object->getRefId(),
00131 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId());
00132 $this->ctrl->forwardCommand($new_gui);
00133 $this->tabs_gui->setTabActive('learning_progress');
00134 break;
00135
00136
00137 default:
00138 if (empty($cmd))
00139 {
00140 $cmd = "view";
00141 }
00142 $cmd .= "Object";
00143 $this->$cmd();
00144 break;
00145 }
00146 }
00147
00151 function setFolderTree($a_tree)
00152 {
00153 $this->folder_tree =& $a_tree;
00154 }
00155
00161 function createObject()
00162 {
00163 global $lng;
00164
00165 $this->lng =& $lng;
00166
00167 $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
00168
00169
00170 $data = array();
00171 $data["fields"] = array();
00172 $data["fields"]["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
00173 $data["fields"]["desc"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["desc"]);
00174
00175 $this->getTemplateFile("edit",$new_type);
00176
00177 foreach ($data["fields"] as $key => $val)
00178 {
00179 $this->tpl->setVariable("TXT_".strtoupper($key), $this->lng->txt($key));
00180 $this->tpl->setVariable(strtoupper($key), $val);
00181 }
00182
00183 $this->tpl->setVariable("FORMACTION", $this->getFormAction("save",$this->ctrl->getFormAction($this)."&new_type=".$new_type));
00184 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($this->type."_new"));
00185 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00186 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt($this->type."_add"));
00187 $this->tpl->setVariable("CMD_SUBMIT", "save");
00188 $this->tpl->setVariable("TARGET", $this->getTargetFrame("save"));
00189 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
00190 }
00191
00197 function saveObject($a_parent = 0)
00198 {
00199 global $lng;
00200
00201 $this->lng =& $lng;
00202
00203 if ($a_parent == 0)
00204 {
00205 $a_parent = $_GET["ref_id"];
00206 }
00207
00208
00209 include_once("classes/class.ilObjFolder.php");
00210 $folderObj = new ilObjFolder(0,$this->withReferences());
00211 $folderObj->setType($this->type);
00212 $folderObj->setTitle(ilUtil::stripSlashes($_POST["Fobject"]["title"]));
00213 $folderObj->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
00214 $folderObj->create();
00215 $this->object =& $folderObj;
00216
00217 if (is_object($this->folder_tree))
00218 {
00219 $folderObj->setFolderTree($this->folder_tree);
00220 }
00221 else
00222 {
00223 $folderObj->setFolderTree($this->tree);
00224 }
00225
00226 if ($this->withReferences())
00227 {
00228 $folderObj->createReference();
00229 $folderObj->setPermissions($a_parent);
00230 }
00231
00232 $folderObj->putInTree($a_parent);
00233
00234 sendInfo($this->lng->txt("fold_added"),true);
00235 $this->ctrl->returnToParent($this);
00236
00237 }
00238
00244 function updateObject($a_return_to_parent = false)
00245 {
00246 $this->object->setTitle(ilUtil::stripSlashes($_POST["Fobject"]["title"]));
00247 $this->object->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
00248 $this->update = $this->object->update();
00249
00250 sendInfo($this->lng->txt("msg_obj_modified"),true);
00251
00252 if ($a_return_to_parent)
00253 {
00254 $this->ctrl->returnToParent($this);
00255 }
00256 else
00257 {
00258 $this->ctrl->redirect($this);
00259 }
00260 }
00261
00262
00263
00264 function getTabs(&$tabs_gui)
00265 {
00266 global $rbacsystem;
00267
00268 $this->ctrl->setParameter($this,"ref_id",$this->ref_id);
00269
00270 $tabs_gui->setTabActive("");
00271 if ($rbacsystem->checkAccess('read',$this->ref_id))
00272 {
00273 $tabs_gui->addTarget("view_content",
00274 $this->ctrl->getLinkTarget($this, ""),
00275 array("", "view", "cciMove", "enableAdministrationPanel",
00276 "disableAdministrationPanel", "render"),
00277 get_class($this));
00278 }
00279
00280 if ($rbacsystem->checkAccess('write',$this->ref_id))
00281 {
00282 $tabs_gui->addTarget("edit_properties",
00283 $this->ctrl->getLinkTarget($this, "edit"), "edit", get_class($this));
00284 }
00285
00286
00287 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
00288 if($rbacsystem->checkAccess('read',$this->ref_id) and ilObjUserTracking::_enabledLearningProgress())
00289 {
00290 $tabs_gui->addTarget('learning_progress',
00291 $this->ctrl->getLinkTargetByClass(array('ilobjfoldergui','illearningprogressgui'),''),
00292 '',
00293 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
00294 }
00295
00296 if ($rbacsystem->checkAccess('edit_permission',$this->ref_id))
00297 {
00298 $tabs_gui->addTarget("perm_settings",
00299 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
00300 }
00301
00302
00303 if ($this->ctrl->getTargetScript() == "repository.php" and !empty($_SESSION['il_rep_clipboard']))
00304 {
00305 $tabs_gui->addTarget("clipboard",
00306 $this->ctrl->getLinkTarget($this, "clipboard"), "clipboard", get_class($this));
00307 }
00308
00309 }
00310
00311
00312 function initCourseContentInterface()
00313 {
00314 include_once "./course/classes/class.ilCourseContentInterface.php";
00315
00316 $this->cci_obj =& new ilCourseContentInterface($this,$this->object->getRefId());
00317
00318
00319 #aggregate($this,"ilCourseContentInterface");
00320 #$this->cci_init($this,$this->object->getRefId());
00321 }
00322
00323
00324 function initConditionHandlerGUI($item_id)
00325 {
00326 include_once './classes/class.ilConditionHandlerInterface.php';
00327
00328 if(!is_object($this->chi_obj))
00329 {
00330 if($_GET['item_id'])
00331 {
00332 $this->chi_obj =& new ilConditionHandlerInterface($this,$item_id);
00333 $this->ctrl->saveParameter($this,'item_id',$_GET['item_id']);
00334 }
00335 else
00336 {
00337 $this->chi_obj =& new ilConditionHandlerInterface($this);
00338 }
00339 }
00340 return true;
00341 }
00342
00346 function __setSubTabs($a_tab)
00347 {
00348 global $rbacsystem,$ilUser;
00349
00350 switch ($a_tab)
00351 {
00352
00353 case "activation":
00354
00355 $this->tabs_gui->addSubTabTarget("activation",
00356 $this->ctrl->getLinkTargetByClass('ilCourseItemAdministrationGUI','edit'),
00357 "edit", get_class($this));
00358 $this->ctrl->setParameterByClass('ilconditionhandlerinterface','item_id',(int) $_GET['item_id']);
00359 $this->tabs_gui->addSubTabTarget("preconditions",
00360 $this->ctrl->getLinkTargetByClass('ilConditionHandlerInterface','listConditions'),
00361 "", "ilConditionHandlerInterface");
00362 break;
00363 }
00364 }
00365
00369 function _goto($a_target)
00370 {
00371 global $ilAccess, $ilErr, $lng;
00372
00373 if ($ilAccess->checkAccess("read", "", $a_target))
00374 {
00375 $_GET["cmd"] = "frameset";
00376 $_GET["ref_id"] = $a_target;
00377 include("repository.php");
00378 exit;
00379 }
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
00410 }
00411
00412
00413 }
00414 ?>