1<?php
2
3use dokuwiki\Extension\AdminPlugin;
4use dokuwiki\Form\Form;
5
6/**
7 * DokuWiki Plugin lms (Admin Component)
8 *
9 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
10 * @author  Andreas Gohr <dokuwiki@cosmocode.de>
11 */
12class admin_plugin_lms extends AdminPlugin
13{
14    /** @inheritDoc */
15    public function forAdminOnly()
16    {
17        return false;
18    }
19
20    /** @inheritDoc */
21    public function handle()
22    {
23        // FIXME data processing
24    }
25
26    /** @inheritDoc */
27    public function html()
28    {
29        global $INPUT;
30
31        echo '<h1>' . $this->getLang('menu') . '</h1>';
32
33        $form = new Form(['method' => 'POST', 'id' => 'lms__admin-autocomplete']);
34        $form->addTextInput('user', $this->getLang('username'));
35        $form->addButton('submit', '��');
36        echo '<p>' . $form->toHTML() . '</p>';
37
38        if (!$INPUT->str('user')) return;
39
40        /** @var helper_plugin_lms $hlp */
41        $hlp = $this->loadHelper('lms');
42        $list = $hlp->getUserLessons($INPUT->str('user'));
43
44        echo sprintf('<h2>' . $this->getLang('status') . '</h2>', hsc($INPUT->str('user')));
45        echo '<table class="inline">';
46        foreach ($list as $id => $dt) {
47            echo '<tr>';
48            echo '<td>';
49            echo html_wikilink($id);
50            echo '</td>';
51            echo '<td>';
52            if ($dt) {
53                echo dformat($dt);
54            } else {
55                echo '---';
56            }
57            echo '</td>';
58            echo '</tr>';
59        }
60        echo '</table>';
61    }
62}
63