xref: /plugin/farmer/admin/info.php (revision 9ea97f828b4fe8c2f3dd045b7a61c8d517c1618b)
1632c5618SAndreas Gohr<?php
2632c5618SAndreas Gohr/**
3632c5618SAndreas Gohr * DokuWiki Plugin farmer (Admin Component)
4632c5618SAndreas Gohr *
5632c5618SAndreas Gohr * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6632c5618SAndreas Gohr * @author  Michael Große <grosse@cosmocode.de>
7632c5618SAndreas Gohr */
8632c5618SAndreas Gohr
9632c5618SAndreas Gohr// must be run within Dokuwiki
10632c5618SAndreas Gohrif(!defined('DOKU_INC')) die();
11632c5618SAndreas Gohr
12632c5618SAndreas Gohrclass admin_plugin_farmer_info extends DokuWiki_Admin_Plugin {
13632c5618SAndreas Gohr
14632c5618SAndreas Gohr
15632c5618SAndreas Gohr
16632c5618SAndreas Gohr    /**
17632c5618SAndreas Gohr     * @return bool admin only!
18632c5618SAndreas Gohr     */
19632c5618SAndreas Gohr    public function forAdminOnly() {
20632c5618SAndreas Gohr        return false;
21632c5618SAndreas Gohr    }
22632c5618SAndreas Gohr
23632c5618SAndreas Gohr    /**
24632c5618SAndreas Gohr     * Should carry out any processing required by the plugin.
25632c5618SAndreas Gohr     */
26632c5618SAndreas Gohr    public function handle() {
27632c5618SAndreas Gohr    }
28632c5618SAndreas Gohr
29632c5618SAndreas Gohr    /**
30632c5618SAndreas Gohr     * Render HTML output, e.g. helpful text and a form
31632c5618SAndreas Gohr     */
32632c5618SAndreas Gohr    public function html() {
33632c5618SAndreas Gohr        /** @var helper_plugin_farmer $helper */
34632c5618SAndreas Gohr        $helper = plugin_load('helper', 'farmer');
35632c5618SAndreas Gohr        $animal = $helper->getAnimal();
36*9ea97f82SAndreas Gohr        $config = $helper->getConfig();
37632c5618SAndreas Gohr
38632c5618SAndreas Gohr        echo '<table class="inline">';
39*9ea97f82SAndreas Gohr
40632c5618SAndreas Gohr        $this->line('thisis', $animal ? $this->getLang('thisis.animal') : $this->getLang('thisis.farmer'));
41a646d519SAndreas Gohr        if($animal) {
42a646d519SAndreas Gohr            $this->line('animal', $animal);
43a646d519SAndreas Gohr        }
44632c5618SAndreas Gohr
45632c5618SAndreas Gohr        $this->line('baseinstall', DOKU_INC);
46*9ea97f82SAndreas Gohr        $this->line('farm host', $config['base']['farmhost']);
47632c5618SAndreas Gohr        $this->line('farm dir', DOKU_FARMDIR);
48a646d519SAndreas Gohr        $this->line('animals', count($helper->getAllAnimals()));
49*9ea97f82SAndreas Gohr
50*9ea97f82SAndreas Gohr
51*9ea97f82SAndreas Gohr        foreach($config['inherit'] as $key => $value) {
52*9ea97f82SAndreas Gohr            $this->line('conf_inherit_'.$key, $this->getLang($value ? 'conf_inherit_yes' : 'conf_inherit_no'));
53*9ea97f82SAndreas Gohr        }
54*9ea97f82SAndreas Gohr
55632c5618SAndreas Gohr        echo '</table>';
56632c5618SAndreas Gohr    }
57632c5618SAndreas Gohr
58632c5618SAndreas Gohr    protected function line($langkey, $value) {
59632c5618SAndreas Gohr        echo '<tr>';
60632c5618SAndreas Gohr        echo '<th>'.$this->getLang($langkey).'</th>';
61632c5618SAndreas Gohr        echo '<td>'.$value.'</td>';
62632c5618SAndreas Gohr        echo '</tr>';
63632c5618SAndreas Gohr    }
64632c5618SAndreas Gohr
65632c5618SAndreas Gohr}
66632c5618SAndreas Gohr
67632c5618SAndreas Gohr// vim:ts=4:sw=4:et:
68