xref: /plugin/botmon/admin.php (revision ade4db36c00fcde1d10bd5e66a7c14c20c8631be)
1<?php
2
3use dokuwiki\Extension\AdminPlugin;
4
5/**
6 * Bot Monitoring Plugin
7*
8* @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
9* @author     Sascha Leib <ad@hominem.info>
10*/
11
12/**
13 * All DokuWiki plugins to extend the admin function
14 * need to inherit from this class
15**/
16class admin_plugin_botmon extends AdminPlugin {
17
18	/**
19	 * Return the path to the icon being displayed in the main admin menu.
20	 *
21	 * @return string full path to the icon file
22	**/
23	public function getMenuIcon() {
24		$plugin = $this->getPluginName();
25		return DOKU_PLUGIN . $plugin . '/img/admin.svg';
26	}
27
28	/**
29	 * output appropriate html
30	*/
31	public function html() {
32
33		global $conf;
34
35		$pluginPath = $conf['basedir'] . 'lib/plugins/' . $this->getPluginName();
36
37		/* Plugin Headline */
38		echo '<div id="botmon__admin">';
39		echo '<h1>Bot Monitoring Plugin</h1>';
40
41		/* tab navigation */
42		echo '<nav id="botmon__tabs">';
43		echo '<ul class="tabs" role="tablist">';
44		echo '<li role="presentation" class="active">';
45		echo '<a role="tab" href="#botmon__panel1" aria-controls="botmon__panel1" id="botmon__tab1" aria-selected="true">Today</a></li>';
46		echo '</ul></nav>';
47
48		// Beta warning message:
49		echo '<div class="info"><strong>Please note:</strong> This plugin is still in the early stages of development and does not (yet) clean up its <code>logs</code> directory.<br>To avoid taking up too much space on your server, please remove older logs manually!</div>';
50
51		/* Live tab */
52		echo '<article role="tabpanel" id="botmon__today"">';
53		echo '<h2 class="a11y">Today</h2>';
54		echo '<header id="botmon__today__title">Loading&nbsp;&hellip;</header>';
55		echo '<div id="botmon__today__content">';
56		echo '<details id="botmon__today__visitors"><summary>Visitor log</summary>';
57		echo '<ul id="botmon__today__visitorlist"></ul>';
58		echo '</details></div>';
59		echo '<footer aria-live="polite"><img src="' . $pluginPath . '/img/spinner.svg" id="botmon__today__busy" width="12" height="12" alt="busy indicator"><span id="botmon__today__status">Initialising&nbsp;&hellip;</span></footer>';
60		echo '</article>';
61		echo '</div><!-- End of BotMon Admin Tool -->';
62
63	}
64}