media.lib.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. // These constants specify multi-media related resource files (scripts, players, etc.).
  3. define('FLASH_PLAYER_AUDIO', 'FLASH_PLAYER_AUDIO');
  4. define('FLASH_PLAYER_VIDEO', 'FLASH_PLAYER_VIDEO');
  5. define('SCRIPT_SWFOBJECT', 'SCRIPT_SWFOBJECT');
  6. /**
  7. * A static class for serving the Dokeos system's multi-media features.
  8. * @author Ivan Tcholakov, July 2009.
  9. */
  10. class Media {
  11. /**
  12. * This method returns the path (location) of a specified multi-media resource file.
  13. * @param string $media_resource The identificator of the requested resource: FLASH_PLAYER_AUDIO, FLASH_PLAYER_VIDEO, SCRIPT_SWFOBJECT
  14. * @param string $path_type (optional) Type (or base) of the returned path, it can be: WEB_PATH, SYS_PATH, REL_PATH (default)
  15. * @return string Path to access the requeted media-related file.
  16. * Note: At the moment returned paths are based on hard-coded data. Configuration data may be used in the future.
  17. */
  18. public function get_path($media_resource, $path_type = REL_PATH) {
  19. switch ($media_resource) {
  20. case FLASH_PLAYER_AUDIO:
  21. $relative_path = 'main/inc/lib/mediaplayer/player.swf';
  22. break ;
  23. case FLASH_PLAYER_VIDEO:
  24. $relative_path = 'main/inc/lib/mediaplayer/player.swf';
  25. break;
  26. case SCRIPT_SWFOBJECT:
  27. $relative_path = 'main/inc/lib/swfobject/swfobject.js';
  28. break;
  29. default:
  30. $relative_path = '';
  31. }
  32. return api_get_path($path_type).$relative_path;
  33. }
  34. }