Source for file XMLThumbMIMEPartImporter.class.php

Documentation is available at XMLThumbMIMEPartImporter.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: XMLThumbMIMEPartImporter.class.php,v 1.13 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 mime type 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: XMLThumbMIMEPartImporter.class.php,v 1.13 2007/09/19 14:04:47 adamfranco Exp $
  23. */
  24. class XMLThumbMIMEPartImporter extends XMLImporter {
  25. /**
  26. * Constructor
  27. *
  28. *
  29. * @return object XMLThumbMIMEPartImporter
  30. * @access public
  31. * @since 10/10/05
  32. */
  33. function XMLThumbMIMEPartImporter ($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. /**
  50. * Filters nodes of incorrect type
  51. *
  52. * @param object DOMIT_Node
  53. * @return boolean
  54. * @static
  55. * @access public
  56. * @since 10/10/05
  57. */
  58. function isImportable ($element) {
  59. if ($element->nodeName == "thumbmimepart")
  60. return true;
  61. else
  62. return false;
  63. }
  64.  
  65. /**
  66. * Checks if the user is able to import underneath this level
  67. *
  68. * @param string $authZQString qualifier for authz checking
  69. * @access public
  70. * @since 11/3/05
  71. */
  72. function canImportBelow($authZQString) {
  73. return true;
  74. }
  75.  
  76. /**
  77. * Imports the current node's information
  78. *
  79. * @access public
  80. * @since 10/10/05
  81. */
  82. function importNode () {
  83. $idManager = Services::getService("Id");
  84. $this->getNodeInfo();
  85.  
  86. if (in_array($this->_info['parentId']->getIdString(),
  87. $this->_existingArray) || ($this->_type == "update")) {
  88. $this->_myId =$this->_info['id'];
  89. $this->_object =$this->_parent->getPart($this->_myId);
  90. $this->update();
  91. } else {
  92. $this->_object =$this->_parent->createPart(
  93. $this->_info['partStructureId'], $this->_info['value']);
  94. $this->_myId =$this->_object->getId();
  95. }
  96. }
  97.  
  98. /**
  99. * Sets the node's internal information
  100. *
  101. * @access public
  102. * @since 10/10/05
  103. */
  104. function getNodeInfo () {
  105. $idManager = Services::getService("Id");
  106. $this->_info['partStructureId'] =
  107. $idManager->getId("THUMBNAIL_MIME_TYPE");
  108. $this->_info['value'] = $this->_node->getText();
  109. $this->_info['parentId'] =$this->_parent->getId();
  110. $this->_info['id'] =$idManager->getId(
  111. $this->_info['parentId']->getIdString()."-THUMBNAIL_MIME_TYPE");
  112.  
  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']) && ($this->_info['value'] != $this->_object->getValue()))
  131. $this->_object->updateValue($this->_info['value']);
  132. }
  133. }
  134.  
  135. ?>

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