Source for file XMLThumbDimensionsPartImporter.class.php

Documentation is available at XMLThumbDimensionsPartImporter.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: XMLThumbDimensionsPartImporter.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 thumbnail data 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: XMLThumbDimensionsPartImporter.class.php,v 1.11 2007/09/19 14:04:47 adamfranco Exp $
  23. */
  24. class XMLThumbDimensionsPartImporter extends XMLImporter {
  25. /**
  26. * Constructor
  27. *
  28. *
  29. * @return object XMLThumbDimensionsPartImporter
  30. * @access public
  31. * @since 10/10/05
  32. */
  33. function XMLThumbDimensionsPartImporter ($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 == "thumbdimensionspart")
  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'] =
  106. $idManager->getId("THUMBNAIL_DIMENSIONS");
  107. $this->buildDimensions($this->_node);
  108.  
  109. $this->_info['parentId'] =$this->_parent->getId();
  110. $this->_info['id'] =
  111. $idManager->getId($this->_info['parentId']->getIdString().
  112. "-THUMBNAIL_DIMENSIONS");
  113. }
  114. /**
  115. * Relegates Children to their classes
  116. *
  117. * @param object mixed $topImporter will be passed down
  118. * @access public
  119. * @since 10/10/05
  120. */
  121. function relegateChildren ($topImporter) {
  122. }
  123. /**
  124. * Looks for discrepencies between imported data and current data
  125. *
  126. * @access public
  127. * @since 10/10/05
  128. */
  129. function update () {
  130. if (isset($this->_info['value']) && !is_null($this->_info['value']) &&
  131. ($this->_info['value'] != $this->_object->getValue()))
  132. $this->_object->updateValue($this->_info['value']);
  133. }
  134. }
  135.  
  136. ?>

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