ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjFileBasedLM Class Reference

File Based Learning Module (HTML) object. More...

+ Inheritance diagram for ilObjFileBasedLM:
+ Collaboration diagram for ilObjFileBasedLM:

Public Member Functions

 ilObjFileBasedLM ($a_id=0, $a_call_by_reference=true)
 Constructor public. More...
 
 update ()
 update object data More...
 
 read ()
 read object More...
 
 initBibItemObject ()
 init bib object (contains all bib item data) More...
 
 create ()
 create file based lm More...
 
 getDataDirectory ($mode="filesystem")
 
 createDataDirectory ()
 
 getStartFile ()
 
 setStartFile ($a_file)
 
 setOnline ($a_online)
 
 getOnline ()
 
 _lookupOnline ($a_id)
 check wether content object is online More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 delete ()
 delete object and all related data More...
 
 initDefaultRoles ()
 init default roles settings More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event happend, each object may decide how it reacts. More...
 
 populateByDirectoy ($a_dir, $a_filename="")
 Populate by directory. More...
 
 cloneObject ($a_target_id, $a_copy_id=0)
 Clone HTML learning module. More...
 
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public More...
 
 createRoleFolder ()
 creates a local role folder More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. More...
 

Data Fields

 $tree
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $ilias
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 
 $obj_data_record
 object_data record More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Detailed Description

File Based Learning Module (HTML) object.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

$Id$

Definition at line 20 of file class.ilObjFileBasedLM.php.

Member Function Documentation

◆ _lookupOnline()

ilObjFileBasedLM::_lookupOnline (   $a_id)

check wether content object is online

Definition at line 144 of file class.ilObjFileBasedLM.php.

References $lm_set, and ilUtil\yn2tf().

145  {
146  global $ilDB;
147 
148  $q = "SELECT * FROM file_based_lm WHERE id = ".$ilDB->quote($a_id, "integer");
149  $lm_set = $ilDB->query($q);
150  $lm_rec = $ilDB->fetchAssoc($lm_set);
151 
152  return ilUtil::yn2tf($lm_rec["is_online"]);
153  }
$lm_set
static yn2tf($a_yn)
convert "y"/"n" to true/false
+ Here is the call graph for this function:

◆ cloneObject()

ilObjFileBasedLM::cloneObject (   $a_target_id,
  $a_copy_id = 0 
)

Clone HTML learning module.

Parameters
inttarget ref_id
intcopy id

Definition at line 333 of file class.ilObjFileBasedLM.php.

References ilObject\$ilias, $ilUser, ilObject\cloneMetaData(), getDataDirectory(), ilObject\getDescription(), getStartFile(), and ilObject\getTitle().

334  {
335  global $ilDB, $ilUser, $ilias;
336 
337  $new_obj = parent::cloneObject($a_target_id,$a_copy_id);
338  $this->cloneMetaData($new_obj);
339 
340  $new_obj->setTitle($this->getTitle());
341  $new_obj->setDescription($this->getDescription());
342 
343  // copy content
344  $new_obj->populateByDirectoy($this->getDataDirectory());
345 
346  $new_obj->setStartFile($this->getStartFile());
347  $new_obj->update();
348 
349  return $new_obj;
350  }
getDataDirectory($mode="filesystem")
getTitle()
get object title public
getDescription()
get object description
cloneMetaData($target_obj)
Copy meta data.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ create()

ilObjFileBasedLM::create ( )

create file based lm

Definition at line 93 of file class.ilObjFileBasedLM.php.

References createDataDirectory(), and ilObject\createMetaData().

94  {
95  global $ilDB;
96 
97  parent::create();
98  $this->createDataDirectory();
99 
100  $ilDB->manipulate("INSERT INTO file_based_lm (id, is_online, startfile) VALUES ".
101  " (".$ilDB->quote($this->getID(), "integer").",".
102  $ilDB->quote("n", "text").",".
103  $ilDB->quote($this->getStartfile(), "text").")");
104 
105  $this->createMetaData();
106  }
createMetaData()
create meta data entry
+ Here is the call graph for this function:

◆ createDataDirectory()

ilObjFileBasedLM::createDataDirectory ( )

Definition at line 116 of file class.ilObjFileBasedLM.php.

References getDataDirectory(), and ilUtil\makeDir().

Referenced by create().

117  {
119  }
getDataDirectory($mode="filesystem")
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilObjFileBasedLM::delete ( )

delete object and all related data

this method has been tested on may 9th 2004 data directory, meta data, file based lm data and bib items have been deleted correctly as desired

public

Returns
boolean true if all object data were removed; false if only a references were removed

Definition at line 179 of file class.ilObjFileBasedLM.php.

