Source for file FilesOnlyRepositoryImporter.class.php

Documentation is available at FilesOnlyRepositoryImporter.class.php

  1. <?php
  2. /**
  3. * @since 7/20/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: FilesOnlyRepositoryImporter.class.php,v 1.5 2007/09/19 14:04:48 adamfranco Exp $
  10. */
  11.  
  12. require_once(dirname(__FILE__)."/RepositoryImporter.class.php");
  13. /**
  14. * <##>
  15. *
  16. * @since 7/20/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: FilesOnlyRepositoryImporter.class.php,v 1.5 2007/09/19 14:04:48 adamfranco Exp $
  23. */
  24. class FilesOnlyRepositoryImporter
  25. extends RepositoryImporter
  26. {
  27.  
  28. /**
  29. * Constructor for FileOnlyRepositoryImporter
  30. *
  31. * @param String filename
  32. * @return object
  33. * @access public
  34. * @since 7/20/05
  35. */
  36. function FilesOnlyRepositoryImporter ($filepath, $repositoryId, $dieOnError=false) {
  37. $this->_assetIteratorClass = "ExifAssetIterator";
  38. parent::RepositoryImporter($filepath, $repositoryId, $dieOnError);
  39. }
  40.  
  41. /**
  42. * Get parameters for createAsset
  43. *
  44. * @param mixed input
  45. * @return array
  46. * @access public
  47. * @since 7/20/05
  48. */
  49. function getSingleAssetInfo ($input) {
  50. $assetInfo = array();
  51.  
  52. $assetInfo['description'] = "";
  53. $assetInfo['displayName'] = basename($input);
  54.  
  55.  
  56. $mime = Services::getService("MIME");
  57. $mimeType = $mime->getMimeTypeForFileName(basename($input));
  58. $generalType = substr($mimeType, 0, strpos($mimeType, '/'));
  59. if ($generalType == "application" || !$generalType)
  60. $assetInfo['type'] = new HarmoniType("Asset Types", "edu.middlebury",
  61. "Generic Asset");
  62. else
  63. $assetInfo['type'] = new HarmoniType("Asset Types", "edu.middlebury",
  64. ucfirst($generalType));
  65.  
  66. return $assetInfo;
  67. }
  68.  
  69. /**
  70. * get parameters for createRecord
  71. *
  72. * @param mixed input
  73. * @return array or false on fatal error
  74. * @access public
  75. * @since 7/20/05
  76. */
  77. function getSingleAssetRecordList ($input) {
  78. if (Services::serviceRunning("Logging")) {
  79. $loggingManager = Services::getService("Logging");
  80. $log =$loggingManager->getLogForWriting("Harmoni");
  81. $formatType = new Type("logging", "edu.middlebury",
  82. "AgentsAndNodes",
  83. "A format in which the acting Agent[s] and the target nodes affected are specified.");
  84. $priorityType = new Type("logging", "edu.middlebury", "Error",
  85. "Events involving critical system errors.");
  86. }
  87. $idManager = Services::getService("Id");
  88. $this->_fileStructureId =$idManager->getId("FILE");
  89. $fileparts = array("File Name", "Thumbnail Data");
  90. $this->_fileNamePartIds = $this->matchPartStructures(
  91. $this->_destinationRepository->getRecordStructure(
  92. $this->_fileStructureId), $fileparts);
  93.  
  94. $recordList = array();
  95. $recordListElement = array();
  96. $recordListElement['structureId'] =$this->_fileStructureId;
  97. $recordListElement['partStructureIds'] =$this->_fileNamePartIds;
  98. $recordListElement['parts'] = array($input, "");
  99. $recordList[] = $recordListElement;
  100. $recordListElement = array();
  101. //printpre($recordList);
  102. return $recordList;
  103. }
  104.  
  105. /**
  106. * get asset list for child assets
  107. *
  108. * @param mixed input
  109. * @return null
  110. * @access public
  111. * @since 7/20/05
  112. */
  113. function getChildAssetList ($input) {
  114. return null;
  115. }
  116. }
  117. ?>

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