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 /** @var helper_plugin_farmer $helper */ 34 $helper = plugin_load('helper', 'farmer'); 35 $animal = $helper->getAnimal(); 36 37 echo '<table class="inline">'; 38 $this->line('thisis', $animal ? $this->getLang('thisis.animal') : $this->getLang('thisis.farmer')); 39 if($animal) { 40 $this->line('animal', $animal); 41 } 42 echo '</table>'; 43 44 echo '<table class="inline">'; 45 $this->line('baseinstall', DOKU_INC); 46 $this->line('farm dir', DOKU_FARMDIR); 47 $this->line('animals', count($helper->getAllAnimals())); 48 echo '</table>'; 49 } 50 51 protected function line($langkey, $value) { 52 echo '<tr>'; 53 echo '<th>'.$this->getLang($langkey).'</th>'; 54 echo '<td>'.$value.'</td>'; 55 echo '</tr>'; 56 } 57 58} 59 60// vim:ts=4:sw=4:et: 61