Source for file XMLFilePartImporter.class.php

Documentation is available at XMLFilePartImporter.class.php

  1. <?php
  2. /**
  3. * @since 12/6/06
  4. * @package polyphony.importer
  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: XMLFilePartImporter.class.php,v 1.3 2007/09/19 14:04:47 adamfranco Exp $
  10. */
  11. require_once(POLYPHONY."/main/library/Importer/XMLImporters/XMLImporter.class.php");
  12.  
  13. /**
  14. * imports the mimetype of a file, how interesting
  15. *
  16. * @since 12/6/06
  17. * @package polyphony.importer
  18. *
  19. * @copyright Copyright &copy; 2005, Middlebury College
  20. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  21. *
  22. * @version $Id: XMLFilePartImporter.class.php,v 1.3 2007/09/19 14:04:47 adamfranco Exp $
  23. */
  24. class XMLFilePartImporter extends XMLImporter {
  25. /**
  26. * Constructor
  27. *
  28. *
  29. * @return object XMLMIMEPartImporter
  30. * @access public
  31. * @since 12/6/06
  32. */
  33. function XMLFilePartImporter ($existingArray) {
  34. parent::XMLImporter($existingArray);
  35. }
  36.  
  37. /**
  38. * Sets up importer's self-knowledge
  39. *
  40. * @access public
  41. * @since 10/10/05
  42. */
  43. function setupSelf () {
  44. $this->_childImporterList = NULL;
  45. $this->_childElementList = NULL;
  46. $this->_info = array();
  47. }
  48. /**
  49. * Answer the PartStructureIdString
  50. *
  51. * @return string
  52. * @access public
  53. * @since 12/6/06
  54. */
  55. function getPartStructureIdString () {
  56. throwError(new Error(__CLASS__."::".__FUNCTION__."() must be overridded in child classes."));
  57. }
  58.  
  59. /**
  60. * Filters nodes of incorrect type
  61. *
  62. * @param object DOMIT_Node
  63. * @return boolean
  64. * @static
  65. * @access public
  66. * @since 10/10/05
  67. */
  68. function isImportable ($element) {
  69. throwError(new Error(__CLASS__."::".__FUNCTION__."() must be overridded in child classes."));
  70. }
  71.  
  72. /**
  73. * Checks if the user is able to import underneath this level
  74. *
  75. * @param string $authZQString qualifier for authz checking
  76. * @access public
  77. * @since 11/3/05
  78. */
  79. function canImportBelow($authZQString) {
  80. return true;
  81. }
  82.  
  83. /**
  84. * Imports the current node's information
  85. *
  86. * @access public
  87. * @since 10/10/05
  88. */
  89. function importNode () {
  90. $idManager = Services::getService("Id");
  91. $this->getNodeInfo();
  92.  
  93. if (in_array($this->_info['parentId']->getIdString(),
  94. $this->_existingArray) || ($this->_type != "insert")) {
  95. $this->_myId =$this->_info['id'];
  96. $this->_object =$this->_parent->getPart($this->_myId);
  97. $this->update();
  98. } else {
  99. $this->_object =$this->_parent->createPart(
  100. $this->_info['partStructureId'], $this->_info['value']);
  101. $this->_myId =$this->_object->getId();
  102. }
  103. }
  104.  
  105. /**
  106. * Sets the node's internal information
  107. *
  108. * @access public
  109. * @since 10/10/05
  110. */
  111. function getNodeInfo () {
  112. $idManager = Services::getService("Id");
  113. $this->_info['partStructureId'] =$idManager->getId($this->getPartStructureIdString());
  114. $this->_info['value'] = $this->_node->getText();
  115. $this->_info['parentId'] =$this->_parent->getId();
  116. $this->_info['id'] =
  117. $idManager->getId($this->_info['parentId']->getIdString()."-".$this->getPartStructureIdString());
  118. }
  119. /**
  120. * Relegates Children to their classes
  121. *
  122. * @param object mixed $topImporter will be passed down
  123. * @access public
  124. * @since 10/10/05
  125. */
  126. function relegateChildren ($topImporter) {
  127. }
  128. /**
  129. * Looks for discrepencies between imported data and current data
  130. *
  131. * @access public
  132. * @since 10/10/05
  133. */
  134. function update () {
  135. if (isset($this->_info['value']) && !is_null($this->_info['value']) && ($this->_info['value'] != $this->_object->getValue()))
  136. $this->_object->updateValue($this->_info['value']);
  137. }
  138. }
  139.  
  140. ?>

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