Source for file XMLThumbDataPartImporter.class.php

Documentation is available at XMLThumbDataPartImporter.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: XMLThumbDataPartImporter.class.php,v 1.16 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: XMLThumbDataPartImporter.class.php,v 1.16 2007/09/19 14:04:47 adamfranco Exp $
  23. */
  24. class XMLThumbDataPartImporter extends XMLImporter {
  25. /**
  26. * Constructor
  27. *
  28. * @return object XMLThumbDataPartImporter
  29. * @access public
  30. * @since 10/10/05
  31. */
  32. function XMLThumbDataPartImporter ($existingArray) {
  33. parent::XMLImporter($existingArray);
  34. }
  35.  
  36. /**
  37. * Sets up importer's self-knowledge
  38. *
  39. * @access public
  40. * @since 10/10/05
  41. */
  42. function setupSelf () {
  43. $this->_childImporterList = NULL;
  44. $this->_childElementList = NULL;
  45. $this->_info = array();
  46. }
  47. /**
  48. * Filters nodes of incorrect type
  49. *
  50. * @param object DOMIT_Node
  51. * @return boolean
  52. * @static
  53. * @access public
  54. * @since 10/10/05
  55. */
  56. function isImportable ($element) {
  57. if ($element->nodeName == "thumbdatapart")
  58. return true;
  59. else
  60. return false;
  61. }
  62.  
  63. /**
  64. * Checks if the user is able to import underneath this level
  65. *
  66. * @param string $authZQString qualifier for authz checking
  67. * @access public
  68. * @since 11/3/05
  69. */
  70. function canImportBelow($authZQString) {
  71. return true;
  72. }
  73.  
  74. /**
  75. * Imports the current node's information
  76. *
  77. * @access public
  78. * @since 10/10/05
  79. */
  80. function importNode () {
  81. $idManager = Services::getService("Id");
  82. $this->getNodeInfo();
  83.  
  84. if (in_array($this->_info['parentId']->getIdString(),
  85. $this->_existingArray) || ($this->_type == "update")) {
  86. $this->_myId =$this->_info['fileDataId'];
  87. $this->_object =$this->_parent->getPart($this->_myId);
  88. $this->update();
  89. } else {
  90. $this->_object =$this->_parent->createPart(
  91. $this->_info['partStructureId'],
  92. file_get_contents($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. $path = $this->_node->getText();
  106. if (!ereg("^([a-zA-Z]+://|[a-zA-Z]+:\\|/)", $path))
  107. $path = $this->_node->ownerDocument->xmlPath.$path;
  108. $this->_info['value'] = $path;
  109. $this->_info['partStructureId'] =$idManager->getId("THUMBNAIL_DATA");
  110. $this->_info['parentId'] = $this->_parent->getId();
  111. $this->_info['fileDataId'] =$idManager->getId(
  112. $this->_info['parentId']->getIdString()."-THUMBNAIL_DATA");
  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']) && (file_get_contents($this->_info['value']) !=
  131. $this->_object->getValue()))
  132. $this->_object->updateValue(file_get_contents($this->_info['value']));
  133. }
  134. }
  135.  
  136. ?>

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