Source for file browse_xml.act.php

Documentation is available at browse_xml.act.php

  1. <?php
  2. /**
  3. * @package polyphony.basket
  4. *
  5. * @copyright Copyright &copy; 2005, Middlebury College
  6. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  7. *
  8. * @version $Id: browse_xml.act.php,v 1.4 2007/09/19 14:04:54 adamfranco Exp $
  9. */
  10.  
  11. require_once(POLYPHONY."/main/library/AbstractActions/Action.class.php");
  12. /**
  13. *
  14. *
  15. * @package polyphony.basket
  16. *
  17. * @copyright Copyright &copy; 2005, Middlebury College
  18. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  19. *
  20. * @version $Id: browse_xml.act.php,v 1.4 2007/09/19 14:04:54 adamfranco Exp $
  21. */
  22. class browse_xmlAction
  23. extends Action
  24. {
  25. /**
  26. * Check Authorizations
  27. *
  28. * @return boolean
  29. * @access public
  30. * @since 4/26/05
  31. */
  32. function isAuthorizedToExecute () {
  33. return true;
  34. }
  35. /**
  36. * Return the heading text for this action, or an empty string.
  37. *
  38. * @return string
  39. * @access public
  40. * @since 4/26/05
  41. */
  42. function getHeadingText () {
  43. return _("Viewing Selection");
  44. }
  45. /**
  46. * Answer the title of this slideshow
  47. *
  48. * @return string
  49. * @access public
  50. * @since 5/4/06
  51. */
  52. function getTitle () {
  53. return _("Viewing Selection");
  54. }
  55. /**
  56. * Answer the assets to display in the slideshow
  57. *
  58. * @return object AssetIterator
  59. * @access public
  60. * @since 5/4/06
  61. */
  62. function getAssets () {
  63. $assets = array();
  64. $repositoryManager = Services::getService("Repository");
  65. $basket = Basket::instance();
  66. $basket->clean();
  67. $basket->reset();
  68. while ($basket->hasNext())
  69. $assets[] =$repositoryManager->getAsset($basket->next());
  70. $iterator = new HarmoniIterator($assets);
  71. return $iterator;
  72. }
  73. /**
  74. * Build the content for this action
  75. *
  76. * @return boolean
  77. * @access public
  78. * @since 4/26/05
  79. */
  80. function execute () {
  81. /*********************************************************
  82. * First print the header, then the xml content, then exit before
  83. * the GUI system has a chance to try to theme the output.
  84. *********************************************************/
  85. header("Content-Type: text/xml; charset=\"utf-8\"");
  86. print<<<END
  87. <?xml version="1.0" encoding="utf-8" ?>
  88. <!DOCTYPE slideshow PUBLIC "- //Middlebury College//Slide-Show//EN" "http://concerto.sourceforge.net/dtds/viewer/2.0/slideshow.dtd">
  89. <slideshow>
  90.  
  91. END;
  92. print "\t<title>".$this->getTitle()."</title>\n";
  93. print "\t<media-sizes>\n";
  94. print "\t\t\t\t<size>small</size>\n";
  95. print "\t\t\t\t<size>medium</size>\n";
  96. print "\t\t\t\t<size>large</size>\n";
  97. print "\t\t\t\t<size>original</size>\n";
  98. print "\t</media-sizes>\n";
  99. print "\t<default_size>medium</default_size>\n";
  100. $assets =$this->getAssets();
  101. $authZ = Services::getService("AuthZ");
  102. $idManager = Services::getService("Id");
  103. while ($assets->hasNext())
  104. $this->printAssetXML($assets->next());
  105. print "</slideshow>\n";
  106. exit;
  107. }
  108. /**
  109. * Function for printing the asset block of the slideshow XML file
  110. *
  111. * @param object Asset $asset
  112. * @return void
  113. * @access public
  114. * @since 10/14/05
  115. */
  116. function printAssetXML( $asset) {
  117. $assetId =$asset->getId();
  118. $harmoni = Harmoni::instance();
  119. // ------------------------------------------
  120. print "\t<slide ";
  121. print "source='";
  122. print $harmoni->request->quickURL('collection', 'browse_slide_xml',
  123. array('asset_id' => $assetId->getIdString()));
  124. print "'>\n";
  125. // Text-Position
  126. print "\t\t<text-position>";
  127. print "right";
  128. print "</text-position>\n";
  129. print "\t</slide>\n";
  130. }
  131. }

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