1<?php 2 3use dokuwiki\Extension\AdminPlugin; 4 5/** 6 * Trafic 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_monitor 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 $svg = '<svg width="60" height="60" id="monitor__today__busy" viewBox="0 0 38 38"><g transform="translate(19 19)"><g transform="rotate(0)"><circle cx="0" cy="12" r="3" opacity="0.125"><animate attributeName="opacity" from="0.125" to="0.125" dur="1.2s" begin="0s" repeatCount="indefinite" keyTimes="0;1" values="1;0.125"></animate></circle></g><g transform="rotate(45)"><circle cx="0" cy="12" r="3" opacity="0.25"><animate attributeName="opacity" from="0.25" to="0.25" dur="1.2s" begin="0.15s" repeatCount="indefinite" keyTimes="0;1" values="1;0.25"></animate></circle></g><g transform="rotate(90)"><circle cx="0" cy="12" r="3" opacity="0.375"><animate attributeName="opacity" from="0.375" to="0.375" dur="1.2s" begin="0.3s" repeatCount="indefinite" keyTimes="0;1" values="1;0.375"></animate></circle></g><g transform="rotate(135)"><circle cx="0" cy="12" r="3" opacity="0.5"><animate attributeName="opacity" from="0.5" to="0.5" dur="1.2s" begin="0.45s" repeatCount="indefinite" keyTimes="0;1" values="1;0.5"></animate></circle></g><g transform="rotate(180)"><circle cx="0" cy="12" r="3" opacity="0.625"><animate attributeName="opacity" from="0.625" to="0.625" dur="1.2s" begin="0.6s" repeatCount="indefinite" keyTimes="0;1" values="1;0.625"></animate></circle></g><g transform="rotate(225)"><circle cx="0" cy="12" r="3" opacity="0.75"><animate attributeName="opacity" from="0.75" to="0.75" dur="1.2s" begin="0.75s" repeatCount="indefinite" keyTimes="0;1" values="1;0.75"></animate></circle></g><g transform="rotate(270)"><circle cx="0" cy="12" r="3" opacity="0.875"><animate attributeName="opacity" from="0.875" to="0.875" dur="1.2s" begin="0.9s" repeatCount="indefinite" keyTimes="0;1" values="1;0.875"></animate></circle></g><g transform="rotate(315)"><circle cx="0" cy="12" r="3" opacity="1"><animate attributeName="opacity" from="1" to="1" dur="1.2s" begin="1.05s" repeatCount="indefinite" keyTimes="0;1" values="1;1"></animate></circle></g></g></svg>'; 34 35 /* Plugin Headline */ 36 echo '<div id="monitor__admin">'; 37 echo '<h1>Monitor Plugin</h1>'; 38 39 /* tab navigation */ 40 echo '<nav id="monitor__tabs">'; 41 echo '<ul class="tabs" role="tablist">'; 42 echo '<li role="presentation" class="active">'; 43 echo '<a role="tab" href="#monitor__panel1" aria-controls="monitor__panel1" id="monitor__tab1" aria-selected="true">Today</a></li>'; 44 echo '</ul></nav>'; 45 46 /* Live tab */ 47 echo '<article role="tabpanel" id="monitor__today"">'; 48 echo '<h2 class="a11y">Today</h2>'; 49 echo '<header id="monitor__today__title">Loading …</header>'; 50 echo '<div id="monitor__today__content">'; 51 echo '<details id="monitor__today__visitors"><summary>Visitor log</summary>'; 52 echo '<ul id="monitor__today__visitorlist"></ul>'; 53 echo '</details></div>'; 54 echo '<footer aria-live="polite">' . $svg . '<span id="monitor__today__status">Initialising …</span></footer>'; 55 echo '</article>'; 56 echo '</div><!-- End of Monitor Admin Tool -->'; 57 58 } 59}