Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00037 require_once "classes/class.ilObject.php";
00038
00039
00040 class ilObjFileBasedLM extends ilObject
00041 {
00042 var $tree;
00043
00050 function ilObjFileBasedLM($a_id = 0,$a_call_by_reference = true)
00051 {
00052
00053 $this->type = "htlm";
00054 $this->ilObject($a_id,$a_call_by_reference);
00055 }
00056
00062
00063
00064
00065
00066
00067
00068
00069
00075
00076
00077
00078
00079
00080
00081
00082
00088
00089
00090
00091
00092
00093
00094
00100
00101
00102
00103
00104
00105
00106
00112
00113
00114
00115
00116
00117
00118
00124
00125
00126
00127
00128
00129
00130
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00160 function update()
00161 {
00162 global $ilDB;
00163
00164 $this->updateMetaData();
00165 parent::update();
00166
00167 $q = "UPDATE file_based_lm SET ".
00168 " online = ".$ilDB->quote(ilUtil::tf2yn($this->getOnline())).",".
00169 " startfile = ".$ilDB->quote($this->getStartFile())." ".
00170 " WHERE id = ".$ilDB->quote($this->getId())." ";
00171 $this->ilias->db->query($q);
00172
00173 return true;
00174 }
00175
00179 function read()
00180 {
00181 global $ilDB;
00182
00183 parent::read();
00184
00185 $q = "SELECT * FROM file_based_lm WHERE id = ".$ilDB->quote($this->getId());
00186 $lm_set = $this->ilias->db->query($q);
00187 $lm_rec = $lm_set->fetchRow(DB_FETCHMODE_ASSOC);
00188 $this->setOnline(ilUtil::yn2tf($lm_rec["online"]));
00189 $this->setStartFile($lm_rec["startfile"]);
00190
00191 }
00192
00196 function initBibItemObject()
00197 {
00198 include_once("./Modules/LearningModule/classes/class.ilBibItem.php");
00199
00200 $this->bib_obj =& new ilBibItem($this);
00201 $this->bib_obj->read();
00202
00203 return true;
00204 }
00205
00206
00210 function create()
00211 {
00212 global $ilDB;
00213
00214 parent::create();
00215 $this->createDataDirectory();
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226 $q = "INSERT INTO file_based_lm (id, online, startfile) VALUES ".
00227 " (".$ilDB->quote($this->getID()).",".$ilDB->quote("n").",".
00228 $ilDB->quote("").")";
00229 $ilDB->query($q);
00230
00231 $this->createMetaData();
00232 }
00233
00234 function getDataDirectory($mode = "filesystem")
00235 {
00236 $lm_data_dir = ilUtil::getWebspaceDir($mode)."/lm_data";
00237 $lm_dir = $lm_data_dir."/lm_".$this->getId();
00238
00239 return $lm_dir;
00240 }
00241
00242 function createDataDirectory()
00243 {
00244 ilUtil::makeDir($this->getDataDirectory());
00245 }
00246
00247 function getStartFile()
00248 {
00249 return $this->start_file;
00250 }
00251
00252 function setStartFile($a_file)
00253 {
00254 $this->start_file = $a_file;
00255 }
00256
00257 function setOnline($a_online)
00258 {
00259 $this->online = $a_online;
00260 }
00261
00262 function getOnline()
00263 {
00264 return $this->online;
00265 }
00266
00270 function _lookupOnline($a_id)
00271 {
00272 global $ilDB;
00273
00274 $q = "SELECT * FROM file_based_lm WHERE id = ".$ilDB->quote($a_id);
00275 $lm_set = $this->ilias->db->query($q);
00276 $lm_rec = $lm_set->fetchRow(DB_FETCHMODE_ASSOC);
00277
00278 return ilUtil::yn2tf($lm_rec["online"]);
00279 }
00280
00281
00282
00293 function delete()
00294 {
00295 global $ilDB;
00296
00297
00298 if (!parent::delete())
00299 {
00300 return false;
00301 }
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311 $this->deleteMetaData();
00312
00313
00314 include_once("classes/class.ilNestedSetXML.php");
00315 $nested = new ilNestedSetXML();
00316 $nested->init($this->getId(), "bib");
00317 $nested->deleteAllDBData();
00318
00319
00320 $q = "DELETE FROM file_based_lm WHERE id = ".
00321 $ilDB->quote($this->getID());
00322 $ilDB->query($q);
00323
00324
00325 ilUtil::delDir($this->getDataDirectory());
00326
00327 return true;
00328 }
00329
00339 function initDefaultRoles()
00340 {
00341 global $rbacadmin;
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353 return $roles ? $roles : array();
00354 }
00355
00369 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
00370 {
00371 global $tree;
00372
00373 switch ($a_event)
00374 {
00375 case "link":
00376
00377
00378
00379
00380 break;
00381
00382 case "cut":
00383
00384
00385
00386 break;
00387
00388 case "copy":
00389
00390
00391
00392
00393 break;
00394
00395 case "paste":
00396
00397
00398
00399 break;
00400
00401 case "new":
00402
00403
00404
00405 break;
00406 }
00407
00408
00409 if ($a_node_id==$_GET["ref_id"])
00410 {
00411 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
00412 $parent_type = $parent_obj->getType();
00413 if($parent_type == $this->getType())
00414 {
00415 $a_node_id = (int) $tree->getParentId($a_node_id);
00416 }
00417 }
00418
00419 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
00420 }
00421
00422 }
00423 ?>