ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups 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.
 update ()
 update object data
 read ()
 read object
 initBibItemObject ()
 init bib object (contains all bib item data)
 create ()
 create file based lm
 getDataDirectory ($mode="filesystem")
 createDataDirectory ()
 getStartFile ()
 setStartFile ($a_file)
 setOnline ($a_online)
 getOnline ()
 _lookupOnline ($a_id)
 check wether content object is online
 getDiskUsage ()
 Gets the disk usage of the object in bytes.
 delete ()
 delete object and all related data
 initDefaultRoles ()
 init default roles settings
 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.
 populateByDirectoy ($a_dir, $a_filename="")
 Populate by directory.
 cloneObject ($a_target_id, $a_copy_id=0)
 Clone HTML learning module.
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public.
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not)
 read ($a_force_db=false)
 read object data from db into object
 getId ()
 get object id public
 setId ($a_id)
 set object id public
 setRefId ($a_id)
 set reference id public
 getRefId ()
 get reference id public
 getType ()
 get object type public
 setType ($a_type)
 set object type public
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions
 getTitle ()
 get object title public
 getUntranslatedTitle ()
 get untranslated object title public
 setTitle ($a_title)
 set object title
 getDescription ()
 get object description
 setDescription ($a_desc)
 set object description
 getLongDescription ()
 get object long description (stored in object_description)
 getImportId ()
 get import id
 setImportId ($a_import_id)
 set import id
 getOwner ()
 get object owner
 getOwnerName ()
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id
 setOwner ($a_owner)
 set object owner
 getCreateDate ()
 get create date public
 getLastUpdateDate ()
 get last update date public
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class)
 MDUpdateListener ($a_element)
 Meta data update listener.
 createMetaData ()
 create meta data entry
 updateMetaData ()
 update meta data entry
 deleteMetaData ()
 delete meta data entry
 updateOwner ()
 update owner of object in db
 _getIdForImportId ($a_import_id)
 get current object id for import id (static)
 _lookupOwner ($a_id)
 lookup object owner
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects.
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static)
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static)
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static)
 _isInTrash ($a_ref_id)
 checks wether object is in trash
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!?
 setPermissions ($a_parent_ref)
 set permissions of object
 createReference ()
 creates reference for object
 countReferences ()
 count references of object
 createRoleFolder ()
 creates a local role folder
 applyDidacticTemplate ($a_tpl_id)
 Apply template.
 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 ...
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container.
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies.
 cloneMetaData ($target_obj)
 Copy meta data.
 _lookupCreationDate ($a_id)
 Lookup creation date.

Data Fields

 $tree
- Data Fields inherited from ilObject
const TITLE_LENGTH = 128
 max length of object title
 $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

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
static _lookupTitle ($a_id)
 lookup object title
static _getIdsForTitle ($title, $type= '', $partialmatch=false)
static _lookupDescription ($a_id)
 lookup object description
static _lookupObjId ($a_id)
static _lookupType ($a_id, $a_reference=false)
 lookup object type
static _lookupObjectId ($a_ref_id)
 lookup object id
 _exists ($a_id, $a_reference=false)
 checks if an object exists in object_data
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type.
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection.
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item.
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies.
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies.
static getLongDescriptions (array $a_obj_ids)
 Get long description data.
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns.

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

ilObjFileBasedLM::_lookupOnline (   $a_id)

check wether content object is online

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

References ilUtil\yn2tf().

{
global $ilDB;
$q = "SELECT * FROM file_based_lm WHERE id = ".$ilDB->quote($a_id, "integer");
$lm_set = $ilDB->query($q);
$lm_rec = $ilDB->fetchAssoc($lm_set);
return ilUtil::yn2tf($lm_rec["is_online"]);
}

+ Here is the call graph for this function:

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().

{
global $ilDB, $ilUser, $ilias;
$new_obj = parent::cloneObject($a_target_id,$a_copy_id);
$this->cloneMetaData($new_obj);
$new_obj->setTitle($this->getTitle());
$new_obj->setDescription($this->getDescription());
// copy content
$new_obj->populateByDirectoy($this->getDataDirectory());
$new_obj->setStartFile($this->getStartFile());
$new_obj->update();
return $new_obj;
}

+ Here is the call graph for this function:

ilObjFileBasedLM::create ( )

create file based lm

Reimplemented from ilObject.

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

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

{
global $ilDB;
$ilDB->manipulate("INSERT INTO file_based_lm (id, is_online, startfile) VALUES ".
" (".$ilDB->quote($this->getID(), "integer").",".
$ilDB->quote("n", "text").",".
$ilDB->quote($this->getStartfile(), "text").")");
$this->createMetaData();
}

+ Here is the call graph for this function:

ilObjFileBasedLM::createDataDirectory ( )

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

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

Referenced by create().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented from ilObject.

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

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

