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