Public Member Functions | Data Fields

ilStructureObject Class Reference

Inheritance diagram for ilStructureObject:
Collaboration diagram for ilStructureObject:

Public Member Functions

 ilStructureObject (&$a_content_obj, $a_id=0)
 Constructor public.
 create ($a_upload=false)
 delete ($a_delete_meta_data=true)
 delete lm object data
 delete_rec (&$a_tree, $a_delete_meta_data=true)
 private
copy (&$lmtree, $a_parent, $a_pos=IL_LAST_NODE)
 copy chapter
 _goto ($a_target)
 redirect script
 exportXML (&$a_xml_writer, $a_inst, &$expLog)
 export object to xml (see ilias_co.dtd)
 exportXMLMetaData (&$a_xml_writer)
 export structure objects meta data to xml (see ilias_co.dtd)
 modifyExportIdentifier ($a_tag, $a_param, $a_value)
 _getPresentationTitle ($a_st_id, $a_include_numbers=false)
 get presentation title
 exportXMLPageObjects (&$a_xml_writer, $a_inst=0)
 export page objects of structure object (see ilias_co.dtd)
 exportXMLStructureObjects (&$a_xml_writer, $a_inst, &$expLog)
 export (sub)structure objects of structure object (see ilias_co.dtd)
 exportFO (&$a_xml_writer)
 export object to fo
 exportFOPageObjects (&$a_xml_writer)
 export page objects of structure object (see ilias_co.dtd)

Data Fields

 $is_alias
 $origin_id
 $tree

Detailed Description

Definition at line 36 of file class.ilStructureObject.php.


Member Function Documentation

ilStructureObject::_getPresentationTitle ( a_st_id,
a_include_numbers = false 
)

get presentation title

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

References $query, $tree, and $tree_set.

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

        {
                global $ilDB;

                // get chapter data
                $query = "SELECT * FROM lm_data WHERE obj_id = '".$a_st_id."'";
                $st_set = $ilDB->query($query);
                $st_rec = $st_set->fetchRow(DB_FETCHMODE_ASSOC);

                $tree = new ilTree($st_rec["lm_id"]);
                $tree->setTableNames('lm_tree','lm_data');
                $tree->setTreeTablePK("lm_id");

                if ($a_include_numbers)
                {
                        if ($tree->isInTree($st_rec["obj_id"]))
                        {
                                // get chapter tree node
                                $query = "SELECT * FROM lm_tree WHERE child = ".
                                        $ilDB->quote($a_st_id)." AND lm_id = ".
                                        $ilDB->quote($st_rec["lm_id"]);
                                $tree_set = $ilDB->query($query);
                                $tree_node = $tree_set->fetchRow(DB_FETCHMODE_ASSOC);
                                $depth = $tree_node["depth"];

                                $nr = $tree->getChildSequenceNumber($tree_node, "st")." ";
                                for ($i = $depth - 1; $i > 1; $i --)
                                {
                                        // get next parent tree node
                                        $query = "SELECT * FROM lm_tree WHERE child = ".
                                        $ilDB->quote($tree_node["parent"])." AND lm_id = ".
                                        $ilDB->quote($st_rec["lm_id"]);
                                        $tree_set = $ilDB->query($query);
                                        $tree_node = $tree_set->fetchRow(DB_FETCHMODE_ASSOC);
                                        $seq = $tree->getChildSequenceNumber($tree_node, "st");

                                        $nr = $seq.".".$nr;
                                }
                        }
                }

                return $nr.$st_rec["title"];
        }

Here is the caller graph for this function:

ilStructureObject::_goto ( a_target  ) 

redirect script

Parameters:
string $a_target

Definition at line 133 of file class.ilStructureObject.php.

References $ilErr, ilLMObject::$lm_id, $lng, $rbacsystem, $ref_id, ilSearch::_checkParentConditions(), ilObject::_getAllReferences(), ilLMObject::_lookupContObjID(), and ilUtil::redirect().

        {
                global $rbacsystem, $ilErr, $lng;

                // determine learning object
                $lm_id = ilLMObject::_lookupContObjID($a_target);

                // get all references
                $ref_ids = ilObject::_getAllReferences($lm_id);

                // check read permissions
                foreach ($ref_ids as $ref_id)
                {
                        include_once 'classes/class.ilSearch.php';
                        
                        // Added this additional check (ParentConditions) to avoid calls of objects inside e.g courses.
                        // Will be replaced in future releases by ilAccess::checkAccess()
                        if ($rbacsystem->checkAccess("read", $ref_id) and ilSearch::_checkParentConditions($ref_id))
                        {
                                ilUtil::redirect("content/lm_presentation.php?ref_id=$ref_id".
                                        "&obj_id=$a_target");
                        }
                }

                $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
        }

Here is the call graph for this function:

& ilStructureObject::copy ( &$  lmtree,
a_parent,
a_pos = IL_LAST_NODE 
)

copy chapter

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

References ilLMObject::getContentObject(), ilLMObject::getDescription(), ilLMObject::getId(), ilLMObjectFactory::getInstance(), ilLMObject::getLMId(), ilLMObject::getTitle(), and ilLMObject::getType().

        {
                $meta =& new ilMetaData();
                $chap =& new ilLMPageObject($this->getContentObject());
                $chap->assignMetaData($meta);
                $chap->setTitle($this->getTitle());
                $chap->setLMId($this->getLMId());
                $chap->setType($this->getType());
                $chap->setDescription($this->getDescription());
                $chap->create();
                
                // insert chapter in tree
                $lmtree->insertNode($chap->getId(), $a_parent, $a_pos);

                $childs =& $lmtree->getChilds($this->getId());
                foreach($childs as $child)
                {
                        $lmobj = ilLMObjectFactory::getInstance($this->getContentObject(), $child["obj_id"], true);
                        $newobj =& $lmobj->copy($lmtree, $chap->getId());
                        // insert page in tree
                        if ($newobj->getType() == "pg")
                        {
                                $lmtree->insertNode($newobj->getId(), $chap->getId());
                        }
                }

                return $chap;
        }

Here is the call graph for this function:

ilStructureObject::create ( a_upload = false  ) 

Reimplemented from ilLMObject.

Definition at line 52 of file class.ilStructureObject.php.

        {
                parent::create($a_upload);
        }

ilStructureObject::delete ( a_delete_meta_data = true  ) 

delete lm object data

Reimplemented from ilLMObject.

Definition at line 60 of file class.ilStructureObject.php.

References delete_rec(), and ilLMObject::getId().

Referenced by delete_rec().

        {
                $this->tree = new ilTree($this->getLmId());
                $this->tree->setTableNames('lm_tree', 'lm_data');
                $this->tree->setTreeTablePK("lm_id");
                $node_data = $this->tree->getNodeData($this->getId());
                $this->delete_rec($this->tree, $a_delete_meta_data);
                $this->tree->deleteTree($node_data);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilStructureObject::delete_rec ( &$  a_tree,
a_delete_meta_data = true 
)

private

Definition at line 73 of file class.ilStructureObject.php.

References $obj, delete(), ilLMObject::getId(), and ilLMObjectFactory::getInstance().

Referenced by delete().

        {
                $childs = $a_tree->getChilds($this->getId());
                foreach ($childs as $child)
                {
                        $obj =& ilLMObjectFactory::getInstance($this->content_object, $child["obj_id"], false);
                        if (is_object($obj))
                        {
                                if($obj->getType() == "st")
                                {
                                        $obj->delete_rec($a_tree, $a_delete_meta_data);
                                }
                                if($obj->getType() == "pg")
                                {
                                        $obj->delete($a_delete_meta_data);
                                }
                        }
                        unset($obj);
                }
                parent::delete($a_delete_meta_data);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilStructureObject::exportFO ( &$  a_xml_writer  ) 

export object to fo

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

Definition at line 341 of file class.ilStructureObject.php.

References $ilBench, exportFOPageObjects(), and ilLMObject::getTitle().

        {
                global $ilBench;

                //$expLog->write(date("[y-m-d H:i:s] ")."Structure Object ".$this->getId());

                // fo:block (complete)
                $attrs = array();
                $attrs["font-family"] = "Times";
                $attrs["font-size"] = "14pt";
                $a_xml_writer->xmlElement("fo:block", $attrs, $this->getTitle());

                // page objects
                //$ilBench->start("ContentObjectExport", "exportStructureObject_exportPageObjects");
                $this->exportFOPageObjects($a_xml_writer);
                //$ilBench->stop("ContentObjectExport", "exportStructureObject_exportPageObjects");

                // structure objects
                //$this->exportFOStructureObjects($a_xml_writer);

        }

Here is the call graph for this function:

ilStructureObject::exportFOPageObjects ( &$  a_xml_writer  ) 

export page objects of structure object (see ilias_co.dtd)

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

Definition at line 369 of file class.ilStructureObject.php.

References $ilBench, ilLMObject::getContentObject(), and ilLMObject::getId().

Referenced by exportFO().

        {
                global $ilBench;

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

                $childs = $this->tree->getChilds($this->getId());
                foreach ($childs as $child)
                {
                        if($child["type"] != "pg")
                        {
                                continue;
                        }

                        // export xml to writer object
                        //$ilBench->start("ContentObjectExport", "exportStructureObject_exportPageObjectAlias");

                        $page_obj = new ilLMPageObject($this->getContentObject(), $child["obj_id"]);
                        $page_obj->exportFO($a_xml_writer);

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

Here is the call graph for this function:

Here is the caller graph for this function:

ilStructureObject::exportXML ( &$  a_xml_writer,
a_inst,
&$  expLog 
)

export object to xml (see ilias_co.dtd)

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

Definition at line 167 of file class.ilStructureObject.php.

References $ilBench, exportXMLMetaData(), exportXMLPageObjects(), exportXMLStructureObjects(), and ilLMObject::getId().

        {
                global $ilBench;

                $expLog->write(date("[y-m-d H:i:s] ")."Structure Object ".$this->getId());
                $attrs = array();
                $a_xml_writer->xmlStartTag("StructureObject", $attrs);

                // MetaData
                $ilBench->start("ContentObjectExport", "exportStructureObject_exportMeta");
                $this->exportXMLMetaData($a_xml_writer);
                $ilBench->stop("ContentObjectExport", "exportStructureObject_exportMeta");

                // StructureObjects
                $ilBench->start("ContentObjectExport", "exportStructureObject_exportPageObjects");
                $this->exportXMLPageObjects($a_xml_writer, $a_inst);
                $ilBench->stop("ContentObjectExport", "exportStructureObject_exportPageObjects");

                // PageObjects
                $this->exportXMLStructureObjects($a_xml_writer, $a_inst, $expLog);

                // Layout
                // not implemented

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

Here is the call graph for this function:

ilStructureObject::exportXMLMetaData ( &$  a_xml_writer  ) 

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

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

Definition at line 201 of file class.ilStructureObject.php.

References ilLMObject::getType().

Referenced by exportXML().

        {
                $nested = new ilNestedSetXML();
                $nested->setParameterModifier($this, "modifyExportIdentifier");
                $a_xml_writer->appendXML($nested->export($this->getId(),
                        $this->getType()));
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilStructureObject::exportXMLPageObjects ( &$  a_xml_writer,
a_inst = 0 
)

export page objects of structure object (see ilias_co.dtd)

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

Definition at line 276 of file class.ilStructureObject.php.

References $ilBench, ilLMPageObject::_exportXMLAlias(), and ilLMObject::getId().

Referenced by exportXML().

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

                global $ilBench;

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

                $childs = $this->tree->getChilds($this->getId());
                foreach ($childs as $child)
                {
                        if($child["type"] != "pg")
                        {
                                continue;
                        }

                        // export xml to writer object
                        $ilBench->start("ContentObjectExport", "exportStructureObject_exportPageObjectAlias");
                        //$ilBench->start("ContentObjectExport", "exportStructureObject_getLMPageObject");
                        //$page_obj = new ilLMPageObject($this->getContentObject(), $child["obj_id"]);
                        //$ilBench->stop("ContentObjectExport", "exportStructureObject_getLMPageObject");
                        ilLMPageObject::_exportXMLAlias($a_xml_writer, $child["obj_id"], $a_inst);
                        //$page_obj->exportXML($a_xml_writer, "alias", $a_inst);
                        //unset($page_obj);
                        $ilBench->stop("ContentObjectExport", "exportStructureObject_exportPageObjectAlias");
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

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

export (sub)structure objects of structure object (see ilias_co.dtd)

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

Definition at line 313 of file class.ilStructureObject.php.

References ilLMObject::getContentObject(), ilLMObject::getId(), and ilStructureObject().

Referenced by exportXML().

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

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

                        // export xml to writer object
                        $structure_obj = new ilStructureObject($this->getContentObject(),
                                $child["obj_id"]);
                        $structure_obj->exportXML($a_xml_writer, $a_inst, $expLog);
                        unset($structure_obj);
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilStructureObject::ilStructureObject ( &$  a_content_obj,
a_id = 0 
)

Constructor public.

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

References ilLMObject::ilLMObject(), and ilLMObject::setType().

Referenced by exportXMLStructureObjects().

        {
                $this->setType("st");
                parent::ilLMObject($a_content_obj, $a_id);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilStructureObject::modifyExportIdentifier ( a_tag,
a_param,
a_value 
)

Definition at line 209 of file class.ilStructureObject.php.

References ilLMObject::getId().

        {
                if ($a_tag == "Identifier" && $a_param == "Entry")
                {
                        $a_value = "il_".IL_INST_ID."_st_".$this->getId();
                        //$a_value = ilUtil::insertInstIntoID($a_value);
                }

                return $a_value;
        }

Here is the call graph for this function:


Field Documentation

ilStructureObject::$is_alias

Definition at line 38 of file class.ilStructureObject.php.

ilStructureObject::$origin_id

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

ilStructureObject::$tree

Definition at line 40 of file class.ilStructureObject.php.

Referenced by _getPresentationTitle().


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