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