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