Public Member Functions | Data Fields

ilObjFileBasedLM Class Reference

Inheritance diagram for ilObjFileBasedLM:
Collaboration diagram for ilObjFileBasedLM:

Public Member Functions

 ilObjFileBasedLM ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 getTitle ()
 get title of content object
 setTitle ($a_title)
 set title of content object
 getDescription ()
 get description of content object
 setDescription ($a_description)
 set description of content object
 assignMetaData (&$a_meta_data)
 assign a meta data object to content object
getMetaData ()
 get meta data object of content object
 updateMetaData ()
 update meta data only
 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
 ilClone ($a_parent_ref)
 copy all entries of your object.
 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.

Data Fields

 $tree

Detailed Description

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


Member Function Documentation

ilObjFileBasedLM::_lookupOnline ( a_id  ) 

check wether content object is online

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

References $q, and ilUtil::yn2tf().

Referenced by ilObjUser::getDesktopItems().

        {
                $q = "SELECT * FROM file_based_lm WHERE id = '".$a_id."'";
                $lm_set = $this->ilias->db->query($q);
                $lm_rec = $lm_set->fetchRow(DB_FETCHMODE_ASSOC);

                return ilUtil::yn2tf($lm_rec["online"]);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjFileBasedLM::assignMetaData ( &$  a_meta_data  ) 

assign a meta data object to content object

Parameters:
object $a_meta_data meta data object

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

Referenced by ilObjFileBasedLM().

        {
                $this->meta_data =& $a_meta_data;
        }

Here is the caller graph for this function:

ilObjFileBasedLM::create (  ) 

create file based lm

Reimplemented from ilObject.

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

References $q, createDataDirectory(), getDescription(), ilObject::getId(), getTitle(), and ilObject::getType().

        {
                global $ilDB;

                parent::create();
                $this->createDataDirectory();
                $this->meta_data->setId($this->getId());
                $this->meta_data->setType($this->getType());
                $this->meta_data->setTitle($this->getTitle());
                $this->meta_data->setDescription($this->getDescription());
                $this->meta_data->setObject($this);
                $this->meta_data->create();

                $q = "INSERT INTO file_based_lm (id, online, startfile) VALUES ".
                        " (".$ilDB->quote($this->getID()).",".$ilDB->quote("n").",".
                        $ilDB->quote("").")";
                $ilDB->query($q);
        }

Here is the call graph for this function:

ilObjFileBasedLM::createDataDirectory (  ) 

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

References $q, ilUtil::delDir(), getDataDirectory(), ilObject::getId(), and ilObject::getType().

        {
                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 bibliographical items of object
                $nested = new ilNestedSetXML();
                $nested->init($this->getId(), "bib");
                $nested->deleteAllDBData();

                // delete file_based_lm record
                $q = "DELETE FROM file_based_lm WHERE id = ".
                        $ilDB->quote($this->getID());
                $ilDB->query($q);

                // delete data directory
                ilUtil::delDir($this->getDataDirectory());

                return true;
        }

Here is the call graph for this function:

ilObjFileBasedLM::getDataDirectory ( mode = "filesystem"  ) 

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

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

Referenced by createDataDirectory(), and delete().

        {
                $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::getDescription (  ) 

get description of content object

Returns:
string description

Reimplemented from ilObject.

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

Referenced by create().

        {
                return $this->meta_data->getDescription();
        }

Here is the caller graph for this function:

& ilObjFileBasedLM::getMetaData (  ) 

get meta data object of content object

Returns:
object meta data object

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

        {
                return $this->meta_data;
        }

ilObjFileBasedLM::getOnline (  ) 

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

Referenced by update().

        {
                return $this->online;
        }

Here is the caller graph for this function:

ilObjFileBasedLM::getStartFile (  ) 

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

Referenced by update().

        {
                return $this->start_file;
        }

Here is the caller graph for this function:

ilObjFileBasedLM::getTitle (  ) 

get title of content object

Returns:
string title

Reimplemented from ilObject.

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

Referenced by create().

        {
                return parent::getTitle();
                //return $this->meta_data->getTitle();
        }

Here is the caller graph for this function:

ilObjFileBasedLM::ilClone ( a_parent_ref  ) 

copy all entries of your object.

public

Parameters:
integer ref_id of parent object
Returns:
integer new ref id

Reimplemented from ilObject.

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

References $rbacadmin.

        {
                global $rbacadmin;

                // always call parent ilClone function first!!
                $new_ref_id = parent::ilClone($a_parent_ref);

                // get object instance of ilCloned object
                //$newObj =& $this->ilias->obj_factory->getInstanceByRefId($new_ref_id);

                // create a local role folder & default roles
                //$roles = $newObj->initDefaultRoles();

                // ...finally assign role to creator of object
                //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "n");

                // always destroy objects in ilClone method because ilClone() is recursive and creates instances for each object in subtree!
                //unset($newObj);

                // ... and finally always return new reference ID!!
                return $new_ref_id;
        }

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

Constructor public.

Parameters:
integer reference_id or object_id
boolean treat the id as reference_id (true) or object_id (false)

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

References assignMetaData(), and ilObject::ilObject().

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

                if ($a_id == 0)
                {
                        $new_meta =& new ilMetaData();
                        $this->assignMetaData($new_meta);
                }

        }

Here is the call graph for this function:

ilObjFileBasedLM::initBibItemObject (  ) 

init bib object (contains all bib item data)

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

        {
                include_once("content/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 344 of file class.ilObjFileBasedLM.php.

References $rbacadmin, and $roles.

        {
                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:
string event
integer reference id of object where the event occured
array passes optional parameters if required
Returns:
boolean

Reimplemented from ilObject.

Definition at line 374 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::read (  ) 

read object

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

References $q, ilObject::getId(), ilObject::getType(), setOnline(), setStartFile(), and ilUtil::yn2tf().

        {
                parent::read();
                $this->meta_data =& new ilMetaData($this->getType(), $this->getId());

                $q = "SELECT * FROM file_based_lm WHERE id = '".$this->getId()."'";
                $lm_set = $this->ilias->db->query($q);
                $lm_rec = $lm_set->fetchRow(DB_FETCHMODE_ASSOC);
                $this->setOnline(ilUtil::yn2tf($lm_rec["online"]));
                $this->setStartFile($lm_rec["startfile"]);

        }

Here is the call graph for this function:

ilObjFileBasedLM::setDescription ( a_description  ) 

set description of content object

Parameters:
string $a_description description

Reimplemented from ilObject.

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

Referenced by updateMetaData().

        {
                $this->meta_data->setDescription($a_description);
        }

Here is the caller graph for this function:

ilObjFileBasedLM::setOnline ( a_online  ) 

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

Referenced by read().

        {
                $this->start_file = $a_file;
        }

Here is the caller graph for this function:

ilObjFileBasedLM::setTitle ( a_title  ) 

set title of content object

Parameters:
string $a_title title

Reimplemented from ilObject.

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

Referenced by updateMetaData().

        {
                parent::setTitle($a_title);
                $this->meta_data->setTitle($a_title);
        }

Here is the caller graph for this function:

ilObjFileBasedLM::update (  ) 

update object data

public

Returns:
boolean

Reimplemented from ilObject.

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

References $q, getOnline(), getStartFile(), and updateMetaData().

Referenced by updateMetaData().

        {
                $this->updateMetaData();

                $q = "UPDATE file_based_lm SET ".
                        " online = '".ilUtil::tf2yn($this->getOnline())."',".
                        " startfile = '".ilUtil::prepareDBString($this->getStartFile())."'".
                        " WHERE id = '".$this->getId()."'";
                $this->ilias->db->query($q);

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjFileBasedLM::updateMetaData (  ) 

update meta data only

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

References setDescription(), setTitle(), and update().

Referenced by update().

        {
                $this->meta_data->update();
                if ($this->meta_data->section != "General")
                {
                        $meta = $this->meta_data->getElement("Title", "General");
                        $this->meta_data->setTitle($meta[0]["value"]);
                        $meta = $this->meta_data->getElement("Description", "General");
                        $this->meta_data->setDescription($meta[0]["value"]);
                }
                else
                {
                        $this->setTitle($this->meta_data->getTitle());
                        $this->setDescription($this->meta_data->getDescription());
                }
                parent::update();

        }

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

ilObjFileBasedLM::$tree

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

Referenced by notify().


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