References ilUtil\delDir(), ilObject\deleteMetaData(), getDataDirectory(), and ilObject\getId().

180  {
181  global $ilDB;
182 
183  // always call parent delete function first!!
184  if (!parent::delete())
185  {
186  return false;
187  }
188 
189  // delete meta data of content object
190 /*
191  $nested = new ilNestedSetXML();
192  $nested->init($this->getId(), $this->getType());
193  $nested->deleteAllDBData();
194 */
195 
196  // Delete meta data
197  $this->deleteMetaData();
198 
199  // delete bibliographical items of object
200  include_once("./Services/Xml/classes/class.ilNestedSetXML.php");
201  $nested = new ilNestedSetXML();
202  $nested->init($this->getId(), "bib");
203  $nested->deleteAllDBData();
204 
205  // delete file_based_lm record
206  $ilDB->manipulate("DELETE FROM file_based_lm WHERE id = ".
207  $ilDB->quote($this->getID(), "integer"));
208 
209  // delete data directory
211 
212  return true;
213  }
getDataDirectory($mode="filesystem")
Class NestedSetXML functions for storing XML-Data into nested-set-database-strcture.
getId()
get object id public
deleteMetaData()
delete meta data entry
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

◆ getDataDirectory()

ilObjFileBasedLM::getDataDirectory (   $mode = "filesystem")

Definition at line 108 of file class.ilObjFileBasedLM.php.

References ilObject\getId(), and ilUtil\getWebspaceDir().

Referenced by cloneObject(), createDataDirectory(), delete(), and populateByDirectoy().

109  {
110  $lm_data_dir = ilUtil::getWebspaceDir($mode)."/lm_data";
111  $lm_dir = $lm_data_dir."/lm_".$this->getId();
112 
113  return $lm_dir;
114  }
getId()
get object id public
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDiskUsage()

ilObjFileBasedLM::getDiskUsage ( )

Gets the disk usage of the object in bytes.

public

Returns
integer the disk usage in bytes

Definition at line 161 of file class.ilObjFileBasedLM.php.

References ilObjFileBasedLMAccess\_lookupDiskUsage().

162  {
163  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
165  }
_lookupDiskUsage($a_id)
Returns the number of bytes used on the harddisk by the learning module with the specified object id...
+ Here is the call graph for this function:

◆ getOnline()

ilObjFileBasedLM::getOnline ( )

Definition at line 136 of file class.ilObjFileBasedLM.php.

137  {
138  return $this->online;
139  }

◆ getStartFile()

ilObjFileBasedLM::getStartFile ( )

Definition at line 121 of file class.ilObjFileBasedLM.php.

Referenced by cloneObject(), and update().

122  {
123  return $this->start_file;
124  }
+ Here is the caller graph for this function:

◆ ilObjFileBasedLM()

ilObjFileBasedLM::ilObjFileBasedLM (   $a_id = 0,
  $a_call_by_reference = true 
)

Constructor public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

Definition at line 30 of file class.ilObjFileBasedLM.php.

References ilObject\ilObject().

31  {
32  // this also calls read() method! (if $a_id is set)
33  $this->type = "htlm";
34  $this->ilObject($a_id,$a_call_by_reference);
35  }
ilObject($a_id=0, $a_reference=true)
Constructor public.
+ Here is the call graph for this function:

◆ initBibItemObject()

ilObjFileBasedLM::initBibItemObject ( )

init bib object (contains all bib item data)

Definition at line 79 of file class.ilObjFileBasedLM.php.

80  {
81  include_once("./Modules/LearningModule/classes/class.ilBibItem.php");
82 
83  $this->bib_obj =& new ilBibItem($this);
84  $this->bib_obj->read();
85 
86  return true;
87  }
Class ilBibItem.

◆ initDefaultRoles()

ilObjFileBasedLM::initDefaultRoles ( )

init default roles settings

If your module does not require any default roles, delete this method (For an example how this method is used, look at ilObjForum)

public

Returns
array object IDs of created local roles.

Definition at line 224 of file class.ilObjFileBasedLM.php.

225  {
226  global $rbacadmin;
227 
228  // create a local role folder
229  //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId());
230 
231  // create moderator role and assign role to rolefolder...
232  //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId());
233  //$roles[] = $roleObj->getId();
234 
235  //unset($rfoldObj);
236  //unset($roleObj);
237 
238  return $roles ? $roles : array();
239  }

◆ notify()

ilObjFileBasedLM::notify (   $a_event,
  $a_ref_id,
  $a_parent_non_rbac_id,
  $a_node_id,
  $a_params = 0 
)

notifys an object about an event occured Based on the event happend, each object may decide how it reacts.

If you are not required to handle any events related to your module, just delete this method. (For an example how this method is used, look at ilObjGroup)

public

