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(); 36632c5618SAndreas Gohr 37632c5618SAndreas Gohr echo '<table class="inline">'; 38632c5618SAndreas Gohr $this->line('thisis', $animal ? $this->getLang('thisis.animal') : $this->getLang('thisis.farmer')); 39*a646d519SAndreas Gohr if($animal) { 40*a646d519SAndreas Gohr $this->line('animal', $animal); 41*a646d519SAndreas Gohr } 42632c5618SAndreas Gohr echo '</table>'; 43632c5618SAndreas Gohr 44632c5618SAndreas Gohr echo '<table class="inline">'; 45632c5618SAndreas Gohr $this->line('baseinstall', DOKU_INC); 46632c5618SAndreas Gohr $this->line('farm dir', DOKU_FARMDIR); 47*a646d519SAndreas Gohr $this->line('animals', count($helper->getAllAnimals())); 48632c5618SAndreas Gohr echo '</table>'; 49632c5618SAndreas Gohr } 50632c5618SAndreas Gohr 51632c5618SAndreas Gohr protected function line($langkey, $value) { 52632c5618SAndreas Gohr echo '<tr>'; 53632c5618SAndreas Gohr echo '<th>'.$this->getLang($langkey).'</th>'; 54632c5618SAndreas Gohr echo '<td>'.$value.'</td>'; 55632c5618SAndreas Gohr echo '</tr>'; 56632c5618SAndreas Gohr } 57632c5618SAndreas Gohr 58632c5618SAndreas Gohr} 59632c5618SAndreas Gohr 60632c5618SAndreas Gohr// vim:ts=4:sw=4:et: 61