xref: /plugin/farmer/admin/info.php (revision 632c5618770a957e69c8313b2a509bb6c25da282)
1<?php
2/**
3 * DokuWiki Plugin farmer (Admin Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  Michael Große <grosse@cosmocode.de>
7 */
8
9// must be run within Dokuwiki
10if(!defined('DOKU_INC')) die();
11
12class admin_plugin_farmer_info extends DokuWiki_Admin_Plugin {
13
14
15
16    /**
17     * @return bool admin only!
18     */
19    public function forAdminOnly() {
20        return false;
21    }
22
23    /**
24     * Should carry out any processing required by the plugin.
25     */
26    public function handle() {
27    }
28
29    /**
30     * Render HTML output, e.g. helpful text and a form
31     */
32    public function html() {
33        /** @var helper_plugin_farmer $helper */
34        $helper = plugin_load('helper', 'farmer');
35        $animal = $helper->getAnimal();
36
37        echo '<table class="inline">';
38        $this->line('thisis', $animal ? $this->getLang('thisis.animal') : $this->getLang('thisis.farmer'));
39        if($animal) $this->line('animal', $animal);
40        echo '</table>';
41
42        echo '<table class="inline">';
43        $this->line('baseinstall', DOKU_INC);
44        $this->line('farm dir', DOKU_FARMDIR);
45        $this->line('animals', count(glob(DOKU_FARMDIR . '/*/conf', GLOB_ONLYDIR)));
46        echo '</table>';
47    }
48
49    protected function line($langkey, $value) {
50        echo '<tr>';
51        echo '<th>'.$this->getLang($langkey).'</th>';
52        echo '<td>'.$value.'</td>';
53        echo '</tr>';
54    }
55
56}
57
58// vim:ts=4:sw=4:et:
59