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 = true)
00049 {
00050 $this->type = "fold";
00051 $this->ilContainerGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
00052 }
00053
00054
00055 function viewObject()
00056 {
00057 global $tree;
00058
00059 if($this->ctrl->getTargetScript() == "adm_object.php")
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 $this->initCourseContentInterface();
00072 $this->cci_obj->cci_setContainer($this);
00073 $this->cci_obj->cci_view();
00074 }
00075 return true;
00076 }
00077
00078
00079
00080 function &executeCommand()
00081 {
00082 $next_class = $this->ctrl->getNextClass($this);
00083 $cmd = $this->ctrl->getCmd();
00084 switch ($next_class)
00085 {
00086 case "ilconditionhandlerinterface":
00087 include_once './classes/class.ilConditionHandlerInterface.php';
00088
00089 if($_GET['item_id'])
00090 {
00091 $new_gui =& new ilConditionHandlerInterface($this,(int) $_GET['item_id']);
00092 $this->ctrl->saveParameter($this,'item_id',$_GET['item_id']);
00093 $new_gui->setBackButtons(array('edit' => $this->ctrl->getLinkTarget($this,'cciEdit'),
00094 'preconditions' => $this->ctrl->getLinkTargetByClass('ilconditionhandlerinterface',
00095 'listConditions')));
00096
00097 $this->ctrl->forwardCommand($new_gui);
00098 }
00099 else
00100 {
00101 $new_gui =& new ilConditionHandlerInterface($this);
00102 $this->ctrl->forwardCommand($new_gui);
00103 }
00104 break;
00105
00106 default:
00107 if (empty($cmd))
00108 {
00109 $cmd = "view";
00110 }
00111 $cmd .= "Object";
00112 $this->$cmd();
00113 break;
00114 }
00115 }
00116
00120 function setFolderTree($a_tree)
00121 {
00122 $this->folder_tree =& $a_tree;
00123 }
00124
00130 function createObject()
00131 {
00132 global $lng;
00133
00134 $this->lng =& $lng;
00135
00136 $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
00137
00138
00139 $data = array();
00140 $data["fields"] = array();
00141 $data["fields"]["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
00142 $data["fields"]["desc"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["desc"]);
00143
00144 $this->getTemplateFile("edit",$new_type);
00145
00146 foreach ($data["fields"] as $key => $val)
00147 {
00148 $this->tpl->setVariable("TXT_".strtoupper($key), $this->lng->txt($key));
00149 $this->tpl->setVariable(strtoupper($key), $val);
00150 }
00151
00152 $this->tpl->setVariable("FORMACTION", $this->getFormAction("save",$this->ctrl->getFormAction($this)."&new_type=".$new_type));
00153 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($this->type."_new"));
00154 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00155 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt($this->type."_add"));
00156 $this->tpl->setVariable("CMD_SUBMIT", "save");
00157 $this->tpl->setVariable("TARGET", $this->getTargetFrame("save"));
00158 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
00159 }
00160
00166 function saveObject($a_parent = 0)
00167 {
00168 global $lng;
00169
00170 $this->lng =& $lng;
00171
00172 if ($a_parent == 0)
00173 {
00174 $a_parent = $_GET["ref_id"];
00175 }
00176
00177
00178 include_once("classes/class.ilObjFolder.php");
00179 $folderObj = new ilObjFolder(0,$this->withReferences());
00180 $folderObj->setType($this->type);
00181 $folderObj->setTitle(ilUtil::stripSlashes($_POST["Fobject"]["title"]));
00182 $folderObj->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
00183 $folderObj->create();
00184 $this->object =& $folderObj;
00185
00186 if (is_object($this->folder_tree))
00187 {
00188 $folderObj->setFolderTree($this->folder_tree);
00189 }
00190 else
00191 {
00192 $folderObj->setFolderTree($this->tree);
00193 }
00194
00195 if ($this->withReferences())
00196 {
00197 $folderObj->createReference();
00198 $folderObj->setPermissions($a_parent);
00199 }
00200
00201 $folderObj->putInTree($a_parent);
00202
00203 sendInfo($this->lng->txt("fold_added"),true);
00204 ilUtil::redirect($this->getReturnLocation("save",$this->ctrl->getLinkTarget($this,"")));
00205
00206 }
00207
00208
00209 function getTabs(&$tabs_gui)
00210 {
00211 global $rbacsystem;
00212
00213 $this->ctrl->setParameter($this,"ref_id",$this->ref_id);
00214
00215 if ($rbacsystem->checkAccess('read',$this->ref_id))
00216 {
00217 $tabs_gui->addTarget("view_content",
00218 $this->ctrl->getLinkTarget($this, ""), "", get_class($this));
00219 }
00220
00221 if ($rbacsystem->checkAccess('write',$this->ref_id))
00222 {
00223 $tabs_gui->addTarget("edit_properties",
00224 $this->ctrl->getLinkTarget($this, "edit"), "edit", get_class($this));
00225 }
00226
00227 if ($rbacsystem->checkAccess('edit_permission',$this->ref_id))
00228 {
00229 $tabs_gui->addTarget("perm_settings",
00230 $this->ctrl->getLinkTarget($this, "perm"), "perm", get_class($this));
00231 }
00232
00233
00234 if ($this->ctrl->getTargetScript() == "repository.php" and !empty($_SESSION['il_rep_clipboard']))
00235 {
00236 $tabs_gui->addTarget("clipboard",
00237 $this->ctrl->getLinkTarget($this, "clipboard"), "clipboard", get_class($this));
00238 }
00239
00240 if ($this->ctrl->getTargetScript() == "adm_object.php")
00241 {
00242 $tabs_gui->addTarget("show_owner",
00243 $this->ctrl->getLinkTarget($this, "owner"), "owner", get_class($this));
00244
00245 if ($this->tree->getSavedNodeData($this->ref_id))
00246 {
00247 $tabs_gui->addTarget("trash",
00248 $this->ctrl->getLinkTarget($this, "trash"), "trash", get_class($this));
00249 }
00250 }
00251 }
00252
00253
00254 function initCourseContentInterface()
00255 {
00256 include_once "./course/classes/class.ilCourseContentInterface.php";
00257
00258 $this->cci_obj =& new ilCourseContentInterface($this,$this->object->getRefId());
00259
00260
00261 #aggregate($this,"ilCourseContentInterface");
00262 #$this->cci_init($this,$this->object->getRefId());
00263 }
00264
00265 function cciEditObject()
00266 {
00267 global $rbacsystem;
00268
00269
00270 if(!$rbacsystem->checkAccess("write", $this->ref_id))
00271 {
00272 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
00273 }
00274
00275 $this->initCourseContentInterface();
00276 $this->cci_obj->cci_setContainer($this);
00277 $this->cci_obj->cci_edit();
00278
00279 return true;;
00280 }
00281
00282 function cciUpdateObject()
00283 {
00284 global $rbacsystem;
00285
00286
00287 if(!$rbacsystem->checkAccess("write", $this->ref_id))
00288 {
00289 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
00290 }
00291
00292 $this->initCourseContentInterface();
00293 $this->cci_obj->cci_setContainer($this);
00294 $this->cci_obj->cci_update();
00295
00296 return true;;
00297 }
00298 function cciMoveObject()
00299 {
00300 global $rbacsystem;
00301
00302
00303 if(!$rbacsystem->checkAccess("write", $this->ref_id))
00304 {
00305 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
00306 }
00307
00308 $this->initCourseContentInterface();
00309 $this->cci_obj->cci_setContainer($this);
00310 $this->cci_obj->cci_move();
00311
00312 return true;;
00313 }
00314
00315 function initConditionHandlerGUI($item_id)
00316 {
00317 include_once './classes/class.ilConditionHandlerInterface.php';
00318
00319 if(!is_object($this->chi_obj))
00320 {
00321 if($_GET['item_id'])
00322 {
00323 $this->chi_obj =& new ilConditionHandlerInterface($this,$item_id);
00324 $this->ctrl->saveParameter($this,'item_id',$_GET['item_id']);
00325 }
00326 else
00327 {
00328 $this->chi_obj =& new ilConditionHandlerInterface($this);
00329 }
00330 }
00331 return true;
00332 }
00333
00334 function chi_updateObject()
00335 {
00336 $this->initConditionHandlerGUI($_GET['item_id'] ? $_GET['item_id'] : $this->object->getRefId());
00337 $this->chi_obj->chi_update();
00338
00339 if($_GET['item_id'])
00340 {
00341 $this->cciEditObject();
00342 }
00343 else
00344 {
00345 $this->editObject();
00346 }
00347 }
00348 function chi_deleteObject()
00349 {
00350 $this->initConditionHandlerGUI($_GET['item_id'] ? $_GET['item_id'] : $this->object->getRefId());
00351 $this->chi_obj->chi_delete();
00352
00353 if($_GET['item_id'])
00354 {
00355 $this->cciEditObject();
00356 }
00357 else
00358 {
00359 $this->editObject();
00360 }
00361 }
00362
00363 function chi_selectorObject()
00364 {
00365 $this->initConditionHandlerGUI($_GET['item_id'] ? $_GET['item_id'] : $this->object->getRefId());
00366 $this->chi_obj->chi_selector();
00367 }
00368
00369 function chi_assignObject()
00370 {
00371 $this->initConditionHandlerGUI($_GET['item_id'] ? $_GET['item_id'] : $this->object->getRefId());
00372 $this->chi_obj->chi_assign();
00373
00374 if($_GET['item_id'])
00375 {
00376 $this->cciEditObject();
00377 }
00378 else
00379 {
00380 $this->editObject();
00381 }
00382 }
00383 }
00384 ?>