xref: /plugin/farmer/admin/info.php (revision d8c083b797e99a75ae620df8414bfa6b3eb86534)
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() {
33*d8c083b7SAndreas Gohr        global $conf;
34*d8c083b7SAndreas Gohr
35632c5618SAndreas Gohr        /** @var helper_plugin_farmer $helper */
36632c5618SAndreas Gohr        $helper = plugin_load('helper', 'farmer');
37632c5618SAndreas Gohr        $animal = $helper->getAnimal();
389ea97f82SAndreas Gohr        $config = $helper->getConfig();
39632c5618SAndreas Gohr
40632c5618SAndreas Gohr        echo '<table class="inline">';
419ea97f82SAndreas Gohr
42632c5618SAndreas Gohr        $this->line('thisis', $animal ? $this->getLang('thisis.animal') : $this->getLang('thisis.farmer'));
43a646d519SAndreas Gohr        if($animal) {
44a646d519SAndreas Gohr            $this->line('animal', $animal);
45a646d519SAndreas Gohr        }
46*d8c083b7SAndreas Gohr        $this->line('confdir', DOKU_CONF);
47*d8c083b7SAndreas Gohr        $this->line('savedir', $conf['savedir']);
48632c5618SAndreas Gohr        $this->line('baseinstall', DOKU_INC);
499ea97f82SAndreas Gohr        $this->line('farm host', $config['base']['farmhost']);
50632c5618SAndreas Gohr        $this->line('farm dir', DOKU_FARMDIR);
51a646d519SAndreas Gohr        $this->line('animals', count($helper->getAllAnimals()));
529ea97f82SAndreas Gohr
539ea97f82SAndreas Gohr
54*d8c083b7SAndreas Gohr
559ea97f82SAndreas Gohr        foreach($config['inherit'] as $key => $value) {
569ea97f82SAndreas Gohr            $this->line('conf_inherit_'.$key, $this->getLang($value ? 'conf_inherit_yes' : 'conf_inherit_no'));
579ea97f82SAndreas Gohr        }
589ea97f82SAndreas Gohr
59632c5618SAndreas Gohr        echo '</table>';
60632c5618SAndreas Gohr    }
61632c5618SAndreas Gohr
62632c5618SAndreas Gohr    protected function line($langkey, $value) {
63632c5618SAndreas Gohr        echo '<tr>';
64632c5618SAndreas Gohr        echo '<th>'.$this->getLang($langkey).'</th>';
65632c5618SAndreas Gohr        echo '<td>'.$value.'</td>';
66632c5618SAndreas Gohr        echo '</tr>';
67632c5618SAndreas Gohr    }
68632c5618SAndreas Gohr
69632c5618SAndreas Gohr}
70632c5618SAndreas Gohr
71632c5618SAndreas Gohr// vim:ts=4:sw=4:et:
72