xref: /plugin/dw2pdf/MenuItem.php (revision cae3b96541c7e5609ca9bbbab0e3c9db566c1eb6)
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 */
14026b594bSAndreas Gohrclass MenuItem extends AbstractItem {
15026b594bSAndreas 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     */
25026b594bSAndreas Gohr    public function __construct() {
26026b594bSAndreas Gohr        parent::__construct();
27*cae3b965SGerrit Uitslag        global $REV, $DATE_AT;
28*cae3b965SGerrit Uitslag
29*cae3b965SGerrit Uitslag        if($DATE_AT) {
30*cae3b965SGerrit Uitslag            $this->params['at'] = $DATE_AT;
31*cae3b965SGerrit Uitslag        } elseif($REV) {
32*cae3b965SGerrit Uitslag            $this->params['rev'] = $REV;
33*cae3b965SGerrit Uitslag        }
34026b594bSAndreas Gohr    }
35026b594bSAndreas Gohr
36026b594bSAndreas Gohr    /**
37026b594bSAndreas Gohr     * Get label from plugin language file
38026b594bSAndreas Gohr     *
39026b594bSAndreas Gohr     * @return string
40026b594bSAndreas Gohr     */
41026b594bSAndreas Gohr    public function getLabel() {
42026b594bSAndreas Gohr        $hlp = plugin_load('action', 'dw2pdf');
43026b594bSAndreas Gohr        return $hlp->getLang('export_pdf_button');
44026b594bSAndreas Gohr    }
45026b594bSAndreas Gohr}
46