DisplayTile.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace dokuwiki\Ui\Media;
  3. use dokuwiki\File\MediaFile;
  4. /**
  5. * Display a MediaFile in the FullScreen MediaManager
  6. */
  7. class DisplayTile extends Display
  8. {
  9. /** @var string URL to open this file in the media manager */
  10. protected $mmUrl;
  11. /** @inheritDoc */
  12. public function __construct(MediaFile $mediaFile)
  13. {
  14. parent::__construct($mediaFile);
  15. // FIXME we may want to integrate this function here or in another class
  16. $this->mmUrl = media_managerURL([
  17. 'image' => $this->mediaFile->getId(),
  18. 'ns' => getNS($this->mediaFile->getId()),
  19. 'tab_details' => 'view',
  20. ]);
  21. }
  22. /**
  23. * Display the tile
  24. */
  25. public function show()
  26. {
  27. $jump = $this->scrollIntoView ? 'id="scroll__here"' : '';
  28. echo '<dl title="' . $this->mediaFile->getDisplayName() . '"' . $jump . '>';
  29. echo '<dt>';
  30. echo '<a id="l_:' . $this->mediaFile->getId() . '" class="image thumb" href="' . $this->mmUrl . '">';
  31. echo $this->getPreviewHtml(90, 90);
  32. echo '</a>';
  33. echo '</dt>';
  34. echo '<dd class="name">';
  35. echo '<a href="' . $this->mmUrl . '" id="h_:' . $this->mediaFile->getId() . '">' .
  36. $this->formatDisplayName() .
  37. '</a>';
  38. echo '</dd>';
  39. echo '<dd class="size">' . $this->formatDimensions() . '</dd>';
  40. echo '<dd class="date">' . $this->formatDate() . '</dd>';
  41. echo '<dd class="filesize">' . $this->formatFileSize() . '</dd>';
  42. echo '</dl>';
  43. }
  44. }