xref: /plugin/farmer/admin/info.php (revision 9ea97f828b4fe8c2f3dd045b7a61c8d517c1618b)
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        $config = $helper->getConfig();
37
38        echo '<table class="inline">';
39
40        $this->line('thisis', $animal ? $this->getLang('thisis.animal') : $this->getLang('thisis.farmer'));
41        if($animal) {
42            $this->line('animal', $animal);
43        }
44
45        $this->line('baseinstall', DOKU_INC);
46        $this->line('farm host', $config['base']['farmhost']);
47        $this->line('farm dir', DOKU_FARMDIR);
48        $this->line('animals', count($helper->getAllAnimals()));
49
50
51        foreach($config['inherit'] as $key => $value) {
52            $this->line('conf_inherit_'.$key, $this->getLang($value ? 'conf_inherit_yes' : 'conf_inherit_no'));
53        }
54
55        echo '</table>';
56    }
57
58    protected function line($langkey, $value) {
59        echo '<tr>';
60        echo '<th>'.$this->getLang($langkey).'</th>';
61        echo '<td>'.$value.'</td>';
62        echo '</tr>';
63    }
64
65}
66
67// vim:ts=4:sw=4:et:
68