Public Member Functions | Static Public Member Functions | Data Fields

ilObjContentObject Class Reference
[Modules/IliasLearningModule]

Class ilObjContentObject. More...

Inheritance diagram for ilObjContentObject:
Collaboration diagram for ilObjContentObject:

Public Member Functions

 ilObjContentObject ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 create ($a_upload=false)
 create content object
 initDefaultRoles ()
 init default roles settings OBSOLETE.
 read ()
 read data of content object
 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
 getImportId ()
 get import id
 setImportId ($a_id)
 set import id
getTree ()
 update ()
 update complete object (meta data and properties)
 import ()
 if implemented, this function should be called from an Out/GUI-Object
 putInTree ($a_parent)
 put content object in main tree
 createLMTree ()
 create content object tree (that stores structure object hierarchie)
getLMTree ()
 get content object tree
 createImportDirectory ()
 creates data directory for import files (data_dir/lm_data/lm_<id>/import, depending on data directory that is set in ILIAS setup/ini)
 getDataDirectory ()
 get data directory
 getImportDirectory ()
 get import directory of lm
 createExportDirectory ($a_type="xml")
 creates data directory for export files (data_dir/lm_data/lm_<id>/export, depending on data directory that is set in ILIAS setup/ini)
 getExportDirectory ($a_type="xml")
 get export directory of lm
 ilClone ($a_parent_ref)
 copy all properties and subobjects of a learning module.
 delete ()
 delete learning module and all related data
 getLayout ()
 get default page layout of content object (see directory layouts/)
 setLayout ($a_layout)
 set default page layout
 getStyleSheetId ()
 get ID of assigned style sheet object
 setStyleSheetId ($a_style_id)
 set ID of assigned style sheet object
 writeStyleSheetId ($a_style_id)
 write ID of assigned style sheet object to db
 _moveLMStyles ($a_from_style, $a_to_style)
 move learning modules from one style to another
 _lookupStyleSheetId ($a_cont_obj_id)
 lookup style sheet ID
 _lookupContObjIdByStyleId ($a_style_id)
 lookup style sheet ID
 _getNrOfAssignedLMs ($a_style_id)
 gets the number of learning modules assigned to a content style
 _getNrLMsIndividualStyles ()
 get number of learning modules with individual styles
 _getNrLMsNoStyle ()
 get number of learning modules assigned no style
 _deleteStyleAssignments ($a_style_id)
 delete all style references to style
 getPageHeader ()
 get page header mode (IL_CHAPTER_TITLE | IL_PAGE_TITLE | IL_NO_HEADER)
 setPageHeader ($a_pg_header=IL_CHAPTER_TITLE)
 set page header mode
 getTOCMode ()
 get toc mode ("chapters" | "pages")
 getPublicAccessMode ()
 get public access mode ("complete" | "selected")
 setTOCMode ($a_toc_mode="chapters")
 set toc mode
 setOnline ($a_online)
 getOnline ()
 setActiveLMMenu ($a_act_lm_menu)
 isActiveLMMenu ()
 setActiveTOC ($a_toc)
 isActiveTOC ()
 setActiveNumbering ($a_num)
 isActiveNumbering ()
 setActivePrintView ($a_print)
 isActivePrintView ()
 setActiveDownloads ($a_down)
 isActiveDownloads ()
 setActiveDownloadsPublic ($a_down)
 isActiveDownloadsPublic ()
 setPublicNotes ($a_pub_notes)
 publicNotes ()
 setCleanFrames ($a_clean)
 cleanFrames ()
 setHistoryUserComments ($a_comm)
 setPublicAccessMode ($a_mode)
 isActiveHistoryUserComments ()
 setHeaderPage ($a_pg)
 getHeaderPage ()
 setFooterPage ($a_pg)
 getFooterPage ()
 readProperties ()
 read content object properties
 updateProperties ()
 update content object properties
 createProperties ()
 create new properties record
 _lookupOnline ($a_id)
 check wether content object is online
 getAvailableLayouts ()
 get all available lm layouts
 _checkPreconditionsOfPage ($cont_obj_id, $page_id)
 checks wether the preconditions of a page are fulfilled or not
 _getMissingPreconditionsOfPage ($cont_obj_id, $page_id)
 gets all missing preconditions of page
 _getMissingPreconditionsTopChapter ($cont_obj_id, $page_id)
 get top chapter of page for that any precondition is missing
 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.
 checkTree ()
 fixTree ()
 fix tree
 exportXML (&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
 export object to xml (see ilias_co.dtd)
 exportXMLMetaData (&$a_xml_writer)
 export content objects meta data to xml (see ilias_co.dtd)
 exportXMLStructureObjects (&$a_xml_writer, $a_inst, &$expLog)
 export structure objects to xml (see ilias_co.dtd)
 exportXMLPageObjects (&$a_xml_writer, $a_inst, &$expLog)
 export page objects to xml (see ilias_co.dtd)
 exportXMLMediaObjects (&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
 export media objects to xml (see ilias_co.dtd)
 exportFileItems ($a_target_dir, &$expLog)
 export files of file itmes
 exportXMLProperties ($a_xml_writer, &$expLog)
 export properties of content object
 getExportFiles ()
 get export files
 setPublicExportFile ($a_type, $a_file)
 specify public export file for type
 getPublicExportFile ($a_type)
 get public export file
 getOfflineFiles ($dir)
 get offline files
 exportSCORM ($a_target_dir, $log)
 export scorm package
 exportHTML ($a_target_dir, $log, $a_zip_file=true, $a_export_format="html")
 export html package
 exportHTMLFile ($a_target_dir, $a_file_id)
 export file object
 exportHTMLMOB ($a_target_dir, &$a_lm_gui, $a_mob_id, $a_frame="")
 export media object to html
 exportHTMLGlossaryTerms (&$a_lm_gui, $a_target_dir)
 export glossary terms
 exportHTMLPages (&$a_lm_gui, $a_target_dir)
 export all pages of learning module to html file
 exportPageHTML (&$a_lm_gui, $a_target_dir, $a_lm_page_id, $a_frame="")
 export page html
 exportFO (&$a_xml_writer, $a_target_dir)
 export object to fo
 exportFOStructureObjects (&$a_xml_writer)
 export structure objects to fo
 getXMLZip ()

Static Public Member Functions

 _search (&$search_obj, $a_search_in)
 STATIC METHOD search for dbk data.
 hasSuccessorPage ($a_cont_obj_id, $a_page_id)
 STATIC METHOD create a link to the object.

Data Fields

 $lm_tree
 $meta_data
 $layout
 $style_id
 $pg_header
 $online

Detailed Description

Class ilObjContentObject.

Author:
Alex Killing <alex.killing@gmx.de>
Sascha Hofmann <saschahofmann@gmx.de>
Version:
Id:
class.ilObjContentObject.php 13863 2007-05-11 11:14:11Z akill

Definition at line 42 of file class.ilObjContentObject.php.


Member Function Documentation

ilObjContentObject::_checkPreconditionsOfPage ( cont_obj_id,
page_id 
)

checks wether the preconditions of a page are fulfilled or not

Definition at line 923 of file class.ilObjContentObject.php.

References $ilErr, ilObject::$ilias, $lm_tree, and ilConditionHandler::_checkAllConditionsOfTarget().

Referenced by ilTableOfContentsExplorer::buildTitle(), ilLMPresentationGUI::ilPage(), ilLMPresentationGUI::showPrintView(), and ilLMPresentationGUI::showPrintViewSelection().

        {
                global $ilias,$ilUser,$ilErr;

                $lm_tree = new ilTree($cont_obj_id);
                $lm_tree->setTableNames('lm_tree','lm_data');
                $lm_tree->setTreeTablePK("lm_id");

                if ($lm_tree->isInTree($page_id))
                {
                        $path = $lm_tree->getPathFull($page_id, $lm_tree->readRootId());
                        foreach ($path as $node)
                        {
                                if ($node["type"] == "st")
                                {
                                        if (!ilConditionHandler::_checkAllConditionsOfTarget($node["child"], "st"))
                                        {
                                                return false;
                                        }
                                }
                        }
                }
                
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::_deleteStyleAssignments ( a_style_id  ) 

delete all style references to style

Parameters:
int $a_style_id style_id

Definition at line 631 of file class.ilObjContentObject.php.

References $q.

Referenced by ilObjStyleSheet::delete().

        {
                global $ilDB;
                
                $q = "UPDATE content_object SET ".
                        " stylesheet = ".$ilDB->quote("0").
                        " WHERE stylesheet = ".$this->getId($a_style_id);

                $ilDB->query($q);
        }

Here is the caller graph for this function:

ilObjContentObject::_getMissingPreconditionsOfPage ( cont_obj_id,
page_id 
)

gets all missing preconditions of page

Definition at line 952 of file class.ilObjContentObject.php.

References $lm_tree, ilConditionHandler::_checkCondition(), and ilConditionHandler::_getConditionsOfTarget().

Referenced by ilLMPresentationGUI::showPreconditionsOfPage().

        {
                $lm_tree = new ilTree($cont_obj_id);
                $lm_tree->setTableNames('lm_tree','lm_data');
                $lm_tree->setTreeTablePK("lm_id");

                $conds = array();
                if ($lm_tree->isInTree($page_id))
                {
                        // get full path of page
                        $path = $lm_tree->getPathFull($page_id, $lm_tree->readRootId());
                        foreach ($path as $node)
                        {
                                if ($node["type"] == "st")
                                {
                                        // get all preconditions of upper chapters
                                        $tconds = ilConditionHandler::_getConditionsOfTarget($node["child"], "st");
                                        foreach ($tconds as $tcond)
                                        {
                                                // store all missing preconditions
                                                if (!ilConditionHandler::_checkCondition($tcond["id"]))
                                                {
                                                        $conds[] = $tcond;
                                                }
                                        }
                                }
                        }
                }
                
                return $conds;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::_getMissingPreconditionsTopChapter ( cont_obj_id,
page_id 
)

get top chapter of page for that any precondition is missing

Definition at line 987 of file class.ilObjContentObject.php.

References $lm_tree, ilConditionHandler::_checkCondition(), and ilConditionHandler::_getConditionsOfTarget().

Referenced by ilLMPresentationGUI::showPreconditionsOfPage().

        {
                $lm_tree = new ilTree($cont_obj_id);
                $lm_tree->setTableNames('lm_tree','lm_data');
                $lm_tree->setTreeTablePK("lm_id");

                $conds = array();
                if ($lm_tree->isInTree($page_id))
                {
                        // get full path of page
                        $path = $lm_tree->getPathFull($page_id, $lm_tree->readRootId());
                        foreach ($path as $node)
                        {
                                if ($node["type"] == "st")
                                {
                                        // get all preconditions of upper chapters
                                        $tconds = ilConditionHandler::_getConditionsOfTarget($node["child"], "st");
                                        foreach ($tconds as $tcond)
                                        {
                                                // look for missing precondition
                                                if (!ilConditionHandler::_checkCondition($tcond["id"]))
                                                {
                                                        return $node["child"];
                                                }
                                        }
                                }
                        }
                }
                
                return "";
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::_getNrLMsIndividualStyles (  ) 

get number of learning modules with individual styles

Definition at line 597 of file class.ilObjContentObject.php.

References $q.

Referenced by ilObjStyleSettingsGUI::editContentStylesObject().

        {
                global $ilDB;
                
                // joining with style table (not perfectly nice)
                $q = "SELECT count(*) as cnt FROM content_object, style_data ".
                        " WHERE stylesheet = style_data.id ".
                        " AND standard = 0";
                $cset = $ilDB->query($q);
                $crow = $cset->fetchRow(DB_FETCHMODE_ASSOC);

                return (int) $crow["cnt"];
        }

Here is the caller graph for this function:

ilObjContentObject::_getNrLMsNoStyle (  ) 

get number of learning modules assigned no style

Definition at line 614 of file class.ilObjContentObject.php.

References $q.

Referenced by ilObjStyleSettingsGUI::editContentStylesObject().

        {
                global $ilDB;
                
                $q = "SELECT count(*) as cnt FROM content_object ".
                        " WHERE stylesheet = 0";
                $cset = $ilDB->query($q);
                $crow = $cset->fetchRow(DB_FETCHMODE_ASSOC);

                return (int) $crow["cnt"];
        }

Here is the caller graph for this function:

ilObjContentObject::_getNrOfAssignedLMs ( a_style_id  ) 

gets the number of learning modules assigned to a content style

Parameters:
int $a_style_id style id

Definition at line 581 of file class.ilObjContentObject.php.

References $q.

Referenced by ilObjStyleSettingsGUI::editContentStylesObject().

        {
                global $ilDB;
                
                $q = "SELECT count(*) as cnt FROM content_object ".
                        " WHERE stylesheet = ".$ilDB->quote($a_style_id);
                $cset = $ilDB->query($q);
                $crow = $cset->fetchRow(DB_FETCHMODE_ASSOC);

                return (int) $crow["cnt"];
        }

Here is the caller graph for this function:

ilObjContentObject::_lookupContObjIdByStyleId ( a_style_id  ) 

lookup style sheet ID

Definition at line 561 of file class.ilObjContentObject.php.

References $q, and $res.

Referenced by ilObjStyleSheet::_getClonableContentStyles().

        {
                global $ilDB;

                $q = "SELECT id FROM content_object ".
                        " WHERE stylesheet = ".$ilDB->quote($a_style_id);
                $res = $ilDB->query($q);
                $obj_ids = array();
                while($cont = $res->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $obj_ids[] = $cont["id"];
                }
                return $obj_ids;
        }

Here is the caller graph for this function:

ilObjContentObject::_lookupOnline ( a_id  ) 

check wether content object is online

Definition at line 882 of file class.ilObjContentObject.php.

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

        {
//echo "class ilObjContentObject::_lookupOnline($a_id) called. Use Access class instead.";

                $q = "SELECT * FROM content_object 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:

ilObjContentObject::_lookupStyleSheetId ( a_cont_obj_id  ) 

lookup style sheet ID

Definition at line 546 of file class.ilObjContentObject.php.

References $q, and $res.

Referenced by ilPCParagraphGUI::edit(), and ilPCParagraphGUI::insert().

        {
                global $ilDB;

                $q = "SELECT stylesheet FROM content_object ".
                        " WHERE id = '".$a_cont_obj_id."'";
                $res = $ilDB->query($q);
                $sheet = $res->fetchRow(DB_FETCHMODE_ASSOC);

                return $sheet["stylesheet"];
        }

Here is the caller graph for this function:

ilObjContentObject::_moveLMStyles ( a_from_style,
a_to_style 
)

move learning modules from one style to another

Definition at line 510 of file class.ilObjContentObject.php.

References ilObject::$ilias, and $q.

Referenced by ilObjStyleSettingsGUI::moveIndividualStylesObject(), and ilObjStyleSettingsGUI::moveLMStylesObject().

        {
                global $ilDB, $ilias;

                if ($a_from_style < 0)  // change / delete all individual styles
                {
                        $q = "SELECT stylesheet FROM content_object, style_data ".
                                " WHERE content_object.stylesheet = style_data.id ".
                                " AND style_data.standard = 0 ".
                                " AND content_object.stylesheet > 0";
                        $style_set = $ilDB->query($q);
                        while($style_rec = $style_set->fetchRow(DB_FETCHMODE_ASSOC))
                        {
                                // assign learning modules to new style
                                $q = "UPDATE content_object SET ".
                                        " stylesheet = ".$ilDB->quote($a_to_style).
                                        " WHERE stylesheet = ".$ilDB->quote($style_rec["stylesheet"]);
                                $ilDB->query($q);
                                
                                // delete style
                                $style_obj =& $ilias->obj_factory->getInstanceByObjId($style_rec["stylesheet"]);
                                $style_obj->delete();
                        }
                }
                else
                {
                        $q = "UPDATE content_object SET ".
                                " stylesheet = ".$ilDB->quote($a_to_style).
                                " WHERE stylesheet = ".$ilDB->quote($a_from_style);
                        $ilDB->query($q);
                }
        }

Here is the caller graph for this function:

ilObjContentObject::_search ( &$  search_obj,
a_search_in 
) [static]

STATIC METHOD search for dbk data.

This method is called from class.ilSearch

Parameters:
object reference on object of search class public

Reimplemented in ilObjDlBook.

Definition at line 1089 of file class.ilObjContentObject.php.

References $counter, $ilBench, $query, $query1, $query2, $res, $result, and $row.

Referenced by ilSearch::performSearch().

        {
                global $ilBench;

                switch($a_search_in)
                {
                        case 'meta':
                                // FILTER ALL DBK OBJECTS
                                $in             = $search_obj->getInStatement("r.ref_id");
                                $where  = $search_obj->getWhereCondition("fulltext",array("xv.tag_value"));

                                /* very slow on mysql < 4.0.18 (? or everytime ?)
                                $query = "SELECT DISTINCT(r.ref_id) FROM object_reference AS r,object_data AS o, ".
                                        "lm_data AS l,xmlnestedset AS xm,xmlvalue AS xv ".
                                        $where.
                                        $in.
                                        "AND r.obj_id=o.obj_id AND ((o.obj_id=l.lm_id AND xm.ns_book_fk=l.obj_id) OR ".
                                        "(o.obj_id=xm.ns_book_fk AND xm.ns_type IN ('lm','bib'))) ".
                                        "AND xm.ns_tag_fk=xv.tag_fk ".
                                        "AND o.type= 'lm'";*/

                                $query1 = "SELECT DISTINCT(r.ref_id) FROM object_reference AS r,object_data AS o, ".
                                        "xmlnestedset AS xm,xmlvalue AS xv ".
                                        $where.
                                        $in.
                                        "AND r.obj_id=o.obj_id AND ( ".
                                        "(o.obj_id=xm.ns_book_fk AND xm.ns_type IN ('lm','bib'))) ".
                                        "AND xm.ns_tag_fk=xv.tag_fk ".
                                        "AND o.type= 'lm'";

                                // BEGINNING SELECT WITH SEARCH RESULTS IS MUCH FASTER
                                $query1 = "SELECT DISTINCT(r.ref_id) as ref_id FROM xmlvalue AS xv ".
                                        "LEFT JOIN xmlnestedset AS xm ON xm.ns_tag_fk=xv.tag_fk ".
                                        "LEFT JOIN object_data AS o ON o.obj_id = xm.ns_book_fk ".
                                        "LEFT JOIN object_reference AS r ON o.obj_id = r.obj_id ".
                                        $where.
                                        $in.
                                        " AND o.type = 'lm' AND xm.ns_type IN ('lm','bib')";

                                $query2 = "SELECT DISTINCT(r.ref_id) FROM object_reference AS r,object_data AS o, ".
                                        "lm_data AS l,xmlnestedset AS xm,xmlvalue AS xv ".
                                        $where.
                                        $in.
                                        "AND r.obj_id=o.obj_id AND ((o.obj_id=l.lm_id AND xm.ns_book_fk=l.obj_id)".
                                        ") ".
                                        "AND xm.ns_tag_fk=xv.tag_fk ".
                                        "AND o.type= 'lm'";

                                $query2 = "SELECT DISTINCT(r.ref_id) as ref_id FROM xmlvalue AS xv ".
                                        "LEFT JOIN xmlnestedset AS xm ON xm.ns_tag_fk = xv.tag_fk ".
                                        "LEFT JOIN lm_data AS l ON l.obj_id = xm.ns_book_fk ".
                                        "LEFT JOIN object_data AS o ON o.obj_id = l.lm_id ".
                                        "LEFT JOIN object_reference AS r ON r.obj_id = o.obj_id ".
                                        $where.
                                        $in.
                                        "AND o.type = 'lm'";

                                $ilBench->start("Search", "ilObjContentObject_search_meta");
                                $res1 = $search_obj->ilias->db->query($query1);
                                $res2 = $search_obj->ilias->db->query($query2);
                                $ilBench->stop("Search", "ilObjContentObject_search_meta");

                                $counter = 0;
                                $ids = array();
                                while($row = $res1->fetchRow(DB_FETCHMODE_OBJECT))
                                {
                                        $ids[] = $row->ref_id;
                                        $result[$counter]["id"]         =  $row->ref_id;
                                        ++$counter;
                                }
                                while($row = $res2->fetchRow(DB_FETCHMODE_OBJECT))
                                {
                                        if(in_array($row->ref_id,$ids))
                                        {
                                                continue;
                                        }
                                        $result[$counter]["id"]         =  $row->ref_id;
                                        ++$counter;
                                }
                                break;

                        case 'content':
                                $in             = $search_obj->getInStatement("r.ref_id");
                                $where  = $search_obj->getWhereCondition("fulltext",array("pg.content"));

                                // slow on mysql < 4.0.18 (join bug)
                                /*
                                $query = "SELECT DISTINCT(r.ref_id) AS ref_id ,pg.page_id AS page_id FROM page_object AS pg ".
                                        "INNER JOIN object_reference AS r ON pg.parent_id = r.obj_id ".
                                        $where.
                                        $in.
                                        "AND pg.parent_type = 'lm' ";*/

                                $query = "SELECT DISTINCT(r.ref_id) AS ref_id ,pg.page_id AS page_id FROM page_object AS pg ".
                                        ", object_reference AS r ".
                                        $where.
                                        " AND pg.parent_id = r.obj_id ".
                                        $in.
                                        " AND pg.parent_type = 'lm' ";

                                $query = "SELECT DISTINCT(r.ref_id) AS ref_id ,pg.page_id AS page_id FROM page_object AS pg ".
                                        "LEFT JOIN object_data AS o ON o.obj_id = pg.parent_id ".
                                        "LEFT JOIN object_reference AS r ON o.obj_id = r.obj_id ".
                                        $where.
                                        $in.
                                        " AND pg.parent_type = 'lm'";

                                $ilBench->start("Search", "ilObjContentObject_search_content");
                                $res = $search_obj->ilias->db->query($query);
                                $ilBench->stop("Search", "ilObjContentObject_search_content");

                                $counter = 0;
                                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                                {
                                        $result[$counter]["id"]         = $row->ref_id;
                                        $result[$counter]["page_id"] = $row->page_id;
                                        /*
                                        $result[$counter]["link"]       = "content/lm_presentation.php?ref_id=".$row->ref_id;
                                        $result[$counter]["target"]     = "_top";
                                        */
                                        ++$counter;
                                }
                                break;
                }
                return $result ? $result : array();
        }

Here is the caller graph for this function:

ilObjContentObject::checkTree (  ) 

Definition at line 1260 of file class.ilObjContentObject.php.

References $tree, and ilObject::getId().

        {
                $tree = new ilTree($this->getId());
                $tree->setTableNames('lm_tree','lm_data');
                $tree->setTreeTablePK("lm_id");
                $tree->checkTree();
                $tree->checkTreeChilds();
//echo "checked";
        }

Here is the call graph for this function:

ilObjContentObject::cleanFrames (  ) 

Definition at line 771 of file class.ilObjContentObject.php.

Referenced by exportXMLProperties(), and updateProperties().

        {
                return $this->clean_frames;
        }

Here is the caller graph for this function:

ilObjContentObject::create ( a_upload = false  ) 

create content object

Definition at line 69 of file class.ilObjContentObject.php.

References ilObject::create(), ilObject::createMetaData(), and createProperties().

        {
                global $ilUser;

                parent::create();
                
                // meta data will be created by
                // import parser
                if (!$a_upload)
                {
                        $this->createMetaData();
                }

                $this->createProperties();
                if (!$a_upload)
                {
                        if (is_object($ilUser))
                        {
                                //$this->meta_data->setLanguage($ilUser->getLanguage());
                        }
                }
        }

Here is the call graph for this function:

ilObjContentObject::createExportDirectory ( a_type = "xml"  ) 

creates data directory for export files (data_dir/lm_data/lm_<id>/export, depending on data directory that is set in ILIAS setup/ini)

Definition at line 322 of file class.ilObjContentObject.php.

References ilUtil::getDataDir(), ilObject::getId(), and ilUtil::makeDir().

Referenced by ilObjDlBook::export().

        {
                $lm_data_dir = ilUtil::getDataDir()."/lm_data";
                if(!is_writable($lm_data_dir))
                {
                        $this->ilias->raiseError("Content object Data Directory (".$lm_data_dir
                                .") not writeable.",$this->ilias->error_obj->FATAL);
                }
                // create learning module directory (data_dir/lm_data/lm_<id>)
                $lm_dir = $lm_data_dir."/lm_".$this->getId();
                ilUtil::makeDir($lm_dir);
                if(!@is_dir($lm_dir))
                {
                        $this->ilias->raiseError("Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
                }
                // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
                switch ($a_type)
                {
                        // html
                        case "html":
                                $export_dir = $lm_dir."/export_html";
                                break;

                        // scorm
                        case "scorm":
                                $export_dir = $lm_dir."/export_scorm";
                                break;

                        default:                // = xml
                                $export_dir = $lm_dir."/export";
                                break;
                }
                ilUtil::makeDir($export_dir);

                if(!@is_dir($export_dir))
                {
                        $this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::createImportDirectory (  ) 

creates data directory for import files (data_dir/lm_data/lm_<id>/import, depending on data directory that is set in ILIAS setup/ini)

Definition at line 264 of file class.ilObjContentObject.php.

References ilUtil::getDataDir(), ilObject::getId(), and ilUtil::makeDir().

        {
                $lm_data_dir = ilUtil::getDataDir()."/lm_data";
                if(!is_writable($lm_data_dir))
                {
                        $this->ilias->raiseError("Content object Data Directory (".$lm_data_dir
                                .") not writeable.",$this->ilias->error_obj->FATAL);
                }

                // create learning module directory (data_dir/lm_data/lm_<id>)
                $lm_dir = $lm_data_dir."/lm_".$this->getId();
                ilUtil::makeDir($lm_dir);
                if(!@is_dir($lm_dir))
                {
                        $this->ilias->raiseError("Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
                }

                // create import subdirectory (data_dir/lm_data/lm_<id>/import)
                $import_dir = $lm_dir."/import";
                ilUtil::makeDir($import_dir);
                if(!@is_dir($import_dir))
                {
                        $this->ilias->raiseError("Creation of Import Directory failed.",$this->ilias->error_obj->FATAL);
                }
        }

Here is the call graph for this function:

ilObjContentObject::createLMTree (  ) 

create content object tree (that stores structure object hierarchie)

todo: rename LM to ConOb

Definition at line 241 of file class.ilObjContentObject.php.

References ilObject::getId().

        {
                $this->lm_tree =& new ilTree($this->getId());
                $this->lm_tree->setTreeTablePK("lm_id");
                $this->lm_tree->setTableNames('lm_tree','lm_data');
                $this->lm_tree->addTree($this->getId(), 1);
        }

Here is the call graph for this function:

ilObjContentObject::createProperties (  ) 

create new properties record

Definition at line 872 of file class.ilObjContentObject.php.

References $q, and readProperties().

Referenced by create().

        {
                $q = "INSERT INTO content_object (id) VALUES ('".$this->getId()."')";
                $this->ilias->db->query($q);
                $this->readProperties();                // to get db default values
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::delete (  ) 

delete learning module and all related data

this method has been tested on may 9th 2004 meta data, content object data, data directory, bib items learning module tree and pages 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 413 of file class.ilObjContentObject.php.

References $ilBench, $nested, $q, ilLMObject::_deleteAllObjectData(), ilUtil::delDir(), ilObject::deleteMetaData(), getDataDirectory(), and ilObject::getId().

        {
                global $ilDB;

                global $ilBench;

                // always call parent delete function first!!
                if (!parent::delete())
                {
                        return false;
                }

                // delete lm object data
                include_once("content/classes/class.ilLMObject.php");
                ilLMObject::_deleteAllObjectData($this);

                // delete meta data of content object
                $this->deleteMetaData();

                // delete bibitem data
                $nested = new ilNestedSetXML();
                $nested->init($this->getId(), "bib");
                $nested->deleteAllDBData();


                // delete learning module tree
                $this->lm_tree->removeTree($this->lm_tree->getTreeId());

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

                // delete content object record
                $q = "DELETE FROM content_object WHERE id = ".$ilDB->quote($this->getId());
                $this->ilias->db->query($q);

                // delete lm menu entries
                $q = "DELETE FROM lm_menu WHERE lm_id = ".$ilDB->quote($this->getId());
                $this->ilias->db->query($q);

                return true;
        }

Here is the call graph for this function:

ilObjContentObject::exportFileItems ( a_target_dir,
&$  expLog 
)

export files of file itmes

Definition at line 1544 of file class.ilObjContentObject.php.

References $file_obj.

Referenced by exportXML().

        {
                include_once("classes/class.ilObjFile.php");

                foreach ($this->file_ids as $file_id)
                {
                        $expLog->write(date("[y-m-d H:i:s] ")."File Item ".$file_id);
                        $file_obj = new ilObjFile($file_id, false);
                        $file_obj->export($a_target_dir);
                        unset($file_obj);
                }
        }

Here is the caller graph for this function:

ilObjContentObject::exportFO ( &$  a_xml_writer,
a_target_dir 
)

export object to fo

Parameters:
object $a_xml_writer ilXmlWriter object that receives the xml data

Definition at line 2215 of file class.ilObjContentObject.php.

References $ilBench, and exportFOStructureObjects().

        {
                global $ilBench;

                // fo:root (start)
                $attrs = array();
                $attrs["xmlns:fo"] = "http://www.w3.org/1999/XSL/Format";
                $a_xml_writer->xmlStartTag("fo:root", $attrs);

                // fo:layout-master-set (start)
                $attrs = array();
                $a_xml_writer->xmlStartTag("fo:layout-master-set", $attrs);

                // fo:simple-page-master (start)
                $attrs = array();
                $attrs["master-name"] = "DinA4";
                $attrs["page-height"] = "29.7cm";
                $attrs["page-width"] = "21cm";
                $attrs["margin-top"] = "4cm";
                $attrs["margin-bottom"] = "1cm";
                $attrs["margin-left"] = "2.8cm";
                $attrs["margin-right"] = "7.3cm";
                $a_xml_writer->xmlStartTag("fo:simple-page-master", $attrs);

                // fo:region-body (complete)
                $attrs = array();
                $attrs["margin-top"] = "0cm";
                $attrs["margin-bottom"] = "1.25cm";
                $a_xml_writer->xmlElement("fo:region-body", $attrs);

                // fo:region-before (complete)
                $attrs = array();
                $attrs["extent"] = "1cm";
                $a_xml_writer->xmlElement("fo:region-before", $attrs);

                // fo:region-after (complete)
                $attrs = array();
                $attrs["extent"] = "1cm";
                $a_xml_writer->xmlElement("fo:region-after", $attrs);

                // fo:simple-page-master (end)
                $a_xml_writer->xmlEndTag("fo:simple-page-master");

                // fo:layout-master-set (end)
                $a_xml_writer->xmlEndTag("fo:layout-master-set");

                // fo:page-sequence (start)
                $attrs = array();
                $attrs["master-reference"] = "DinA4";
                $a_xml_writer->xmlStartTag("fo:page-sequence", $attrs);

                // fo:flow (start)
                $attrs = array();
                $attrs["flow-name"] = "xsl-region-body";
                $a_xml_writer->xmlStartTag("fo:flow", $attrs);


                // StructureObjects
                //$expLog->write(date("[y-m-d H:i:s] ")."Start Export Structure Objects");
                $ilBench->start("ContentObjectExport", "exportFOStructureObjects");
                $this->exportFOStructureObjects($a_xml_writer, $expLog);
                $ilBench->stop("ContentObjectExport", "exportFOStructureObjects");
                //$expLog->write(date("[y-m-d H:i:s] ")."Finished Export Structure Objects");*/

                // fo:flow (end)
                $a_xml_writer->xmlEndTag("fo:flow");

                // fo:page-sequence (end)
                $a_xml_writer->xmlEndTag("fo:page-sequence");

                // fo:root (end)
                $a_xml_writer->xmlEndTag("fo:root");
        }

Here is the call graph for this function:

ilObjContentObject::exportFOStructureObjects ( &$  a_xml_writer  ) 

export structure objects to fo

Parameters:
object $a_xml_writer ilXmlWriter object that receives the xml data

Definition at line 2295 of file class.ilObjContentObject.php.

Referenced by exportFO().

        {
                $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
                foreach ($childs as $child)
                {
                        if($child["type"] != "st")
                        {
                                continue;
                        }

                        $structure_obj = new ilStructureObject($this, $child["obj_id"]);
                        $structure_obj->exportFO($a_xml_writer, $expLog);
                        unset($structure_obj);
                }
        }

Here is the caller graph for this function:

ilObjContentObject::exportHTML ( a_target_dir,
log,
a_zip_file = true,
a_export_format = "html" 
)

export html package

Definition at line 1794 of file class.ilObjContentObject.php.

References $_GET, $file, $GLOBALS, $ilBench, ilObject::$ilias, $tpl, ilObject::_exists(), ilUtil::delDir(), exportHTMLFile(), exportHTMLGlossaryTerms(), exportHTMLMOB(), exportHTMLPages(), getExportDirectory(), ilObject::getId(), ilUtil::getImagePath(), getStyleSheetId(), ilUtil::getStyleSheetLocation(), ilObject::getType(), isActiveTOC(), ilUtil::makeDir(), and ilUtil::zip().

Referenced by exportSCORM().

        {
                global $ilias, $tpl, $ilBench, $ilLocator;

                // initialize temporary target directory
                ilUtil::delDir($a_target_dir);
                ilUtil::makeDir($a_target_dir);
                $mob_dir = $a_target_dir."/mobs";
                ilUtil::makeDir($mob_dir);
                $file_dir = $a_target_dir."/files";
                ilUtil::makeDir($file_dir);
                $teximg_dir = $a_target_dir."/teximg";
                ilUtil::makeDir($teximg_dir);
                $GLOBALS["teximgcnt"] = 0;

                // export system style sheet
                $location_stylesheet = ilUtil::getStyleSheetLocation("filesystem");
                $style_name = $ilias->account->prefs["style"].".css";
                copy($location_stylesheet, $a_target_dir."/".$style_name);
                $location_stylesheet = ilUtil::getStyleSheetLocation();
                
                // export content style sheet
                $ilBench->start("ExportHTML", "exportContentStyle");
                if ($this->getStyleSheetId() < 1)
                {
                        $cont_stylesheet = "content/content.css";
                        copy($cont_stylesheet, $a_target_dir."/content.css");
                }
                else
                {
                        $style = new ilObjStyleSheet($this->getStyleSheetId());
                        $style->writeCSSFile($a_target_dir."/content.css");
                }
                $ilBench->stop("ExportHTML", "exportContentStyle");
                
                // export syntax highlighting style
                $syn_stylesheet = "content/syntaxhighlight.css";
                copy($syn_stylesheet, $a_target_dir."/syntaxhighlight.css");

                // get learning module presentation gui class
                include_once("content/classes/class.ilLMPresentationGUI.php");
                $_GET["cmd"] = "nop";
                $lm_gui =& new ilLMPresentationGUI();
                $lm_gui->setOfflineMode(true);
                $lm_gui->setOfflineDirectory($a_target_dir);
                $lm_gui->setExportFormat($a_export_format);

                // export pages
                $ilBench->start("ExportHTML", "exportHTMLPages");
                $this->exportHTMLPages($lm_gui, $a_target_dir);
                $ilBench->stop("ExportHTML", "exportHTMLPages");

                // export glossary terms
                $ilBench->start("ExportHTML", "exportHTMLGlossaryTerms");
                $this->exportHTMLGlossaryTerms($lm_gui, $a_target_dir);
                $ilBench->stop("ExportHTML", "exportHTMLGlossaryTerms");

                // export all media objects
                $ilBench->start("ExportHTML", "exportHTMLMediaObjects");
                foreach ($this->offline_mobs as $mob)
                {
                        if (ilObject::_exists($mob))
                        {
                                $this->exportHTMLMOB($a_target_dir, $lm_gui, $mob, "_blank");
                        }
                }
                $_GET["obj_type"]  = "MediaObject";
                $_GET["obj_id"]  = $a_mob_id;
                $_GET["cmd"] = "";
                $ilBench->stop("ExportHTML", "exportHTMLMediaObjects");

                // export all file objects
                $ilBench->start("ExportHTML", "exportHTMLFileObjects");
                foreach ($this->offline_files as $file)
                {
                        $this->exportHTMLFile($a_target_dir, $file);
                }
                $ilBench->stop("ExportHTML", "exportHTMLFileObjects");

                // export table of contents
                $ilBench->start("ExportHTML", "exportHTMLTOC");
                $ilLocator->clearItems();
                if ($this->isActiveTOC())
                {
                        $tpl = new ilTemplate("tpl.main.html", true, true);
                        //$tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
                        $content =& $lm_gui->showTableOfContents();
                        $file = $a_target_dir."/table_of_contents.html";
                                
                        // open file
                        if (!($fp = @fopen($file,"w+")))
                        {
                                die ("<b>Error</b>: Could not open \"".$file."\" for writing".
                                        " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
                        }
                        chmod($file, 0770);
                        fwrite($fp, $content);
                        fclose($fp);
                }
                $ilBench->stop("ExportHTML", "exportHTMLTOC");

                // export images
                $ilBench->start("ExportHTML", "exportHTMLImages");
                $image_dir = $a_target_dir."/images";
                ilUtil::makeDir($image_dir);
                ilUtil::makeDir($image_dir."/browser");
                copy(ilUtil::getImagePath("enlarge.gif", false, "filesystem"),
                        $image_dir."/enlarge.gif");
                copy(ilUtil::getImagePath("browser/blank.gif", false, "filesystem"),
                        $image_dir."/browser/plus.gif");
                copy(ilUtil::getImagePath("browser/blank.gif", false, "filesystem"),
                        $image_dir."/browser/minus.gif");
                copy(ilUtil::getImagePath("browser/blank.gif", false, "filesystem"),
                        $image_dir."/browser/blank.gif");
                copy(ilUtil::getImagePath("icon_st.gif", false, "filesystem"),
                        $image_dir."/icon_st.gif");
                copy(ilUtil::getImagePath("icon_pg.gif", false, "filesystem"),
                        $image_dir."/icon_pg.gif");
                copy(ilUtil::getImagePath("icon_lm.gif", false, "filesystem"),
                        $image_dir."/icon_lm.gif");
                copy(ilUtil::getImagePath("nav_arr_L.gif", false, "filesystem"),
                        $image_dir."/nav_arr_L.gif");
                copy(ilUtil::getImagePath("nav_arr_R.gif", false, "filesystem"),
                        $image_dir."/nav_arr_R.gif");
                        
                copy(ilUtil::getImagePath("download.gif", false, "filesystem"),
                        $image_dir."/download.gif");
                $ilBench->stop("ExportHTML", "exportHTMLImages");
                        
                // template workaround: reset of template 
                $tpl = new ilTemplate("tpl.main.html", true, true);
                $tpl->setVariable("LOCATION_STYLESHEET",$location_stylesheet);
                $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");

                // zip everything
                $ilBench->start("ExportHTML", "zip");
                if (true)
                {
                        if ($a_zip_file)
                        {
                                // zip it all
                                $date = time();
                                $zip_file = $this->getExportDirectory("html")."/".$date."__".IL_INST_ID."__".
                                        $this->getType()."_".$this->getId().".zip";
                                ilUtil::zip($a_target_dir, $zip_file);
                                ilUtil::delDir($a_target_dir);
                        }
                }
                $ilBench->stop("ExportHTML", "zip");

        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::exportHTMLFile ( a_target_dir,
a_file_id 
)

export file object

Definition at line 1949 of file class.ilObjContentObject.php.

References $file_obj, and ilUtil::makeDir().

Referenced by exportHTML().

        {
                $file_dir = $a_target_dir."/files/file_".$a_file_id;
                ilUtil::makeDir($file_dir);
                include_once("classes/class.ilObjFile.php");
                $file_obj = new ilObjFile($a_file_id, false);
                $source_file = $file_obj->getDirectory($file_obj->getVersion())."/".$file_obj->getFileName();
                if (!is_file($source_file))
                {
                        $source_file = $file_obj->getDirectory()."/".$file_obj->getFileName();
                }
                copy($source_file, $file_dir."/".$file_obj->getFileName());
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::exportHTMLGlossaryTerms ( &$  a_lm_gui,
a_target_dir 
)

export glossary terms

Definition at line 2027 of file class.ilObjContentObject.php.

References $_GET, $file, $tpl, ilObjFile::_getFilesOfObject(), ilObjMediaObject::_getMobsOfObject(), and ilGlossaryDefinition::getDefinitionList().

Referenced by exportHTML().

        {
                global $ilLocator;
                
                foreach($this->offline_int_links as $int_link)
                {
                        $ilLocator->clearItems();
                        if ($int_link["type"] == "git")
                        {
                                $tpl = new ilTemplate("tpl.main.html", true, true);
                                $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");

                                $_GET["obj_id"] = $int_link["id"];
                                $_GET["frame"] = "_blank";
                                $content =& $a_lm_gui->glossary();
                                $file = $a_target_dir."/term_".$int_link["id"].".html";
                                        
                                // open file
                                if (!($fp = @fopen($file,"w+")))
                                {
                                        die ("<b>Error</b>: Could not open \"".$file."\" for writing".
                                                        " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
                                }
                                chmod($file, 0770);
                                fwrite($fp, $content);
                                fclose($fp);

                                // store linked/embedded media objects of glosssary term
                                include_once("content/classes/class.ilGlossaryDefinition.php");
                                $defs = ilGlossaryDefinition::getDefinitionList($int_link["id"]);
                                foreach($defs as $def)
                                {
                                        $def_mobs = ilObjMediaObject::_getMobsOfObject("gdf:pg", $def["id"]);
                                        foreach($def_mobs as $def_mob)
                                        {
                                                $this->offline_mobs[$def_mob] = $def_mob;
                                        }
                                        
                                        // get all files of page
                                        $def_files = ilObjFile::_getFilesOfObject("gdf:pg", $page["obj_id"]);
                                        $this->offline_files = array_merge($this->offline_files, $def_files);

                                }
                                
                        }
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::exportHTMLMOB ( a_target_dir,
&$  a_lm_gui,
a_mob_id,
a_frame = "" 
)

export media object to html

Definition at line 1966 of file class.ilObjContentObject.php.

References $_GET, $file, $tpl, ilUtil::getWebspaceDir(), ilUtil::makeDir(), and ilUtil::rCopy().

Referenced by exportHTML().

        {
                global $tpl;

                $mob_dir = $a_target_dir."/mobs";

                $source_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob_id;
                if (@is_dir($source_dir))
                {
                        ilUtil::makeDir($mob_dir."/mm_".$a_mob_id);
                        ilUtil::rCopy($source_dir, $mob_dir."/mm_".$a_mob_id);
                }
                
                $tpl = new ilTemplate("tpl.main.html", true, true);
                $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
                $_GET["obj_type"]  = "MediaObject";
                $_GET["mob_id"]  = $a_mob_id;
                $_GET["frame"] = $a_frame;
                $_GET["cmd"] = "";
                $content =& $a_lm_gui->media();
                $file = $a_target_dir."/media_".$a_mob_id.".html";

                // open file
                if (!($fp = @fopen($file,"w+")))
                {
                        die ("<b>Error</b>: Could not open \"".$file."\" for writing".
                                " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
                }
                chmod($file, 0770);
                fwrite($fp, $content);
                fclose($fp);
                
                // fullscreen
                include_once("content/classes/Media/class.ilObjMediaObject.php");
                $mob_obj = new ilObjMediaObject($a_mob_id);
                if ($mob_obj->hasFullscreenItem())
                {
                        $tpl = new ilTemplate("tpl.main.html", true, true);
                        $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
                        $_GET["obj_type"]  = "";
                        $_GET["frame"]  = "";
                        $_GET["mob_id"]  = $a_mob_id;
                        $_GET["cmd"] = "fullscreen";
                        $content =& $a_lm_gui->fullscreen();
                        $file = $a_target_dir."/fullscreen_".$a_mob_id.".html";
        
                        // open file
                        if (!($fp = @fopen($file,"w+")))
                        {
                                die ("<b>Error</b>: Could not open \"".$file."\" for writing".
                                        " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
                        }
                        chmod($file, 0770);
                        fwrite($fp, $content);
                        fclose($fp);
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::exportHTMLPages ( &$  a_lm_gui,
a_target_dir 
)

export all pages of learning module to html file

Definition at line 2078 of file class.ilObjContentObject.php.

References $ilBench, $lm_tree, $mobs, $tpl, ilObjFile::_getFilesOfObject(), ilObjMediaObject::_getMobsOfObject(), ilInternalLink::_getTargetsOfSource(), exportPageHTML(), ilObject::getId(), getLMTree(), ilLMPageObject::getPageList(), and ilObject::getType().

Referenced by exportHTML().

        {
                global $tpl, $ilBench, $ilLocator;
                                
                $pages = ilLMPageObject::getPageList($this->getId());
                
                $lm_tree =& $this->getLMTree();
                $first_page = $lm_tree->fetchSuccessorNode($lm_tree->getRootId(), "pg");
                $this->first_page_id = $first_page["child"];

                // iterate all learning module pages
                $mobs = array();
                $int_links = array();
                $this->offline_files = array();
                
                foreach ($pages as $page)
                {
                        $ilLocator->clearItems();
                        $ilBench->start("ExportHTML", "exportHTMLPage");
                        $ilBench->start("ExportHTML", "exportPageHTML");
                        $this->exportPageHTML($a_lm_gui, $a_target_dir, $page["obj_id"]);
                        $ilBench->stop("ExportHTML", "exportPageHTML");
                        
                        // get all media objects of page
                        include_once("content/classes/Media/class.ilObjMediaObject.php");
                        $pg_mobs = ilObjMediaObject::_getMobsOfObject($this->getType().":pg", $page["obj_id"]);
                        foreach($pg_mobs as $pg_mob)
                        {
                                $mobs[$pg_mob] = $pg_mob;
                        }
                        
                        // get all internal links of page
                        $pg_links = ilInternalLink::_getTargetsOfSource($this->getType().":pg", $page["obj_id"]);
                        $int_links = array_merge($int_links, $pg_links);
                        
                        // get all files of page
                        include_once("classes/class.ilObjFile.php");
                        $pg_files = ilObjFile::_getFilesOfObject($this->getType().":pg", $page["obj_id"]);
                        $this->offline_files = array_merge($this->offline_files, $pg_files);
                        
                        $ilBench->stop("ExportHTML", "exportHTMLPage");
                }
                $this->offline_mobs = $mobs;
                $this->offline_int_links = $int_links;
                
                
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::exportPageHTML ( &$  a_lm_gui,
a_target_dir,
a_lm_page_id,
a_frame = "" 
)

export page html

Definition at line 2129 of file class.ilObjContentObject.php.

References $_GET, $file, $ilBench, ilObject::$ilias, $tpl, and ilLMObject::_lookupNID().

Referenced by exportHTMLPages().

        {
                global $ilias, $tpl, $ilBench;
                
//echo "<br>B: export Page HTML ($a_lm_page_id)"; flush();
                // template workaround: reset of template 
                $tpl = new ilTemplate("tpl.main.html", true, true);
                $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");

                $_GET["obj_id"] = $a_lm_page_id;
                $_GET["frame"] = $a_frame;

                if ($a_frame == "")
                {
                        if ($nid = ilLMObject::_lookupNID($a_lm_gui->lm->getId(), $a_lm_page_id, "pg"))
                        {
                                $file = $a_target_dir."/lm_pg_".$nid.".html";
                        }
                        else
                        {
                                $file = $a_target_dir."/lm_pg_".$a_lm_page_id.".html";
                        }
                }
                else
                {
                        if ($a_frame != "toc")
                        {
                                $file = $a_target_dir."/frame_".$a_lm_page_id."_".$a_frame.".html";
                        }
                        else
                        {
                                $file = $a_target_dir."/frame_".$a_frame.".html";
                        }
                }
                
                // return if file is already existing
                if (@is_file($file))
                {
                        return;
                }

                $ilBench->start("ExportHTML", "layout");
                $ilBench->start("ExportHTML", "layout_".$a_frame);
                $content =& $a_lm_gui->layout("main.xml", false);
                $ilBench->stop("ExportHTML", "layout_".$a_frame);
                $ilBench->stop("ExportHTML", "layout");

                // open file
                if (!($fp = @fopen($file,"w+")))
                {
                        die ("<b>Error</b>: Could not open \"".$file."\" for writing".
                                        " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
                }
        
                // set file permissions
                chmod($file, 0770);
                        
                // write xml data into the file
                fwrite($fp, $content);
                
                // close file
                fclose($fp);

                if ($this->first_page_id == $a_lm_page_id && $a_frame == "")
                {
                        copy($file, $a_target_dir."/index.html");
                }

                // write frames of frameset
                $ilBench->start("ExportHTML", "getCurrentFrameSet");
                $frameset = $a_lm_gui->getCurrentFrameSet();
                $ilBench->stop("ExportHTML", "getCurrentFrameSet");
                
                foreach ($frameset as $frame)
                {                               
                        $this->exportPageHTML($a_lm_gui, $a_target_dir, $a_lm_page_id, $frame);
                }

        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::exportSCORM ( a_target_dir,
log 
)

export scorm package

Definition at line 1748 of file class.ilObjContentObject.php.

References $log, ilUtil::delDir(), exportHTML(), getExportDirectory(), ilObject::getId(), ilObject::getType(), ilUtil::makeDir(), and ilUtil::zip().

        {
                ilUtil::delDir($a_target_dir);
                ilUtil::makeDir($a_target_dir);
                //ilUtil::makeDir($a_target_dir."/res");
                
                // export everything to html
                $this->exportHTML($a_target_dir."/res", $log, false, "scorm");
                
                // build manifest file
                include("content/classes/class.ilContObjectManifestBuilder.php");
                $man_builder = new ilContObjectManifestBuilder($this);
                $man_builder->buildManifest();
                $man_builder->dump($a_target_dir);
                
                // copy scorm 1.2 schema definitions
                copy("content/scorm_xsd/adlcp_rootv1p2.xsd", $a_target_dir."/adlcp_rootv1p2.xsd");
                copy("content/scorm_xsd/imscp_rootv1p1p2.xsd", $a_target_dir."/imscp_rootv1p1p2.xsd");
                copy("content/scorm_xsd/imsmd_rootv1p2p1.xsd", $a_target_dir."/imsmd_rootv1p2p1.xsd");
                copy("content/scorm_xsd/ims_xml.xsd", $a_target_dir."/ims_xml.xsd");

                // zip it all
                $date = time();
                $zip_file = $a_target_dir."/".$date."__".IL_INST_ID."__".
                        $this->getType()."_".$this->getId().".zip";
        //echo "zip-".$a_target_dir."-to-".$zip_file;
                ilUtil::zip(array($a_target_dir."/res",
                        $a_target_dir."/imsmanifest.xml",
                        $a_target_dir."/adlcp_rootv1p2.xsd",
                        $a_target_dir."/imscp_rootv1p1p2.xsd",
                        $a_target_dir."/ims_xml.xsd",
                        $a_target_dir."/imsmd_rootv1p2p1.xsd")
                        , $zip_file);

                $dest_file = $this->getExportDirectory("scorm")."/".$date."__".IL_INST_ID."__".
                        $this->getType()."_".$this->getId().".zip";
                
                rename($zip_file, $dest_file);
                ilUtil::delDir($a_target_dir);

        }

Here is the call graph for this function:

ilObjContentObject::exportXML ( &$  a_xml_writer,
a_inst,
a_target_dir,
&$  expLog 
)

export object to xml (see ilias_co.dtd)

Parameters:
object $a_xml_writer ilXmlWriter object that receives the xml data

Definition at line 1319 of file class.ilObjContentObject.php.

References $ilBench, exportFileItems(), exportXMLMediaObjects(), exportXMLMetaData(), exportXMLPageObjects(), exportXMLProperties(), exportXMLStructureObjects(), and ilObject::getType().

        {
                global $ilBench;

                $attrs = array();
                switch($this->getType())
                {
                        case "lm":
                                $attrs["Type"] = "LearningModule";
                                break;

                        case "dbk":
                                $attrs["Type"] = "LibObject";
                                break;
                }
                $a_xml_writer->xmlStartTag("ContentObject", $attrs);

                // MetaData
                $this->exportXMLMetaData($a_xml_writer);

                // StructureObjects
//echo "ContObj:".$a_inst.":<br>";
                $expLog->write(date("[y-m-d H:i:s] ")."Start Export Structure Objects");
                $ilBench->start("ContentObjectExport", "exportStructureObjects");
                $this->exportXMLStructureObjects($a_xml_writer, $a_inst, $expLog);
                $ilBench->stop("ContentObjectExport", "exportStructureObjects");
                $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Structure Objects");

                // PageObjects
                $expLog->write(date("[y-m-d H:i:s] ")."Start Export Page Objects");
                $ilBench->start("ContentObjectExport", "exportPageObjects");
                $this->exportXMLPageObjects($a_xml_writer, $a_inst, $expLog);
                $ilBench->stop("ContentObjectExport", "exportPageObjects");
                $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Page Objects");

                // MediaObjects
                $expLog->write(date("[y-m-d H:i:s] ")."Start Export Media Objects");
                $ilBench->start("ContentObjectExport", "exportMediaObjects");
                $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
                $ilBench->stop("ContentObjectExport", "exportMediaObjects");
                $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Media Objects");

                // FileItems
                $expLog->write(date("[y-m-d H:i:s] ")."Start Export File Items");
                $ilBench->start("ContentObjectExport", "exportFileItems");
                $this->exportFileItems($a_target_dir, $expLog);
                $ilBench->stop("ContentObjectExport", "exportFileItems");
                $expLog->write(date("[y-m-d H:i:s] ")."Finished Export File Items");
                
                // To do: implement version selection/detection
                // Properties
                $expLog->write(date("[y-m-d H:i:s] ")."Start Export Properties");
                $this->exportXMLProperties($a_xml_writer, $expLog);
                $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Properties");

                // Glossary
                // not implemented

                // Bibliography
                // not implemented

                // Layout
                // not implemented

                $a_xml_writer->xmlEndTag("ContentObject");
        }

Here is the call graph for this function:

ilObjContentObject::exportXMLMediaObjects ( &$  a_xml_writer,
a_inst,
a_target_dir,
&$  expLog 
)

export media objects to xml (see ilias_co.dtd)

Parameters:
object $a_xml_writer ilXmlWriter object that receives the xml data

Definition at line 1482 of file class.ilObjContentObject.php.

References ilObject::_exists(), ilInternalLink::_extractObjIdOfTarget(), and ilMapArea::_getIntLinks().

Referenced by exportXML().

        {
                include_once("content/classes/Media/class.ilObjMediaObject.php");

                $linked_mobs = array();
                
                // mobs directly embedded into pages
                foreach ($this->mob_ids as $mob_id)
                {
                        if ($mob_id > 0)
                        {
                                $expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
                                $media_obj = new ilObjMediaObject($mob_id);
                                $media_obj->exportXML($a_xml_writer, $a_inst);
                                $media_obj->exportFiles($a_target_dir);
                                
                                // get linked media objects (map areas)
                                $med_items = $media_obj->getMediaItems();
                                foreach($med_items as $med_item)
                                {
                                        $int_links = ilMapArea::_getIntLinks($med_item->getId());
                                        foreach ($int_links as $k => $int_link)
                                        {
                                                if ($int_link["Type"] == "MediaObject")
                                                {
                                                        include_once("./content/classes/Pages/class.ilInternalLink.php");
                                                        $l_id = ilInternalLink::_extractObjIdOfTarget($int_link["Target"]);
                                                        if (ilObject::_exists($l_id))
                                                        {
                                                                if (!in_array($l_id, $linked_mobs) && 
                                                                        !in_array($l_id, $this->mob_ids))
                                                                {
                                                                        $linked_mobs[] = $l_id;
                                                                }
                                                        }
                                                }
                                        }
                                }
                                
                                unset($media_obj);
                        }
                }
                
                // linked mobs (in map areas)
                foreach ($linked_mobs as $mob_id)
                {
                        if ($mob_id > 0)
                        {
                                $expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
                                $media_obj = new ilObjMediaObject($mob_id);
                                $media_obj->exportXML($a_xml_writer, $a_inst);
                                $media_obj->exportFiles($a_target_dir);
                                unset($media_obj);
                        }
                }

        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::exportXMLMetaData ( &$  a_xml_writer  ) 

export content objects meta data to xml (see ilias_co.dtd)

Parameters:
object $a_xml_writer ilXmlWriter object that receives the xml data

Definition at line 1392 of file class.ilObjContentObject.php.

References ilObject::getId(), and ilObject::getType().

Referenced by exportXML().

        {
                include_once("Services/MetaData/classes/class.ilMD2XML.php");
                $md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
                $md2xml->setExportMode(true);
                $md2xml->startExport();
                $a_xml_writer->appendXML($md2xml->getXML());
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::exportXMLPageObjects ( &$  a_xml_writer,
a_inst,
&$  expLog 
)

export page objects to xml (see ilias_co.dtd)

Parameters:
object $a_xml_writer ilXmlWriter object that receives the xml data

Definition at line 1432 of file class.ilObjContentObject.php.

References $file_ids, $ilBench, ilObject::getId(), and ilLMPageObject::getPageList().

Referenced by exportXML().

        {
                global $ilBench;

                include_once "./content/classes/class.ilLMPageObject.php";

                $pages = ilLMPageObject::getPageList($this->getId());
                foreach ($pages as $page)
                {
                        $ilBench->start("ContentObjectExport", "exportPageObject");
                        $expLog->write(date("[y-m-d H:i:s] ")."Page Object ".$page["obj_id"]);

                        // export xml to writer object
                        $ilBench->start("ContentObjectExport", "exportPageObject_getLMPageObject");
                        $page_obj = new ilLMPageObject($this, $page["obj_id"]);
                        $ilBench->stop("ContentObjectExport", "exportPageObject_getLMPageObject");
                        $ilBench->start("ContentObjectExport", "exportPageObject_XML");
                        $page_obj->exportXML($a_xml_writer, "normal", $a_inst);
                        $ilBench->stop("ContentObjectExport", "exportPageObject_XML");

                        // collect media objects
                        $ilBench->start("ContentObjectExport", "exportPageObject_CollectMedia");
                        $mob_ids = $page_obj->getMediaObjectIDs();
                        foreach($mob_ids as $mob_id)
                        {
                                $this->mob_ids[$mob_id] = $mob_id;
                        }
                        $ilBench->stop("ContentObjectExport", "exportPageObject_CollectMedia");

                        // collect all file items
                        $ilBench->start("ContentObjectExport", "exportPageObject_CollectFileItems");
                        $file_ids = $page_obj->getFileItemIds();
                        foreach($file_ids as $file_id)
                        {
                                $this->file_ids[$file_id] = $file_id;
                        }
                        $ilBench->stop("ContentObjectExport", "exportPageObject_CollectFileItems");

                        unset($page_obj);

                        $ilBench->stop("ContentObjectExport", "exportPageObject");
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::exportXMLProperties ( a_xml_writer,
&$  expLog 
)

export properties of content object

Definition at line 1561 of file class.ilObjContentObject.php.

References cleanFrames(), getFooterPage(), getHeaderPage(), getLayout(), getPageHeader(), getTOCMode(), isActiveHistoryUserComments(), isActiveLMMenu(), isActiveNumbering(), isActivePrintView(), isActiveTOC(), publicNotes(), and ilUtil::tf2yn().

Referenced by exportXML().

        {
                $attrs = array();
                $a_xml_writer->xmlStartTag("Properties", $attrs);

                // Layout
                $attrs = array("Name" => "Layout", "Value" => $this->getLayout());
                $a_xml_writer->xmlElement("Property", $attrs);
                
                // Page Header
                $attrs = array("Name" => "PageHeader", "Value" => $this->getPageHeader());
                $a_xml_writer->xmlElement("Property", $attrs);
                
                // TOC Mode
                $attrs = array("Name" => "TOCMode", "Value" => $this->getTOCMode());
                $a_xml_writer->xmlElement("Property", $attrs);
                
                // LM Menu Activation
                $attrs = array("Name" => "ActiveLMMenu", "Value" =>
                        ilUtil::tf2yn($this->isActiveLMMenu()));
                $a_xml_writer->xmlElement("Property", $attrs);

                // Numbering Activation
                $attrs = array("Name" => "ActiveNumbering", "Value" =>
                        ilUtil::tf2yn($this->isActiveNumbering()));
                $a_xml_writer->xmlElement("Property", $attrs);

                // Table of contents button activation
                $attrs = array("Name" => "ActiveTOC", "Value" =>
                        ilUtil::tf2yn($this->isActiveTOC()));
                $a_xml_writer->xmlElement("Property", $attrs);
                
                // Print view button activation
                $attrs = array("Name" => "ActivePrintView", "Value" =>
                        ilUtil::tf2yn($this->isActivePrintView()));
                $a_xml_writer->xmlElement("Property", $attrs);
                
                // Note that download button is not saved, because
                // download files do not exist after import

                // Clean frames
                $attrs = array("Name" => "CleanFrames", "Value" =>
                        ilUtil::tf2yn($this->cleanFrames()));
                $a_xml_writer->xmlElement("Property", $attrs);
                
                // Public notes activation
                $attrs = array("Name" => "PublicNotes", "Value" =>
                        ilUtil::tf2yn($this->publicNotes()));
                $a_xml_writer->xmlElement("Property", $attrs);
                
                // History comments for authors activation
                $attrs = array("Name" => "HistoryUserComments", "Value" =>
                        ilUtil::tf2yn($this->isActiveHistoryUserComments()));
                $a_xml_writer->xmlElement("Property", $attrs);

                // Header Page
                if ($this->getHeaderPage() > 0)
                {
                        $attrs = array("Name" => "HeaderPage", "Value" =>
                                "il_".IL_INST_ID."_pg_".$this->getHeaderPage());
                        $a_xml_writer->xmlElement("Property", $attrs);
                }

                // Footer Page
                if ($this->getFooterPage() > 0)
                {
                        $attrs = array("Name" => "FooterPage", "Value" =>
                                "il_".IL_INST_ID."_pg_".$this->getFooterPage());
                        $a_xml_writer->xmlElement("Property", $attrs);
                }

                $a_xml_writer->xmlEndTag("Properties");
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::exportXMLStructureObjects ( &$  a_xml_writer,
a_inst,
&$  expLog 
)

export structure objects to xml (see ilias_co.dtd)

Parameters:
object $a_xml_writer ilXmlWriter object that receives the xml data

Definition at line 1407 of file class.ilObjContentObject.php.

Referenced by exportXML().

        {
                include_once './content/classes/class.ilStructureObject.php';

                $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
                foreach ($childs as $child)
                {
                        if($child["type"] != "st")
                        {
                                continue;
                        }

                        $structure_obj = new ilStructureObject($this, $child["obj_id"]);
                        $structure_obj->exportXML($a_xml_writer, $a_inst, $expLog);
                        unset($structure_obj);
                }
        }

Here is the caller graph for this function:

ilObjContentObject::fixTree (  ) 

fix tree

Definition at line 1273 of file class.ilObjContentObject.php.

References $q, $tree, and getLMTree().

        {
                global $ilDB;

                $tree =& $this->getLMTree();

                // delete subtrees that have no lm_data records
                $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
                foreach ($nodes as $node)
                {
                        $q = "SELECT * FROM lm_data WHERE obj_id = ".$ilDB->quote($node["child"]);
                        $obj_set = $ilDB->query($q);
                        $obj_rec = $obj_set->fetchRow(DB_FETCHMODE_ASSOC);
                        if (!$obj_rec)
                        {
                                $node_data = $tree->getNodeData($node["child"]);
                                $tree->deleteTree($node_data);
                        }
                }

                // delete subtrees that have pages as parent
                $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
                foreach ($nodes as $node)
                {
                        $q = "SELECT * FROM lm_data WHERE obj_id = ".$ilDB->quote($node["parent"]);
                        $obj_set = $ilDB->query($q);
                        $obj_rec = $obj_set->fetchRow(DB_FETCHMODE_ASSOC);
                        if ($obj_rec["type"] == "pg")
                        {
                                $node_data = $tree->getNodeData($node["child"]);
                                if ($tree->isInTree($node["child"]))
                                {
                                        $tree->deleteTree($node_data);
                                }
                        }
                }

        }

Here is the call graph for this function:

ilObjContentObject::getAvailableLayouts (  ) 

get all available lm layouts

static

Definition at line 898 of file class.ilObjContentObject.php.

References $dir, and $file.

Referenced by ilObjContentObjectGUI::properties().

        {
                // read sdir, copy files and copy directories recursively
                $dir = opendir("./layouts/lm");

                $layouts = array();

                while($file = readdir($dir))
                {
                        if ($file != "." && $file != ".." && $file != "CVS" && $file != ".svn")
                        {
                                // directories
                                if (@is_dir("./layouts/lm/".$file))
                                {
                                        $layouts[$file] = $file;
                                }
                        }
                }
                asort($layouts);
                return $layouts;
        }

Here is the caller graph for this function:

ilObjContentObject::getDataDirectory (  ) 

get data directory

Definition at line 293 of file class.ilObjContentObject.php.

References ilUtil::getDataDir().

Referenced by delete().

        {
                return ilUtil::getDataDir()."/lm_data".
                        "/lm_".$this->getId();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::getDescription (  ) 

get description of content object

Returns:
string description

Reimplemented from ilObject.

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

        {
                return parent::getDescription();
        }

ilObjContentObject::getExportDirectory ( a_type = "xml"  ) 

get export directory of lm

Definition at line 365 of file class.ilObjContentObject.php.

References ilUtil::getDataDir().

Referenced by ilObjDlBook::export(), exportHTML(), exportSCORM(), and getExportFiles().

        {
                switch  ($a_type)
                {
                        case "html":
                                $export_dir = ilUtil::getDataDir()."/lm_data"."/lm_".$this->getId()."/export_html";
                                break;

                        case "scorm":
                                $export_dir = ilUtil::getDataDir()."/lm_data"."/lm_".$this->getId()."/export_scorm";
                                break;
                                
                        default:                        // = xml
                                $export_dir = ilUtil::getDataDir()."/lm_data"."/lm_".$this->getId()."/export";
                                break;
                }
                return $export_dir;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::getExportFiles (  ) 

get export files

Definition at line 1638 of file class.ilObjContentObject.php.

References $dir, $file, ilObject::$type, and getExportDirectory().

        {
                $file = array();
                
                $types = array("xml", "html", "scorm");
                
                foreach ($types as $type)
                {
                        $dir = $this->getExportDirectory($type);
                        // quit if import dir not available
                        if (!@is_dir($dir) or
                                !is_writeable($dir))
                        {
                                continue;
                        }
        
                        // open directory
                        $cdir = dir($dir);
        
                        // initialize array
        
                        // get files and save the in the array
                        while ($entry = $cdir->read())
                        {
                                if ($entry != "." and
                                        $entry != ".." and
                                        substr($entry, -4) == ".zip" and
                                        ereg("^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.zip\$", $entry))
                                {
                                        $file[$entry.$type] = array("type" => $type, "file" => $entry,
                                                "size" => filesize($dir."/".$entry));
                                }
                        }
        
                        // close import directory
                        $cdir->close();
                }

                // sort files
                ksort ($file);
                reset ($file);
                return $file;
        }

Here is the call graph for this function:

ilObjContentObject::getFooterPage (  ) 

Definition at line 806 of file class.ilObjContentObject.php.

Referenced by exportXMLProperties().

        {
                return $this->footer_page;
        }

Here is the caller graph for this function:

ilObjContentObject::getHeaderPage (  ) 

Definition at line 796 of file class.ilObjContentObject.php.

Referenced by exportXMLProperties().

        {
                return $this->header_page;
        }

Here is the caller graph for this function:

ilObjContentObject::getImportDirectory (  ) 

get import directory of lm

Definition at line 302 of file class.ilObjContentObject.php.

References ilUtil::getDataDir().

        {
                $import_dir = ilUtil::getDataDir()."/lm_data".
                        "/lm_".$this->getId()."/import";
                if(@is_dir($import_dir))
                {
                        return $import_dir;
                }
                else
                {
                        return false;
                }
        }

Here is the call graph for this function:

ilObjContentObject::getImportId (  ) 

get import id

public

Returns:
string import id

Reimplemented from ilObject.

Definition at line 184 of file class.ilObjContentObject.php.

        {
                return $this->import_id;
        }

ilObjContentObject::getLayout (  ) 

get default page layout of content object (see directory layouts/)

Returns:
string default layout

Definition at line 461 of file class.ilObjContentObject.php.

Referenced by exportXMLProperties().

        {
                return $this->layout;
        }

Here is the caller graph for this function:

& ilObjContentObject::getLMTree (  ) 

get content object tree

Definition at line 253 of file class.ilObjContentObject.php.

Referenced by exportHTMLPages(), and fixTree().

        {
                return $this->lm_tree;
        }

Here is the caller graph for this function:

ilObjContentObject::getOfflineFiles ( dir  ) 

get offline files

Definition at line 1708 of file class.ilObjContentObject.php.

References $dir, and $file.

        {
                // quit if offline dir not available
                if (!@is_dir($dir) or
                        !is_writeable($dir))
                {
                        return array();
                }

                // open directory
                $dir = dir($dir);

                // initialize array
                $file = array();

                // get files and save the in the array
                while ($entry = $dir->read())
                {
                        if ($entry != "." and
                                $entry != ".." and
                                substr($entry, -4) == ".pdf" and
                                ereg("^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.pdf\$", $entry))
                        {
                                $file[] = $entry;
                        }
                }

                // close import directory
                $dir->close();

                // sort files
                sort ($file);
                reset ($file);

                return $file;
        }

ilObjContentObject::getOnline (  ) 

Definition at line 691 of file class.ilObjContentObject.php.

Referenced by updateProperties().

        {
                return $this->online;
        }

Here is the caller graph for this function:

ilObjContentObject::getPageHeader (  ) 

get page header mode (IL_CHAPTER_TITLE | IL_PAGE_TITLE | IL_NO_HEADER)

Definition at line 645 of file class.ilObjContentObject.php.

Referenced by exportXMLProperties().

        {
                return $this->pg_header;
        }

Here is the caller graph for this function:

ilObjContentObject::getPublicAccessMode (  ) 

get public access mode ("complete" | "selected")

Definition at line 671 of file class.ilObjContentObject.php.

        {
                return $this->public_access_mode;
        }

ilObjContentObject::getPublicExportFile ( a_type  ) 

get public export file

Parameters:
string $a_type type ("xml" / "html")
Returns:
string $a_file file name

Definition at line 1700 of file class.ilObjContentObject.php.

        {
                return $this->public_export_file[$a_type];
        }

ilObjContentObject::getStyleSheetId (  ) 

get ID of assigned style sheet object

Definition at line 479 of file class.ilObjContentObject.php.

Referenced by exportHTML().

        {
                return $this->style_id;
        }

Here is the caller graph for this function:

ilObjContentObject::getTitle (  ) 

get title of content object

Returns:
string title

Reimplemented from ilObject.

Definition at line 150 of file class.ilObjContentObject.php.

        {
                return parent::getTitle();
        }

ilObjContentObject::getTOCMode (  ) 

get toc mode ("chapters" | "pages")

Definition at line 663 of file class.ilObjContentObject.php.

Referenced by exportXMLProperties().

        {
                return $this->toc_mode;
        }

Here is the caller graph for this function:

& ilObjContentObject::getTree (  ) 

Definition at line 194 of file class.ilObjContentObject.php.

        {
                return $this->lm_tree;
        }

ilObjContentObject::getXMLZip (  ) 

Reimplemented from ilObject.

Reimplemented in ilObjDlBook.

Definition at line 2311 of file class.ilObjContentObject.php.

        {
                include_once("./content/classes/class.ilContObjectExport.php");

                $cont_exp = new ilContObjectExport($this,'xml');

                $export_file = $cont_exp->buildExportFile();
                return $export_file;
        }               

ilObjContentObject::hasSuccessorPage ( a_cont_obj_id,
a_page_id 
) [static]

STATIC METHOD create a link to the object.

Parameters:
int ref_id of content object
string type of search ('content' or 'meta')
int id of page (optional only used if it has been searched for 'content')
Returns:
array array('link','target') public checks if page has a successor page

Definition at line 1243 of file class.ilObjContentObject.php.

References $tree.

Referenced by ilPageObjectGUI::showPage().

        {
                $tree = new ilTree($a_cont_obj_id);
                $tree->setTableNames('lm_tree','lm_data');
                $tree->setTreeTablePK("lm_id");
                if ($tree->isInTree($a_page_id))
                {
                        $succ = $tree->fetchSuccessorNode($a_page_id, "pg");
                        if ($succ > 0)
                        {
                                return true;
                        }
                }
                return false;
        }

Here is the caller graph for this function:

ilObjContentObject::ilClone ( a_parent_ref  ) 

copy all properties and subobjects of a learning module.

public

Returns:
integer new ref id

Reimplemented from ilObject.

Definition at line 390 of file class.ilObjContentObject.php.

References $rbacadmin.

        {
                global $rbacadmin;

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

                // todo: put here lm specific stuff

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

ilObjContentObject::ilObjContentObject ( 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 57 of file class.ilObjContentObject.php.

References ilObject::ilObject().

Referenced by ilObjDlBook::ilObjDlBook(), and ilObjLearningModule::ilObjLearningModule().

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

                $this->mob_ids = array();
                $this->file_ids = array();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::import (  ) 

if implemented, this function should be called from an Out/GUI-Object

Definition at line 213 of file class.ilObjContentObject.php.

        {
                // nothing to do. just display the dialogue in Out
                return;
        }

ilObjContentObject::initDefaultRoles (  ) 

init default roles settings OBSOLETE.

DON'T USE, READ TEXT BELOW public

Returns:
array object IDs of created local roles.

Reimplemented from ilObject.

Definition at line 98 of file class.ilObjContentObject.php.

References $rbacadmin, $rbacreview, ilObject::createRoleFolder(), and ilObject::getId().

        {
                return array();

                global $rbacadmin, $rbacreview;

                // create a local role folder
                $rfoldObj = $this->createRoleFolder("Local roles","Role Folder of content object ".$this->getId());

                // note: we don't need any roles here, local "author" roles must
                // be created manually. subscription roles have been abandoned.
                /*
                // create author role and assign role to rolefolder...
                $roleObj = $rfoldObj->createRole("author object ".$this->getRefId(),"author of content object ref id ".$this->getRefId());
                $roles[] = $roleObj->getId();

                // copy permissions from author template to new role
                $rbacadmin->copyRolePermission($this->getAuthorRoleTemplateId(), 8, $rfoldObj->getRefId(), $roleObj->getId());

                // grant all allowed operations of role to current learning module
                $rbacadmin->grantPermission($roleObj->getId(),
                        $rbacreview->getOperationsOfRole($roleObj->getId(), "lm", $rfoldObj->getRefId()),
                        $this->getRefId());*/

                unset($rfoldObj);
                //unset($roleObj);

                return $roles ? $roles : array();
        }

Here is the call graph for this function:

ilObjContentObject::isActiveDownloads (  ) 

Definition at line 741 of file class.ilObjContentObject.php.

Referenced by updateProperties().

        {
                return $this->downloads_active;
        }

Here is the caller graph for this function:

ilObjContentObject::isActiveDownloadsPublic (  ) 

Definition at line 751 of file class.ilObjContentObject.php.

Referenced by updateProperties().

        {
                return $this->downloads_public_active;
        }

Here is the caller graph for this function:

ilObjContentObject::isActiveHistoryUserComments (  ) 

Definition at line 786 of file class.ilObjContentObject.php.

Referenced by exportXMLProperties(), and updateProperties().

        {
                return $this->user_comments;
        }

Here is the caller graph for this function:

ilObjContentObject::isActiveLMMenu (  ) 

Definition at line 701 of file class.ilObjContentObject.php.

Referenced by exportXMLProperties(), and updateProperties().

        {
                return $this->lm_menu_active;
        }

Here is the caller graph for this function:

ilObjContentObject::isActiveNumbering (  ) 

Definition at line 721 of file class.ilObjContentObject.php.

Referenced by exportXMLProperties(), and updateProperties().

        {
                return $this->numbering;
        }

Here is the caller graph for this function:

ilObjContentObject::isActivePrintView (  ) 

Definition at line 731 of file class.ilObjContentObject.php.

Referenced by exportXMLProperties(), and updateProperties().

        {
                return $this->print_view_active;
        }

Here is the caller graph for this function:

ilObjContentObject::isActiveTOC (  ) 

Definition at line 711 of file class.ilObjContentObject.php.

Referenced by exportHTML(), exportXMLProperties(), and updateProperties().

        {
                return $this->toc_active;
        }

Here is the caller graph for this function:

ilObjContentObject::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.

public

Parameters:
string event
integer reference id of object where the event occured
array passes optional paramters if required
Returns:
boolean

Reimplemented from ilObject.

Definition at line 1029 of file class.ilObjContentObject.php.

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

        {
                global $tree;
                
                switch ($a_event)
                {
                        case "link":

                                //var_dump("<pre>",$a_params,"</pre>");
                                //echo "Content Object ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
                                //exit;
                                break;
                        
                        case "cut":
                                
                                //echo "Content Object ".$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 "Content Object ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
                                //exit;
                                break;

                        case "paste":
                                
                                //echo "Content Object ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
                                //exit;
                                break;
                        
                        case "new":
                                
                                //echo "Content Object ".$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:

ilObjContentObject::publicNotes (  ) 

Definition at line 761 of file class.ilObjContentObject.php.

Referenced by exportXMLProperties(), and updateProperties().

        {
                return $this->pub_notes;
        }

Here is the caller graph for this function:

ilObjContentObject::putInTree ( a_parent  ) 

put content object in main tree

Reimplemented from ilObject.

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

References $tree.

        {
                global $tree;

                // put this object in tree under $a_parent
                parent::putInTree($a_parent);

                // make new tree for this object
                //$tree->addTree($this->getId());
        }

ilObjContentObject::read (  ) 

read data of content object

Definition at line 132 of file class.ilObjContentObject.php.

References ilObject::getId(), and readProperties().

        {
                parent::read();
#               echo "Content<br>\n";

                $this->lm_tree = new ilTree($this->getId());
                $this->lm_tree->setTableNames('lm_tree','lm_data');
                $this->lm_tree->setTreeTablePK("lm_id");

                $this->readProperties();
                //parent::read();
        }

Here is the call graph for this function:

ilObjContentObject::readProperties (  ) 

read content object properties

Definition at line 814 of file class.ilObjContentObject.php.

References $q, setActiveDownloads(), setActiveDownloadsPublic(), setActiveLMMenu(), setActiveNumbering(), setActivePrintView(), setActiveTOC(), setCleanFrames(), setFooterPage(), setHeaderPage(), setHistoryUserComments(), setLayout(), setOnline(), setPageHeader(), setPublicAccessMode(), setPublicExportFile(), setPublicNotes(), setStyleSheetId(), setTOCMode(), and ilUtil::yn2tf().

Referenced by createProperties(), and read().

        {
                $q = "SELECT * FROM content_object WHERE id = '".$this->getId()."'";
                $lm_set = $this->ilias->db->query($q);
                $lm_rec = $lm_set->fetchRow(DB_FETCHMODE_ASSOC);
                $this->setLayout($lm_rec["default_layout"]);
                $this->setStyleSheetId($lm_rec["stylesheet"]);
                $this->setPageHeader($lm_rec["page_header"]);
                $this->setTOCMode($lm_rec["toc_mode"]);
                $this->setOnline(ilUtil::yn2tf($lm_rec["online"]));
                $this->setActiveTOC(ilUtil::yn2tf($lm_rec["toc_active"]));
                $this->setActiveNumbering(ilUtil::yn2tf($lm_rec["numbering"]));
                $this->setActivePrintView(ilUtil::yn2tf($lm_rec["print_view_active"]));
                $this->setActiveDownloads(ilUtil::yn2tf($lm_rec["downloads_active"]));
                $this->setActiveDownloadsPublic(ilUtil::yn2tf($lm_rec["downloads_public_active"]));
                $this->setActiveLMMenu(ilUtil::yn2tf($lm_rec["lm_menu_active"]));
                $this->setCleanFrames(ilUtil::yn2tf($lm_rec["clean_frames"]));
                $this->setPublicNotes(ilUtil::yn2tf($lm_rec["pub_notes"]));
                $this->setHeaderPage($lm_rec["header_page"]);
                $this->setFooterPage($lm_rec["footer_page"]);
                $this->setHistoryUserComments(ilUtil::yn2tf($lm_rec["hist_user_comments"]));
                $this->setPublicAccessMode($lm_rec["public_access_mode"]);
                $this->setPublicExportFile("xml", $lm_rec["public_xml_file"]);
                $this->setPublicExportFile("html", $lm_rec["public_html_file"]);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::setActiveDownloads ( a_down  ) 

Definition at line 736 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->downloads_active = $a_down;
        }

Here is the caller graph for this function:

ilObjContentObject::setActiveDownloadsPublic ( a_down  ) 

Definition at line 746 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->downloads_public_active = $a_down;
        }

Here is the caller graph for this function:

ilObjContentObject::setActiveLMMenu ( a_act_lm_menu  ) 

Definition at line 696 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->lm_menu_active = $a_act_lm_menu;
        }

Here is the caller graph for this function:

ilObjContentObject::setActiveNumbering ( a_num  ) 

Definition at line 716 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->numbering = $a_num;
        }

Here is the caller graph for this function:

ilObjContentObject::setActivePrintView ( a_print  ) 

Definition at line 726 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->print_view_active = $a_print;
        }

Here is the caller graph for this function:

ilObjContentObject::setActiveTOC ( a_toc  ) 

Definition at line 706 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->toc_active = $a_toc;
        }

Here is the caller graph for this function:

ilObjContentObject::setCleanFrames ( a_clean  ) 

Definition at line 766 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->clean_frames = $a_clean;
        }

Here is the caller graph for this function:

ilObjContentObject::setDescription ( a_description  ) 

set description of content object

Reimplemented from ilObject.

Definition at line 177 of file class.ilObjContentObject.php.

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

ilObjContentObject::setFooterPage ( a_pg  ) 

Definition at line 801 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->footer_page = $a_pg;
        }

Here is the caller graph for this function:

ilObjContentObject::setHeaderPage ( a_pg  ) 

Definition at line 791 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->header_page = $a_pg;
        }

Here is the caller graph for this function:

ilObjContentObject::setHistoryUserComments ( a_comm  ) 

Definition at line 776 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->user_comments = $a_comm;
        }

Here is the caller graph for this function:

ilObjContentObject::setImportId ( a_import_id  ) 

set import id

public

Parameters:
string $a_import_id import id

Reimplemented from ilObject.

Definition at line 189 of file class.ilObjContentObject.php.

        {
                $this->import_id = $a_id;
        }

ilObjContentObject::setLayout ( a_layout  ) 

set default page layout

Parameters:
string $a_layout default page layout

Definition at line 471 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->layout = $a_layout;
        }

Here is the caller graph for this function:

ilObjContentObject::setOnline ( a_online  ) 

Definition at line 686 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->online = $a_online;
        }

Here is the caller graph for this function:

ilObjContentObject::setPageHeader ( a_pg_header = IL_CHAPTER_TITLE  ) 

set page header mode

Parameters:
string $a_pg_header IL_CHAPTER_TITLE | IL_PAGE_TITLE | IL_NO_HEADER

Definition at line 655 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->pg_header = $a_pg_header;
        }

Here is the caller graph for this function:

ilObjContentObject::setPublicAccessMode ( a_mode  ) 

Definition at line 781 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->public_access_mode = $a_mode;
        }

Here is the caller graph for this function:

ilObjContentObject::setPublicExportFile ( a_type,
a_file 
)

specify public export file for type

Parameters:
string $a_type type ("xml" / "html")
string $a_file file name

Definition at line 1688 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->public_export_file[$a_type] = $a_file;
        }

Here is the caller graph for this function:

ilObjContentObject::setPublicNotes ( a_pub_notes  ) 

Definition at line 756 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->pub_notes = $a_pub_notes;
        }

Here is the caller graph for this function:

ilObjContentObject::setStyleSheetId ( a_style_id  ) 

set ID of assigned style sheet object

Definition at line 487 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->style_id = $a_style_id;
        }

Here is the caller graph for this function:

ilObjContentObject::setTitle ( a_title  ) 

set title of content object

Reimplemented from ilObject.

Definition at line 158 of file class.ilObjContentObject.php.

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

ilObjContentObject::setTOCMode ( a_toc_mode = "chapters"  ) 

set toc mode

Parameters:
string $a_toc_mode "chapters" | "pages"

Definition at line 681 of file class.ilObjContentObject.php.

Referenced by readProperties().

        {
                $this->toc_mode = $a_toc_mode;
        }

Here is the caller graph for this function:

ilObjContentObject::update (  ) 

update complete object (meta data and properties)

Reimplemented from ilObject.

Definition at line 202 of file class.ilObjContentObject.php.

References ilObject::updateMetaData(), and updateProperties().

        {
                $this->updateMetaData();
                parent::update();
                $this->updateProperties();
        }

Here is the call graph for this function:

ilObjContentObject::updateProperties (  ) 

update content object properties

Definition at line 843 of file class.ilObjContentObject.php.

References $q, cleanFrames(), getOnline(), isActiveDownloads(), isActiveDownloadsPublic(), isActiveHistoryUserComments(), isActiveLMMenu(), isActiveNumbering(), isActivePrintView(), isActiveTOC(), and publicNotes().

Referenced by update().

        {
                $q = "UPDATE content_object SET ".
                        " default_layout = '".$this->getLayout()."', ".
                        " stylesheet = '".$this->getStyleSheetId()."',".
                        " page_header = '".$this->getPageHeader()."',".
                        " toc_mode = '".$this->getTOCMode()."',".
                        " online = '".ilUtil::tf2yn($this->getOnline())."',".
                        " toc_active = '".ilUtil::tf2yn($this->isActiveTOC())."',".
                        " numbering = '".ilUtil::tf2yn($this->isActiveNumbering())."',".
                        " print_view_active = '".ilUtil::tf2yn($this->isActivePrintView())."',".
                        " downloads_active = '".ilUtil::tf2yn($this->isActiveDownloads())."',".
                        " downloads_public_active = '".ilUtil::tf2yn($this->isActiveDownloadsPublic())."',".
                        " clean_frames = '".ilUtil::tf2yn($this->cleanFrames())."',".
                        " pub_notes = '".ilUtil::tf2yn($this->publicNotes())."',".
                        " hist_user_comments = '".ilUtil::tf2yn($this->isActiveHistoryUserComments())."',".
                        " public_access_mode = '".$this->getPublicAccessMode()."',".
                        " public_xml_file = '".$this->getPublicExportFile("xml")."',".
                        " public_html_file = '".$this->getPublicExportFile("html")."',".
                        " header_page = '".$this->getHeaderPage()."',".
                        " footer_page = '".$this->getFooterPage()."',".
                        " lm_menu_active = '".ilUtil::tf2yn($this->isActiveLMMenu())."'".
                        " WHERE id = '".$this->getId()."'";
                $this->ilias->db->query($q);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjContentObject::writeStyleSheetId ( a_style_id  ) 

write ID of assigned style sheet object to db

Definition at line 495 of file class.ilObjContentObject.php.

References $q.

        {
                global $ilDB;

                $q = "UPDATE content_object SET ".
                        " stylesheet = ".$ilDB->quote($a_style_id).
                        " WHERE id = '".$this->getId()."'";
                $ilDB->query($q);

                $this->style_id = $a_style_id;
        }


Field Documentation

ilObjContentObject::$layout

Definition at line 46 of file class.ilObjContentObject.php.

ilObjContentObject::$lm_tree
ilObjContentObject::$meta_data

Definition at line 45 of file class.ilObjContentObject.php.

ilObjContentObject::$online

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

ilObjContentObject::$pg_header

Definition at line 48 of file class.ilObjContentObject.php.

ilObjContentObject::$style_id

Definition at line 47 of file class.ilObjContentObject.php.


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