/**
  * export page objects to xml (see ilias_co.dtd)
  *
  * @param	object		$a_xml_writer	ilXmlWriter object that receives the
  *										xml data
  */
 function exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog)
 {
     global $ilBench;
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     foreach ($this->questions as $question_id) {
         $ilBench->start("ContentObjectExport", "exportPageObject");
         $expLog->write(date("[y-m-d H:i:s] ") . "Page Object " . $question_id);
         $attrs = array();
         $a_xml_writer->xmlStartTag("PageObject", $attrs);
         // export xml to writer object
         $ilBench->start("ContentObjectExport", "exportPageObject_XML");
         $page_object = new ilPageObject("qpl", $question_id);
         $page_object->buildDom();
         $page_object->insertInstIntoIDs($a_inst);
         $mob_ids = $page_object->collectMediaObjects(false);
         $file_ids = $page_object->collectFileItems();
         $xml = $page_object->getXMLFromDom(false, false, false, "", true);
         $xml = str_replace("&", "&", $xml);
         $a_xml_writer->appendXML($xml);
         $page_object->freeDom();
         unset($page_object);
         $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");
         $a_xml_writer->xmlEndTag("PageObject");
         //unset($page_obj);
         $ilBench->stop("ContentObjectExport", "exportPageObject");
     }
 }
 /**
  * Get xml representation
  *
  * @param string	entity
  * @param string	schema version
  * @param array		ids
  * @return string	xml
  */
 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
 {
     if ($a_entity == "pg") {
         include_once "./Services/COPage/classes/class.ilPageObject.php";
         $id = explode(":", $a_id);
         $page_object = new ilPageObject($id[0], $id[1]);
         $page_object->buildDom();
         $page_object->insertInstIntoIDs(IL_INST_ID);
         $pxml = $page_object->getXMLFromDom(false, false, false, "", true);
         $pxml = str_replace("&", "&", $pxml);
         $xml = "<PageObject>";
         $xml .= $pxml;
         $xml .= "</PageObject>";
         $page_object->freeDom();
         return $xml;
     }
     if ($a_entity == "pgtp") {
         return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
     }
 }