Document.class.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Document class file
  5. * @package chamilo.backup
  6. */
  7. /**
  8. * Code
  9. */
  10. require_once 'Resource.class.php';
  11. define('DOCUMENT','file');
  12. define('FOLDER','folder');
  13. /**
  14. * An document
  15. * @author Bart Mollet <bart.mollet@hogent.be>
  16. * @package chamilo.backup
  17. */
  18. class Document extends Resource
  19. {
  20. var $path;
  21. var $comment;
  22. var $file_type;
  23. var $size;
  24. var $title;
  25. /**
  26. * Create a new Document
  27. * @param int $id
  28. * @param string $path
  29. * @param string $comment
  30. * @param string $title
  31. * @param string $file_type (DOCUMENT or FOLDER);
  32. * @param int $size
  33. */
  34. function Document($id,$path,$comment,$title,$file_type,$size)
  35. {
  36. parent::Resource($id,RESOURCE_DOCUMENT);
  37. $this->path = 'document'.$path;
  38. $this->comment = $comment;
  39. $this->title = $title;
  40. $this->file_type = $file_type;
  41. $this->size = $size;
  42. }
  43. /**
  44. * Show this document
  45. */
  46. function show()
  47. {
  48. parent::show();
  49. echo preg_replace('@^document@', '', $this->path);
  50. if (!empty($this->title) && (api_get_setting('use_document_title') == 'true'))
  51. {
  52. if (strpos($this->path, $this->title) === false)
  53. {
  54. echo " - ".$this->title;
  55. }
  56. }
  57. }
  58. }