xref: /template/sprintdoc/tpl/nav-page-tools.php (revision 4d79698367a83764d06890f127c78e3a843a348b)
1<?php
2    if (!defined('DOKU_INC')) die();
3?>
4
5<?php if ($showTools): ?>
6    <nav id="dokuwiki__pagetools">
7        <div class="tools">
8
9        <?php include('nav-status.php');?>
10            <ul>
11                <?php
12                $data = array(
13                    'view'  => 'main-svg',
14                    'items' => array(
15                            'edit'      => dokuwiki\template\sprintdoc\tpl::pageToolAction('edit'),
16                            'revert'    => dokuwiki\template\sprintdoc\tpl::pageToolAction('revert'),
17                            'revisions' => dokuwiki\template\sprintdoc\tpl::pageToolAction('revisions'),
18                            'backlink'  => dokuwiki\template\sprintdoc\tpl::pageToolAction('backlink'),
19                            'subscribe' => dokuwiki\template\sprintdoc\tpl::pageToolAction('subscribe'),
20                            'top'       => dokuwiki\template\sprintdoc\tpl::pageToolAction('top'),
21                         )
22                     );
23
24
25                foreach ($data['items'] as $k => $html) {
26                    if ($html) {
27                        echo "<li>$html</li>";
28                    }
29                }
30
31                /**
32                 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
33                 * Begin shims as a temporary solution until the svg-approach is mainlined and the plugins have adapted
34                 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
35                 */
36                global $ACT;
37                if (act_clean($ACT) === 'show') {
38                    /** @var action_plugin_move_rename $move */
39                    $move = plugin_load('action', 'move_rename');
40                    if ($move && $move->getConf('pagetools_integration')) {
41                        $attr = array(
42                            'style' => 'background-image: none;',
43                        );
44                        $item = \dokuwiki\template\sprintdoc\tpl::pageToolItem('', $move->getLang('renamepage'), __DIR__ . '/../images/tools/41-format-paint.svg', $attr);
45                        echo '<li class="plugin_move_page">' . $item . '</li>';
46                    }
47
48                    /** @var action_plugin_odt_export $odt */
49                    $odt = plugin_load('action', 'odt_export');
50                    if ($odt && $odt->getConf('showexportbutton')) {
51                        global $ID, $REV;
52                        $params = array('do' => 'export_odt');
53                        if ($REV) {
54                            $params['rev'] = $REV;
55                        }
56                        $attr = array(
57                            'class' => 'action export_pdf',
58                            'style' => 'background-image: none;',
59                        );
60                        $svg = __DIR__ . '/../images/tools/FIXME';
61                        $item = \dokuwiki\template\sprintdoc\tpl::pageToolItem(wl($ID, $params, false, '&'), $odt->getLang('export_odt_button'), $svg, $attr);
62                        echo '<li>' . $item . '</li>';
63                    }
64
65                    /** @var action_plugin_dw2pdf $dw2pdf */
66                    $dw2pdf = plugin_load('action', 'dw2pdf');
67                    if ($dw2pdf && $dw2pdf->getConf('showexportbutton')) {
68                        global $ID, $REV;
69
70                        $params = array('do' => 'export_pdf');
71                        if ($REV) {
72                            $params['rev'] = $REV;
73                        }
74                        $attr = array(
75                            'class' => 'action export_pdf',
76                            'style' => 'background-image: none;',
77                        );
78                        $svg = __DIR__ . '/../images/tools/40-pdf-file.svg';
79                        $item = \dokuwiki\template\sprintdoc\tpl::pageToolItem(wl($ID, $params, false, '&'), $dw2pdf->getLang('export_pdf_button'), $svg, $attr);
80                        echo '<li>' . $item . '</li>';
81                    }
82                }
83                /**
84                 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
85                 * End of shims
86                 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
87                 */
88
89                ?>
90            </ul>
91        </div>
92    </nav>
93<?php endif; ?>
94