{
global $ilDB;
// always call parent delete function first!!
if (!parent::delete())
{
return false;
}
// delete meta data of content object
/*
$nested = new ilNestedSetXML();
$nested->init($this->getId(), $this->getType());
$nested->deleteAllDBData();
*/
// Delete meta data
$this->deleteMetaData();
// delete bibliographical items of object
include_once("./Services/Xml/classes/class.ilNestedSetXML.php");
$nested = new ilNestedSetXML();
$nested->init($this->getId(), "bib");
$nested->deleteAllDBData();
// delete file_based_lm record
$ilDB->manipulate("DELETE FROM file_based_lm WHERE id = ".
$ilDB->quote($this->getID(), "integer"));
// delete data directory
return true;
}

+ Here is the call graph for this function:

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().

{
$lm_data_dir = ilUtil::getWebspaceDir($mode)."/lm_data";
$lm_dir = $lm_data_dir."/lm_".$this->getId();
return $lm_dir;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjFileBasedLM::getDiskUsage ( )

Gets the disk usage of the object in bytes.

public

Returns
integer the disk usage in bytes

Reimplemented from ilObject.

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

References ilObjFileBasedLMAccess\_lookupDiskUsage().

{
require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
}

+ Here is the call graph for this function:

ilObjFileBasedLM::getOnline ( )

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

{
return $this->online;
}
ilObjFileBasedLM::getStartFile ( )

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

Referenced by cloneObject(), and update().

{
return $this->start_file;
}

+ Here is the caller graph for this function:

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().

{
// this also calls read() method! (if $a_id is set)
$this->type = "htlm";
$this->ilObject($a_id,$a_call_by_reference);
}

+ Here is the call graph for this function:

ilObjFileBasedLM::initBibItemObject ( )

init bib object (contains all bib item data)

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

{
include_once("./Modules/LearningModule/classes/class.ilBibItem.php");
$this->bib_obj =& new ilBibItem($this);
$this->bib_obj->read();
return true;
}
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.

Reimplemented from ilObject.

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

{
global $rbacadmin;
// create a local role folder
//$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId());
// create moderator role and assign role to rolefolder...
//$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId());
//$roles[] = $roleObj->getId();
//unset($rfoldObj);
//unset($roleObj);
return $roles ? $roles : array();
}
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

Reimplemented from ilObject.

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

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

{
global $tree;
switch ($a_event)
{
case "link":
//var_dump("<pre>",$a_params,"</pre>");
//echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
//exit;
break;
case "cut":
//echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
//exit;
break;
case "copy":
//var_dump("<pre>",$a_params,"</pre>");
//echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
//exit;
break;
case "paste":
//echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
//exit;
break;
case "new":
//echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
//exit;
break;
}
// At the beginning of the recursive process it avoids second call of the notify function with the same parameter
if ($a_node_id==$_GET["ref_id"])
{
$parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
$parent_type = $parent_obj->getType();
if($parent_type == $this->getType())
{
$a_node_id = (int) $tree->getParentId($a_node_id);
}
}
parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
}

+ Here is the call graph for this function:

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
@return

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

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

{
preg_match("/.*htlm_([0-9]*)\.zip/", $a_filename, $match);
if (is_dir($a_dir."/htlm_".$match[1]))
{
$a_dir = $a_dir."/htlm_".$match[1];
}
ilUtil::rCopy($a_dir, $this->getDataDirectory());
}

+ Here is the call graph for this function:

ilObjFileBasedLM::read ( )

read object

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

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

{
global $ilDB;
$q = "SELECT * FROM file_based_lm WHERE id = ".$ilDB->quote($this->getId(), "integer");
$lm_set = $ilDB->query($q);
$lm_rec = $ilDB->fetchAssoc($lm_set);
$this->setOnline(ilUtil::yn2tf($lm_rec["is_online"]));
$this->setStartFile((string) $lm_rec["startfile"]);
}

+ Here is the call graph for this function:

ilObjFileBasedLM::setOnline (   $a_online)

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

Referenced by read().

{
$this->online = $a_online;
}

+ Here is the caller graph for this function:

ilObjFileBasedLM::setStartFile (   $a_file)

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

Referenced by read().

{
$this->start_file = $a_file;
}

+ Here is the caller graph for this function:

ilObjFileBasedLM::update ( )

update object data

public

Returns
boolean

Reimplemented from ilObject.

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

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

{
global $ilDB;
$this->updateMetaData();
$ilDB->manipulate("UPDATE file_based_lm SET ".
" is_online = ".$ilDB->quote(ilUtil::tf2yn($this->getOnline()), "text").",".
" startfile = ".$ilDB->quote($this->getStartFile(), "text")." ".
" WHERE id = ".$ilDB->quote($this->getId(), "integer"));
return true;
}

+ Here is the call graph for this function:

Field Documentation

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: