/** * Get xml representation * * @param string entity * @param string schema version * @param string id * @return string xml string */ public function getXmlRepresentation($a_entity, $a_schema_version, $a_id) { include_once "./Services/MetaData/classes/class.ilMD2XML.php"; $id = explode(":", $a_id); $mdxml = new ilMD2XML($id[0], $id[1], $id[2]); $mdxml->setExportMode(); $mdxml->startExport(); return $mdxml->getXml(); }
/** * export content objects meta data to xml (see ilias_co.dtd) * * @param object $a_xml_writer ilXmlWriter object that receives the * xml data */ function exportXMLMetaData(&$a_xml_writer) { 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()); }
/** * export content objects meta data to xml (see ilias_co.dtd) * * @param object $a_xml_writer ilXmlWriter object that receives the * xml data */ function exportXMLMetaData(&$a_xml_writer) { $glo_id = ilGlossaryTerm::_lookGlossaryID($this->getTermId()); include_once "Services/MetaData/classes/class.ilMD2XML.php"; $md2xml = new ilMD2XML($glo_id, $this->getId(), $this->getType()); $md2xml->setExportMode(true); $md2xml->startExport(); $a_xml_writer->appendXML($md2xml->getXML()); }
/** * get MediaObject XLM Tag * @param int $a_mode IL_MODE_ALIAS | IL_MODE_OUTPUT | IL_MODE_FULL */ function getXML($a_mode = IL_MODE_FULL, $a_inst = 0) { global $ilUser; // TODO: full implementation of all parameters //echo "-".$a_mode."-"; switch ($a_mode) { case IL_MODE_ALIAS: $xml = "<MediaObject>"; $xml .= "<MediaAlias OriginId=\"il__mob_" . $this->getId() . "\"/>"; $media_items =& $this->getMediaItems(); for ($i = 0; $i < count($media_items); $i++) { $item =& $media_items[$i]; $xml .= "<MediaAliasItem Purpose=\"" . $item->getPurpose() . "\">"; // Layout $width = $item->getWidth() != "" ? "Width=\"" . $item->getWidth() . "\"" : ""; $height = $item->getHeight() != "" ? "Height=\"" . $item->getHeight() . "\"" : ""; $halign = $item->getHAlign() != "" ? "HorizontalAlign=\"" . $item->getHAlign() . "\"" : ""; $xml .= "<Layout {$width} {$height} {$halign} />"; // Caption if ($item->getCaption() != "") { $xml .= "<Caption Align=\"bottom\">" . str_replace("&", "&", $item->getCaption()) . "</Caption>"; } // Text Representation if ($item->getTextRepresentation() != "") { $xml .= "<TextRepresentation>" . str_replace("&", "&", $item->getTextRepresentation()) . "</TextRepresentation>"; } // Parameter $parameters = $item->getParameters(); foreach ($parameters as $name => $value) { $xml .= "<Parameter Name=\"{$name}\" Value=\"{$value}\"/>"; } $xml .= $item->getMapAreasXML(); $xml .= "</MediaAliasItem>"; } break; // for output we need technical sections of meta data // for output we need technical sections of meta data case IL_MODE_OUTPUT: // get first technical section // $meta =& $this->getMetaData(); $xml = "<MediaObject Id=\"il__mob_" . $this->getId() . "\">"; $media_items =& $this->getMediaItems(); for ($i = 0; $i < count($media_items); $i++) { $item =& $media_items[$i]; $xml .= "<MediaItem Purpose=\"" . $item->getPurpose() . "\">"; // Location $xml .= "<Location Type=\"" . $item->getLocationType() . "\">" . $this->handleAmps($item->getLocation()) . "</Location>"; // Format $xml .= "<Format>" . $item->getFormat() . "</Format>"; // Layout $width = $item->getWidth() != "" ? "Width=\"" . $item->getWidth() . "\"" : ""; $height = $item->getHeight() != "" ? "Height=\"" . $item->getHeight() . "\"" : ""; $halign = $item->getHAlign() != "" ? "HorizontalAlign=\"" . $item->getHAlign() . "\"" : ""; $xml .= "<Layout {$width} {$height} {$halign} />"; // Caption if ($item->getCaption() != "") { $xml .= "<Caption Align=\"bottom\">" . str_replace("&", "&", $item->getCaption()) . "</Caption>"; } // Text Representation if ($item->getTextRepresentation() != "") { $xml .= "<TextRepresentation>" . str_replace("&", "&", $item->getTextRepresentation()) . "</TextRepresentation>"; } // Parameter $parameters = $item->getParameters(); foreach ($parameters as $name => $value) { $xml .= "<Parameter Name=\"{$name}\" Value=\"{$value}\"/>"; } $xml .= $item->getMapAreasXML(); // Subtitles if ($item->getPurpose() == "Standard") { $srts = $this->getSrtFiles(); foreach ($srts as $srt) { $def = ""; $meta_lang = ""; if ($ilUser->getLanguage() != $meta_lang && $ilUser->getLanguage() == $srt["language"]) { $def = ' Default="true" '; } $xml .= "<Subtitle File=\"" . ilObjMediaObject::_getDirectory($this->getId()) . "/" . $srt["full_path"] . "\" Language=\"" . $srt["language"] . "\" " . $def . "/>"; } } $xml .= "</MediaItem>"; } break; // full xml for export // full xml for export case IL_MODE_FULL: // $meta =& $this->getMetaData(); $xml = "<MediaObject>"; // meta data include_once "Services/MetaData/classes/class.ilMD2XML.php"; $md2xml = new ilMD2XML(0, $this->getId(), $this->getType()); $md2xml->setExportMode(true); $md2xml->startExport(); $xml .= $md2xml->getXML(); $media_items =& $this->getMediaItems(); for ($i = 0; $i < count($media_items); $i++) { $item =& $media_items[$i]; // highlight mode $xml .= "<MediaItem Purpose=\"" . $item->getPurpose() . "\">"; // Location $xml .= "<Location Type=\"" . $item->getLocationType() . "\">" . $this->handleAmps($item->getLocation()) . "</Location>"; // Format $xml .= "<Format>" . $item->getFormat() . "</Format>"; // Layout $width = $item->getWidth() != "" ? "Width=\"" . $item->getWidth() . "\"" : ""; $height = $item->getHeight() != "" ? "Height=\"" . $item->getHeight() . "\"" : ""; $halign = $item->getHAlign() != "" ? "HorizontalAlign=\"" . $item->getHAlign() . "\"" : ""; $xml .= "<Layout {$width} {$height} {$halign} />"; // Caption if ($item->getCaption() != "") { $xml .= "<Caption Align=\"bottom\">" . str_replace("&", "&", $item->getCaption()) . "</Caption>"; } // Text Representation if ($item->getTextRepresentation() != "") { $xml .= "<TextRepresentation>" . str_replace("&", "&", $item->getTextRepresentation()) . "</TextRepresentation>"; } // Parameter $parameters = $item->getParameters(); foreach ($parameters as $name => $value) { $xml .= "<Parameter Name=\"{$name}\" Value=\"{$value}\"/>"; } $xml .= $item->getMapAreasXML(true, $a_inst); $xml .= "</MediaItem>"; } break; } $xml .= "</MediaObject>"; return $xml; }
/** * export structure objects to xml (see ilias_co.dtd) * * @param object $a_xml_writer ilXmlWriter object that receives the * xml data */ function exportXMLStructureObjects(&$a_xml_writer, $a_inst, &$expLog) { include_once "Services/MetaData/classes/class.ilMD2XML.php"; $tree = new ilTree($this->getId()); $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node'); $tree->setTreeTablePK("slm_id"); $a_xml_writer->xmlStartTag("StructureObject"); foreach ($tree->getFilteredSubTree($tree->getRootId(), array('page')) as $obj) { if ($obj['type'] == '') { continue; } //$md2xml = new ilMD2XML($obj['obj_id'], 0, $obj['type']); $md2xml = new ilMD2XML($this->getId(), $obj['obj_id'], $obj['type']); $md2xml->setExportMode(true); $md2xml->startExport(); $a_xml_writer->appendXML($md2xml->getXML()); } $a_xml_writer->xmlEndTag("StructureObject"); }