Source for file XMLRecordExporter.class.php

Documentation is available at XMLRecordExporter.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: XMLRecordExporter.class.php,v 1.9 2007/09/19 14:04:45 adamfranco Exp $
  10. */
  11.  
  12. require_once(POLYPHONY."/main/library/Exporter/XMLPartExporter.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: XMLRecordExporter.class.php,v 1.9 2007/09/19 14:04:45 adamfranco Exp $
  24. */
  25. class XMLRecordExporter {
  26. /**
  27. * Constructor
  28. *
  29. * Maintains the xmlfile
  30. *
  31. * @param resource
  32. * @access public
  33. * @since 10/17/05
  34. */
  35. function XMLRecordExporter ($xmlFile) {
  36. $this->_xml =$xmlFile;
  37. $this->_childExporterList = array("XMLPartExporter");
  38. $this->_childElementList = array("parts");
  39. }
  40.  
  41. /**
  42. * Exporter of All things
  43. *
  44. * @param object HarmoniRecord
  45. * @access public
  46. * @since 10/17/05
  47. */
  48. function export ($record) {
  49. $this->_object =$record;
  50. $this->_myId =$this->_object->getId();
  51.  
  52. $rS =$this->_object->getRecordStructure();
  53. $rSId =$rS->getId();
  54. fwrite($this->_xml,
  55. "\t\t<record ".
  56. "id=\"".$this->_myId->getIdString()."\" ".
  57. "xml:id=\"".$rSId->getIdString()."\">\n");
  58. foreach ($this->_childElementList as $child) {
  59. $exportFn = "export".ucfirst($child);
  60. if (method_exists($this, $exportFn))
  61. $this->$exportFn();
  62. }
  63. fwrite($this->_xml,
  64. "\t\t</record>\n");
  65. }
  66.  
  67. /**
  68. * Exporter of parts
  69. *
  70. * Adds part elements to the xml, which contain the necessary
  71. * information to create the same part.
  72. *
  73. * @access public
  74. * @since 10/17/05
  75. */
  76. function exportParts () {
  77. $children =$this->_object->getParts();
  78. while ($children->hasNext()) {
  79. $child =$children->next();
  80. $exporter = new XMLPartExporter($this->_xml);
  81. $exporter->export($child); // ????
  82. unset($exporter);
  83. }
  84. }
  85. }
  86. ?>

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