Document.class.php 1.2 KB

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