ILIAS  Release_5_0_x_branch Revision 61816
 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, $a_omit_file_check=false)
 setOnline ($a_online)
 getOnline ()
 setShowLicense ($a_value)
 getShowLicense ()
 setShowBibliographicalData ($a_value)
 getShowBibliographicalData ()
 _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
 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
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates.
 createReference ()
 creates reference for object
 countReferences ()
 count references of object
 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
 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 = 255
 max length of object title
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

Protected Attributes

 $online
 $show_license
 $show_bib

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 setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB.
static _lookupType ($a_id, $a_reference=false)
 lookup object type
static _lookupObjectId ($a_ref_id)
 lookup object id
static _exists ($a_id, $a_reference=false, $a_type=null)
 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.
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course.

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:
class.ilObjFileBasedLM.php 61264 2015-11-02 10:10:11Z gitmgr

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 177 of file class.ilObjFileBasedLM.php.

References $ilDB, $lm_set, and 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 341 of file class.ilObjFileBasedLM.php.

References $ilDB, ilObject\$ilias, $ilUser, ilCopyWizardOptions\_getInstance(), ilObject\cloneMetaData(), getDataDirectory(), ilObject\getDescription(), getOnline(), getShowBibliographicalData(), getShowLicense(), getStartFile(), and ilObject\getTitle().

{
global $ilDB, $ilUser, $ilias;
$new_obj = parent::cloneObject($a_target_id,$a_copy_id);
$this->cloneMetaData($new_obj);
//copy online status if object is not the root copy object
$cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
if(!$cp_options->isRootNode($this->getRefId()))
{
$new_obj->setOnline($this->getOnline());
}
$new_obj->setTitle($this->getTitle());
$new_obj->setDescription($this->getDescription());
$new_obj->setShowLicense($this->getShowLicense());
$new_obj->setShowBibliographicalData($this->getShowBibliographicalData());
// 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 102 of file class.ilObjFileBasedLM.php.

References $ilDB, 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 125 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 212 of file class.ilObjFileBasedLM.php.

References $ilDB, 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 117 of file class.ilObjFileBasedLM.php.

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

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

{
$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 194 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 149 of file class.ilObjFileBasedLM.php.

References $online.

Referenced by cloneObject().

{
return $this->online;
}

+ Here is the caller graph for this function:

ilObjFileBasedLM::getShowBibliographicalData ( )

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

References $show_bib.

Referenced by cloneObject(), and update().

{
}

+ Here is the caller graph for this function:

ilObjFileBasedLM::getShowLicense ( )

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

References $show_license.

Referenced by cloneObject(), and update().

{
}

+ Here is the caller graph for this function:

ilObjFileBasedLM::getStartFile ( )

Definition at line 130 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 34 of file class.ilObjFileBasedLM.php.

References ilObject\ilObject(), setShowBibliographicalData(), and setShowLicense().

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

+ Here is the call graph for this function:

ilObjFileBasedLM::initBibItemObject ( )

init bib object (contains all bib item data)

Definition at line 88 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::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 262 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 324 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 70 of file class.ilObjFileBasedLM.php.

References $ilDB, $lm_set, ilObject\getId(), setOnline(), setShowBibliographicalData(), setShowLicense(), 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"]);
$this->setShowLicense($lm_rec["show_lic"]);
$this->setShowBibliographicalData($lm_rec["show_bib"]);
}

+ Here is the call graph for this function:

ilObjFileBasedLM::setOnline (   $a_online)

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

Referenced by read().

{
$this->online = $a_online;
}

+ Here is the caller graph for this function:

ilObjFileBasedLM::setShowBibliographicalData (   $a_value)

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

Referenced by ilObjFileBasedLM(), and read().

{
$this->show_bib = (bool)$a_value;
}

+ Here is the caller graph for this function:

ilObjFileBasedLM::setShowLicense (   $a_value)

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

Referenced by ilObjFileBasedLM(), and read().

{
$this->show_license = (bool)$a_value;
}

+ Here is the caller graph for this function:

ilObjFileBasedLM::setStartFile (   $a_file,
  $a_omit_file_check = false 
)

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

References getDataDirectory().

Referenced by read().

{
if($a_file &&
(file_exists($this->getDataDirectory()."/".$a_file) || $a_omit_file_check))
{
$this->start_file = $a_file;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjFileBasedLM::update ( )

update object data

public

Returns
boolean

Reimplemented from ilObject.

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

References $ilDB, ilObject\getId(), getShowBibliographicalData(), getShowLicense(), getStartFile(), ilUtil\tf2yn(), and ilObject\updateMetaData().

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

+ Here is the call graph for this function:

Field Documentation

ilObjFileBasedLM::$online
protected

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

Referenced by getOnline().

ilObjFileBasedLM::$show_bib
protected

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

Referenced by getShowBibliographicalData().

ilObjFileBasedLM::$show_license
protected

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

Referenced by getShowLicense().

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: