Document.class.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. public $path;
  21. public $comment;
  22. public $file_type;
  23. public $size;
  24. public $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)) {
  51. if (strpos($this->path, $this->title) === false) {
  52. echo " - ".$this->title;
  53. }
  54. }
  55. }
  56. }