/**
  * 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("&", "&amp;", $item->getCaption()) . "</Caption>";
                 }
                 // Text Representation
                 if ($item->getTextRepresentation() != "") {
                     $xml .= "<TextRepresentation>" . str_replace("&", "&amp;", $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("&", "&amp;", $item->getCaption()) . "</Caption>";
                 }
                 // Text Representation
                 if ($item->getTextRepresentation() != "") {
                     $xml .= "<TextRepresentation>" . str_replace("&", "&amp;", $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("&", "&amp;", $item->getCaption()) . "</Caption>";
                 }
                 // Text Representation
                 if ($item->getTextRepresentation() != "") {
                     $xml .= "<TextRepresentation>" . str_replace("&", "&amp;", $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");
 }
 function __buildMetaData()
 {
     include_once 'Services/MetaData/classes/class.ilMD2XML.php';
     $md2xml = new ilMD2XML($this->course_obj->getId(), $this->course_obj->getId(), 'crs');
     $md2xml->startExport();
     $this->appendXML($md2xml->getXML());
     return true;
 }
 /**
  * Write webresource xml
  * @param ilXmlWriter $writer
  * @return 
  */
 public function toXML(ilXmlWriter $writer)
 {
     $attribs = array("obj_id" => "il_" . IL_INST_ID . "_webr_" . $this->getId());
     $writer->xmlStartTag('WebLinks', $attribs);
     // LOM MetaData
     include_once 'Services/MetaData/classes/class.ilMD2XML.php';
     $md2xml = new ilMD2XML($this->getId(), $this->getId(), 'webr');
     $md2xml->startExport();
     $writer->appendXML($md2xml->getXML());
     // Sorting
     include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
     switch (ilContainerSortingSettings::_lookupSortMode($this->getId())) {
         case ilContainer::SORT_MANUAL:
             $writer->xmlElement('Sorting', array('type' => 'Manual'));
             break;
         case ilContainer::SORT_TITLE:
         default:
             $writer->xmlElement('Sorting', array('type' => 'Title'));
             break;
     }
     // All links
     include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
     $links = new ilLinkResourceItems($this->getId());
     $links->toXML($writer);
     $writer->xmlEndTag('WebLinks');
     return true;
 }
 function &cloneMD($a_rbac_id, $a_obj_id, $a_obj_type)
 {
     include_once 'Services/MetaData/classes/class.ilMD2XML.php';
     // this method makes an xml export of the original meta data set
     // and uses this xml string to clone the object
     $md2xml = new ilMD2XML($this->getRBACId(), $this->getObjId(), $this->getObjType());
     $md2xml->startExport();
     // Create copier instance. For pg objects one could instantiate a ilMDXMLPageCopier class
     switch ($a_obj_type) {
         default:
             include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
             $mdxmlcopier =& new ilMDXMLCopier($md2xml->getXML(), $a_rbac_id, $a_obj_id, $a_obj_type);
             break;
     }
     $mdxmlcopier->startParsing();
     return $mdxmlcopier->getMDObject();
 }