Source for file XMLRecordStructureExporter.class.php

Documentation is available at XMLRecordStructureExporter.class.php

  1. <?php
  2. /**
  3. * @since 10/17/05
  4. * @package polyphony.exporter
  5. *
  6. * @copyright Copyright &copy; 2005, Middlebury College
  7. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  8. *
  9. * @version $Id: XMLRecordStructureExporter.class.php,v 1.8 2007/09/19 14:04:45 adamfranco Exp $
  10. */
  11.  
  12. require_once(POLYPHONY."/main/library/Exporter/XMLPartStructureExporter.class.php");
  13.  
  14. /**
  15. * Exports into XML for use with the XML Importer
  16. *
  17. * @since 10/17/05
  18. * @package polyphony.exporter
  19. *
  20. * @copyright Copyright &copy; 2005, Middlebury College
  21. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  22. *
  23. * @version $Id: XMLRecordStructureExporter.class.php,v 1.8 2007/09/19 14:04:45 adamfranco Exp $
  24. */
  25. class XMLRecordStructureExporter {
  26. /**
  27. * Constructor
  28. *
  29. * Maintains XML File
  30. *
  31. * @param resource
  32. * @access public
  33. * @since 10/17/05
  34. */
  35. function XMLRecordStructureExporter ($xmlFile) {
  36. $this->_xml =$xmlFile;
  37. $this->_childExporterList = array("XMLPartStructureExporter");
  38. $this->_childElementList = array("partstructures");
  39. }
  40.  
  41. /**
  42. * Exporter of All things
  43. *
  44. * @param object HarmoniRecordStructure
  45. * @access public
  46. * @since 9/26/05
  47. */
  48. function export ($rS) {
  49. $this->_object =$rS;
  50. $this->_myId =$this->_object->getId();
  51. $idString = $this->_myId->getIdString();
  52.  
  53. fwrite($this->_xml,
  54. "\t<recordstructure ".
  55. "id=\"".$idString."\" ".
  56. "xml:id=\"".$idString."\"");
  57. if (!ereg("^Repository", $idString))
  58. fwrite($this->_xml,
  59. " isGlobal=\"TRUE\"");
  60. fwrite($this->_xml,
  61. ">\n".
  62. "\t\t<name>".$this->_object->getDisplayName()."</name>\n".
  63. "\t\t<description><![CDATA[".$this->_object->getDescription()."]]></description>\n".
  64. "\t\t<format>".$this->_object->getFormat()."</format>\n");
  65. foreach ($this->_childElementList as $child) {
  66. $exportFn = "export".ucfirst($child);
  67. if (method_exists($this, $exportFn))
  68. $this->$exportFn();
  69. }
  70. fwrite($this->_xml,
  71. "\t</recordstructure>\n");
  72. }
  73.  
  74. /**
  75. * Exporter of partstructures
  76. *
  77. * Adds partstructure elements to the xml, which contain the necessary
  78. * information to create the same partstructure.
  79. *
  80. * @access public
  81. * @since 9/26/05
  82. */
  83. function exportPartstructures () {
  84. $children =$this->_object->getPartStructures();
  85. while ($children->hasNext()) {
  86. $child =$children->next();
  87. $exporter = new XMLPartStructureExporter($this->_xml);
  88. $exporter->export($child); // ????
  89. unset($exporter);
  90. }
  91. }
  92. }
  93. ?>

Documentation generated on Wed, 19 Sep 2007 10:28:43 -0400 by phpDocumentor 1.3.0RC3