Source for file XMLFileDimensionsPartImporter.class.php

Documentation is available at XMLFileDimensionsPartImporter.class.php

  1. <?php
  2. /**
  3. * @since 10/10/05
  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: XMLFileDimensionsPartImporter.class.php,v 1.11 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 filedata of a file, how interesting
  15. *
  16. * @since 10/10/05
  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: XMLFileDimensionsPartImporter.class.php,v 1.11 2007/09/19 14:04:47 adamfranco Exp $
  23. */
  24. class XMLFileDimensionsPartImporter extends XMLImporter {
  25. /**
  26. * Constructor
  27. *
  28. *
  29. * @return object XMLFileDimensionsPartImporter
  30. * @access public
  31. * @since 10/10/05
  32. */
  33. function XMLFileDimensionsPartImporter ($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. * Filters nodes of incorrect type
  50. *
  51. * @param object DOMIT_Node
  52. * @return boolean
  53. * @static
  54. * @access public
  55. * @since 10/10/05
  56. */
  57. function isImportable ($element) {
  58. if ($element->nodeName == "filedimensionspart")
  59. return true;
  60. else
  61. return false;
  62. }
  63.  
  64. /**
  65. * Checks if the user is able to import underneath this level
  66. *
  67. * @param string $authZQString qualifier for authz checking
  68. * @access public
  69. * @since 11/3/05
  70. */
  71. function canImportBelow($authZQString) {
  72. return true;
  73. }
  74.  
  75. /**
  76. * Imports the current node's information
  77. *
  78. * @access public
  79. * @since 10/10/05
  80. */
  81. function importNode () {
  82. $idManager = Services::getService("Id");
  83. $this->getNodeInfo();
  84.  
  85. if (in_array($this->_info['parentId']->getIdString(),
  86. $this->_existingArray) || ($this->_type == "update")) {
  87. $this->_myId =$this->_info['id'];
  88. $this->_object =$this->_parent->getPart($this->_myId);
  89. $this->update();
  90. } else {
  91. $this->_object =$this->_parent->createPart(
  92. $this->_info['partStructureId'], $this->_info['value']);
  93. $this->_myId =$this->_object->getId();
  94. }
  95. }
  96.  
  97. /**
  98. * Sets the node's internal information
  99. *
  100. * @access public
  101. * @since 10/10/05
  102. */
  103. function getNodeInfo () {
  104. $idManager = Services::getService("Id");
  105. $this->_info['partStructureId'] =$idManager->getId("DIMENSIONS");
  106. $this->_info['parentId'] =$this->_parent->getId();
  107. $this->_info['id'] =
  108. $idManager->getId($this->_info['parentId']->getIdString()."-DIMENSIONS");
  109. $this->buildDimensions($this->_node);
  110. }
  111. /**
  112. * Relegates Children to their classes
  113. *
  114. * @param object mixed $topImporter is the importer instance that parsed the XML
  115. * @access public
  116. * @since 10/10/05
  117. */
  118. function relegateChildren ($topImporter) {
  119. }
  120. /**
  121. * Looks for discrepencies between imported data and current data
  122. *
  123. * @access public
  124. * @since 10/10/05
  125. */
  126. function update () {
  127. if (isset($this->_info['value']) && !is_null($this->_info['value']) &&
  128. ($this->_info['value'] != $this->_object->getValue()))
  129. $this->_object->updateValue($this->_info['value']);
  130. }
  131. }
  132. ?>

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