1<?php
2/**
3 * DokuWiki Plugin acknowledge (Admin Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  Andreas Gohr, Anna Dabrowska <dokuwiki@cosmocode.de>
7 */
8class admin_plugin_acknowledge extends DokuWiki_Admin_Plugin
9{
10
11    /**
12     * @return int sort number in admin menu
13     */
14    public function getMenuSort()
15    {
16        return 100;
17    }
18
19    /**
20     * @return bool true if only access for superuser, false is for superusers and moderators
21     */
22    public function forAdminOnly()
23    {
24        return false;
25    }
26
27    /**
28     * Should carry out any processing required by the plugin.
29     */
30    public function handle()
31    {
32    }
33
34    /**
35     * Render HTML output, e.g. helpful text and a form
36     */
37    public function html()
38    {
39        /** @var helper_plugin_acknowledge $helper */
40        $helper = plugin_load('helper', 'acknowledge');
41
42        $acks = $helper->getAcknowledgements();
43
44        ptln('<h1>' . $this->getLang('menu') . '</h1>');
45
46        echo '<table>';
47        echo '<tr>';
48        echo '<th>' . $this->getLang('overviewPage') . '</th>';
49        echo '<th>' . $this->getLang('overviewUser') . '</th>';
50        echo '<th>' . $this->getLang('overviewTime') . '</th>';
51        echo '</tr>';
52
53        foreach ($acks as $ack) {
54            echo '<tr>';
55            echo '<td>' . html_wikilink(':' . $ack['page']) . '</td>' .
56                '<td>' . hsc($ack['user']) . '</td><td>' . dformat($ack['ack']) . '</td>';
57            echo '</tr>';
58        }
59
60        echo '</table>';
61
62        echo '<p>' . $this->getLang('overviewHistory') . '</p>';
63
64    }
65}
66
67