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