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