xref: /plugin/dw2pdf/MenuItem.php (revision 852931daed0aa7c73fc4da5d421d2c117decf509)
1026b594bSAndreas Gohr<?php
2026b594bSAndreas Gohr
3026b594bSAndreas Gohrnamespace dokuwiki\plugin\dw2pdf;
4026b594bSAndreas Gohr
5026b594bSAndreas Gohruse dokuwiki\Menu\Item\AbstractItem;
6026b594bSAndreas Gohr
7026b594bSAndreas Gohr/**
8026b594bSAndreas Gohr * Class MenuItem
9026b594bSAndreas Gohr *
10026b594bSAndreas Gohr * Implements the PDF export button for DokuWiki's menu system
11026b594bSAndreas Gohr *
12026b594bSAndreas Gohr * @package dokuwiki\plugin\dw2pdf
13026b594bSAndreas Gohr */
14*852931daSAndreas Gohrclass MenuItem extends AbstractItem
15*852931daSAndreas Gohr{
16026b594bSAndreas Gohr    /** @var string do action for this plugin */
17026b594bSAndreas Gohr    protected $type = 'export_pdf';
18026b594bSAndreas Gohr
19026b594bSAndreas Gohr    /** @var string icon file */
20026b594bSAndreas Gohr    protected $svg = __DIR__ . '/file-pdf.svg';
21026b594bSAndreas Gohr
22026b594bSAndreas Gohr    /**
23026b594bSAndreas Gohr     * MenuItem constructor.
24026b594bSAndreas Gohr     */
25*852931daSAndreas Gohr    public function __construct()
26*852931daSAndreas Gohr    {
27026b594bSAndreas Gohr        parent::__construct();
28cae3b965SGerrit Uitslag        global $REV, $DATE_AT;
29cae3b965SGerrit Uitslag
30cae3b965SGerrit Uitslag        if ($DATE_AT) {
31cae3b965SGerrit Uitslag            $this->params['at'] = $DATE_AT;
32cae3b965SGerrit Uitslag        } elseif ($REV) {
33cae3b965SGerrit Uitslag            $this->params['rev'] = $REV;
34cae3b965SGerrit Uitslag        }
35026b594bSAndreas Gohr    }
36026b594bSAndreas Gohr
37026b594bSAndreas Gohr    /**
38026b594bSAndreas Gohr     * Get label from plugin language file
39026b594bSAndreas Gohr     *
40026b594bSAndreas Gohr     * @return string
41026b594bSAndreas Gohr     */
42*852931daSAndreas Gohr    public function getLabel()
43*852931daSAndreas Gohr    {
44026b594bSAndreas Gohr        $hlp = plugin_load('action', 'dw2pdf');
45026b594bSAndreas Gohr        return $hlp->getLang('export_pdf_button');
46026b594bSAndreas Gohr    }
47026b594bSAndreas Gohr}
48