Parameters
stringevent
integerreference id of object where the event occured
arraypasses optional parameters if required
Returns
boolean

Definition at line 254 of file class.ilObjFileBasedLM.php.

References $_GET, $tree, and ilObject\getType().

255  {
256  global $tree;
257 
258  switch ($a_event)
259  {
260  case "link":
261 
262  //var_dump("<pre>",$a_params,"</pre>");
263  //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
264  //exit;
265  break;
266 
267  case "cut":
268 
269  //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
270  //exit;
271  break;
272 
273  case "copy":
274 
275  //var_dump("<pre>",$a_params,"</pre>");
276  //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
277  //exit;
278  break;
279 
280  case "paste":
281 
282  //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
283  //exit;
284  break;
285 
286  case "new":
287 
288  //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
289  //exit;
290  break;
291  }
292 
293  // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
294  if ($a_node_id==$_GET["ref_id"])
295  {
296  $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
297  $parent_type = $parent_obj->getType();
298  if($parent_type == $this->getType())
299  {
300  $a_node_id = (int) $tree->getParentId($a_node_id);
301  }
302  }
303 
304  parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
305  }
$_GET["client_id"]
redirection script todo: (a better solution should control the processing via a xml file) ...
getType()
get object type public
+ Here is the call graph for this function:

◆ populateByDirectoy()

ilObjFileBasedLM::populateByDirectoy (   $a_dir,
  $a_filename = "" 
)

Populate by directory.

Add a filename to do a special check for ILIAS HTML export files. If the corresponding directory is found within the passed directory path (i.e. "htlm_<id>") this subdirectory is used instead.

Parameters

Definition at line 316 of file class.ilObjFileBasedLM.php.

References getDataDirectory(), ilUtil\rCopy(), and ilUtil\renameExecutables().

317  {
318  preg_match("/.*htlm_([0-9]*)\.zip/", $a_filename, $match);
319  if (is_dir($a_dir."/htlm_".$match[1]))
320  {
321  $a_dir = $a_dir."/htlm_".$match[1];
322  }
323  ilUtil::rCopy($a_dir, $this->getDataDirectory());
325  }
getDataDirectory($mode="filesystem")
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
+ Here is the call graph for this function:

◆ read()

ilObjFileBasedLM::read ( )

read object

Definition at line 62 of file class.ilObjFileBasedLM.php.

References $lm_set, ilObject\getId(), setOnline(), setStartFile(), and ilUtil\yn2tf().

63  {
64  global $ilDB;
65 
66  parent::read();
67 
68  $q = "SELECT * FROM file_based_lm WHERE id = ".$ilDB->quote($this->getId(), "integer");
69  $lm_set = $ilDB->query($q);
70  $lm_rec = $ilDB->fetchAssoc($lm_set);
71  $this->setOnline(ilUtil::yn2tf($lm_rec["is_online"]));
72  $this->setStartFile((string) $lm_rec["startfile"]);
73 
74  }
getId()
get object id public
$lm_set
static yn2tf($a_yn)
convert "y"/"n" to true/false
+ Here is the call graph for this function:

◆ setOnline()

ilObjFileBasedLM::setOnline (   $a_online)

Definition at line 131 of file class.ilObjFileBasedLM.php.

Referenced by read().

132  {
133  $this->online = $a_online;
134  }
+ Here is the caller graph for this function:

◆ setStartFile()

ilObjFileBasedLM::setStartFile (   $a_file)

Definition at line 126 of file class.ilObjFileBasedLM.php.

Referenced by read().

127  {
128  $this->start_file = $a_file;
129  }
+ Here is the caller graph for this function:

◆ update()

ilObjFileBasedLM::update ( )

update object data

public

Returns
boolean

Definition at line 44 of file class.ilObjFileBasedLM.php.

References ilObject\getId(), getStartFile(), ilUtil\tf2yn(), and ilObject\updateMetaData().

45  {
46  global $ilDB;
47 
48  $this->updateMetaData();
49  parent::update();
50 
51  $ilDB->manipulate("UPDATE file_based_lm SET ".
52  " is_online = ".$ilDB->quote(ilUtil::tf2yn($this->getOnline()), "text").",".
53  " startfile = ".$ilDB->quote($this->getStartFile(), "text")." ".
54  " WHERE id = ".$ilDB->quote($this->getId(), "integer"));
55 
56  return true;
57  }
static tf2yn($a_tf)
convert true/false to "y"/"n"
updateMetaData()
update meta data entry
getId()
get object id public
+ Here is the call graph for this function:

Field Documentation

◆ $tree

ilObjFileBasedLM::$tree

Definition at line 22 of file class.ilObjFileBasedLM.php.

Referenced by notify().


The documentation for this class was generated from the following file: