Public Member Functions | Data Fields

ilGlossaryExport Class Reference

Public Member Functions

 ilGlossaryExport (&$a_glo_obj, $a_mode="xml")
 Constructor public.
 getInstId ()
 exportRekursiv ($depth, $left, $right)
 buildExportFile ()
 build export file (complete zip file)
 buildExportFileXML ()
 build export file (complete zip file)
 buildExportFileHTML ()
 build html export file

Data Fields

 $err
 $db
 $ilias
 $glo_obj
 $inst_id

Detailed Description

Definition at line 35 of file class.ilGlossaryExport.php.


Member Function Documentation

ilGlossaryExport::buildExportFile (  ) 

build export file (complete zip file)

public

Returns:

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

References buildExportFileHTML(), and buildExportFileXML().

        {
                switch ($this->mode)
                {
                        case "html":
                                return $this->buildExportFileHTML();
                                break;

                        default:
                                return $this->buildExportFileXML();
                                break;
                }
        }

Here is the call graph for this function:

ilGlossaryExport::buildExportFileHTML (  ) 

build html export file

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

References $ilBench.

Referenced by buildExportFile().

        {
                global $ilBench;

                $ilBench->start("GlossaryExport", "buildHTMLPackage");

                // create directories
                $this->glo_obj->createExportDirectory("html");

                // get Log File
                $expDir = $this->glo_obj->getExportDirectory();
                /*
                $expLog = new ilLog($expDir, "export.log");
                $expLog->delete();
                $expLog->setLogFormat("");
                $expLog->write(date("[y-m-d H:i:s] ")."Start Export");*/

                // get xml content
                $ilBench->start("GlossaryExport", "buildExportFile_getHTML");
                $this->glo_obj->exportHTML($this->export_dir."/".$this->subdir, $expLog);
                $ilBench->stop("GlossaryExport", "buildExportFile_getHTML");

                $ilBench->stop("GlossaryExport", "buildHTMLPackage");
        }

Here is the caller graph for this function:

ilGlossaryExport::buildExportFileXML (  ) 

build export file (complete zip file)

Definition at line 175 of file class.ilGlossaryExport.php.

References $ilBench, ilUtil::makeDir(), and ilUtil::zip().

Referenced by buildExportFile().

        {
                global $ilBench;

                $ilBench->start("GlossaryExport", "buildExportFile");

                require_once("classes/class.ilXmlWriter.php");

                $this->xml = new ilXmlWriter;

                // set dtd definition
                $this->xml->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co_3_7.dtd\">");

                // set generated comment
                $this->xml->xmlSetGenCmt("Export of ILIAS Glossary ".
                        $this->glo_obj->getId()." of installation ".$this->inst.".");

                // set xml header
                $this->xml->xmlHeader();

                // create directories
                $this->glo_obj->createExportDirectory();
                ilUtil::makeDir($this->export_dir."/".$this->subdir);
                ilUtil::makeDir($this->export_dir."/".$this->subdir."/objects");

                // get Log File
                $expDir = $this->glo_obj->getExportDirectory();
                $expLog = new ilLog($expDir, "export.log");
                $expLog->delete();
                $expLog->setLogFormat("");
                $expLog->write(date("[y-m-d H:i:s] ")."Start Export");

                // get xml content
//echo "ContObjExport:".$this->inst_id.":<br>";
                $ilBench->start("GlossaryExport", "buildExportFile_getXML");
                $this->glo_obj->exportXML($this->xml, $this->inst_id,
                        $this->export_dir."/".$this->subdir, $expLog);
                $ilBench->stop("GlossaryExport", "buildExportFile_getXML");

                // dump xml document to screen (only for debugging reasons)
                /*
                echo "<PRE>";
                echo htmlentities($this->xml->xmlDumpMem($format));
                echo "</PRE>";
                */


                // dump xml document to file
                $ilBench->start("GlossaryExport", "buildExportFile_dumpToFile");
                $this->xml->xmlDumpFile($this->export_dir."/".$this->subdir."/".$this->filename
                        , false);
                $ilBench->stop("GlossaryExport", "buildExportFile_dumpToFile");

                // zip the file
                $ilBench->start("GlossaryExport", "buildExportFile_zipFile");
                ilUtil::zip($this->export_dir."/".$this->subdir,
                        $this->export_dir."/".$this->subdir.".zip");
                $ilBench->stop("GlossaryExport", "buildExportFile_zipFile");

                // destroy writer object
                $this->xml->_XmlWriter;

                $expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
                $ilBench->stop("GlossaryExport", "buildExportFile");

                return $this->export_dir."/".$this->subdir.".zip";
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilGlossaryExport::exportRekursiv ( depth,
left,
right 
)

Definition at line 86 of file class.ilGlossaryExport.php.

References $nested, $query, $res, $result, $row, domxml_open_mem(), xpath_eval(), and xpath_new_context().

        {
                // Jetzt alle lm_data anhand der obj_id auslesen.
                $query = "SELECT  *
                        FROM lm_tree, lm_data
                        WHERE lm_tree.lm_id = ".$this->glo_obj->getId()."
                        AND   lm_tree.child = lm_data.obj_id
                        AND   ( lm_data.type =  'st' OR lm_data.type =  'pg' )
                        AND lm_tree.depth = $depth
                        AND lm_tree.lft>$left and lm_tree.rgt<$right
                        ORDER BY lm_tree.lft";

        $result = $this->db->query($query);

        while (is_array($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) )
                {
                        if ($row["type"] == "st")
                        {
                                $xml .= "<StructureObject>";

                                $nested = new ilNestedSetXML();
                                $xml .= $nested->export($row["obj_id"],"st");
                                $xml .= "\n";

                                $xml .= $this->exportRekursiv($depth+1, $row["lft"], $row["rgt"]);

                                $xml .= "</StructureObject>";
                        }

                        if ($row["type"] == "pg")
                        {

                $query = "SELECT * FROM page_object WHERE page_id='".$row["obj_id"]."' ";
                                $result2 = $this->db->query($query);

                                $row2 = $result2->fetchRow(DB_FETCHMODE_ASSOC);

                                $PO = $row2["content"]."\n";

                                if (stristr($PO,"MediaObject"))
                                {

                                        $dom = domxml_open_mem($PO);
                                        $xpc = xpath_new_context($dom);
                                        $path = "//MediaObject/MediaAlias";
                                        $res =& xpath_eval($xpc, $path);
                                        for($i = 0; $i < count($res->nodeset); $i++)
                                        {
                                                $id_arr = explode("_", $res->nodeset[$i]->get_attribute("OriginId"));
                                                $mob_id = $id_arr[count($id_arr) - 1];
                                                $this->mob_ids[$mob_id] = true;
                                        }
                                }

                                $nested = new ilNestedSetXML();
                                $mdxml = $nested->export($row["obj_id"],"pg");

                                $PO = str_replace("<PageObject>","<PageObject>\n$mdxml\n",$PO);

                                $xml .= $PO;

                        }
                }
                return($xml);
        }

Here is the call graph for this function:

ilGlossaryExport::getInstId (  ) 

Definition at line 81 of file class.ilGlossaryExport.php.

        {
                return $this->inst_id;
        }

ilGlossaryExport::ilGlossaryExport ( &$  a_glo_obj,
a_mode = "xml" 
)

Constructor public.

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

References $ilErr, and $ilias.

        {
                global $ilErr, $ilDB, $ilias;

                $this->glo_obj =& $a_glo_obj;

                $this->err =& $ilErr;
                $this->ilias =& $ilias;
                $this->db =& $ilDB;
                $this->mode = $a_mode;

                $settings = $this->ilias->getAllSettings();
                $this->inst_id = $settings["inst_id"];

                $date = time();
                switch($this->mode)
                {
                        case "xml":
                                $this->export_dir = $this->glo_obj->getExportDirectory();
                                $this->subdir = $date."__".$this->inst_id."__".
                                        $this->glo_obj->getType()."_".$this->glo_obj->getId();
                                $this->filename = $this->subdir.".xml";
                                break;
                
                        case "html":
                                $this->export_dir = $this->glo_obj->getExportDirectory("html");
                                $this->subdir = $this->glo_obj->getType()."_".$this->glo_obj->getId();
                                $this->filename = $this->subdir.".zip";
                                break;

                }

        }


Field Documentation

ilGlossaryExport::$db

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

ilGlossaryExport::$err

Definition at line 37 of file class.ilGlossaryExport.php.

ilGlossaryExport::$glo_obj

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

ilGlossaryExport::$ilias

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

Referenced by ilGlossaryExport().

ilGlossaryExport::$inst_id

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


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