download.class.php 632 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Portfolio;
  3. use Header;
  4. /**
  5. * Download file to your desktop
  6. *
  7. * @copyright (c) 2012 University of Geneva
  8. * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
  9. * @author Laurent Opprecht <laurent@opprecht.info>
  10. */
  11. class Download extends Portfolio
  12. {
  13. function __construct()
  14. {
  15. parent::__construct('download', null);
  16. }
  17. /**
  18. *
  19. * @param User $user
  20. * @param Artefact $artefact
  21. * @return bool
  22. */
  23. function send($user, $artefact)
  24. {
  25. if ($artefact->get_url()) {
  26. Header::location($artefact->get_url());
  27. }
  28. }
  29. }