*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
class admin_plugin_farmer_info extends DokuWiki_Admin_Plugin {
/** @var helper_plugin_farmer */
protected $helper;
/**
* admin_plugin_farmer_info constructor.
*/
public function __construct() {
$this->helper = plugin_load('helper', 'farmer');
}
/**
* @return bool admin only!
*/
public function forAdminOnly() {
return false;
}
/**
* Should carry out any processing required by the plugin.
*/
public function handle() {
}
/**
* Render HTML output, e.g. helpful text and a form
*/
public function html() {
global $conf;
global $INPUT;
$animal = $this->helper->getAnimal();
$config = $this->helper->getConfig();
echo '
';
$this->line('thisis', $animal ? $this->getLang('thisis.animal') : $this->getLang('thisis.farmer'));
if($animal) {
$this->line('animal', $animal);
}
$this->line('confdir', fullpath(DOKU_CONF));
$this->line('savedir', fullpath($conf['savedir']));
$this->line('baseinstall', DOKU_INC);
$this->line('farm host', $config['base']['farmhost']);
$this->line('farm dir', DOKU_FARMDIR);
$this->line('animals', $this->animals($INPUT->bool('list')));
foreach($config['inherit'] as $key => $value) {
$this->line('conf_inherit_' . $key, $this->getLang($value ? 'conf_inherit_yes' : 'conf_inherit_no'));
}
echo '
';
}
/**
* List or count the animals
*
* @param bool $list
* @return string
*/
protected function animals($list) {
global $ID;
$animals = $this->helper->getAllAnimals();
$html = '';
if(!$list) {
$html = count($animals);
$self = wl($ID, array('do' => 'admin', 'page' => 'farmer', 'sub' => 'info', 'list' => 1));
$html .= ' [' . $this->getLang('conf_notfound_list') . ']';
return $html;
}
$html .= '';
foreach($animals as $animal) {
$link = $this->helper->getAnimalURL($animal);
$html .= '';
}
$html .= '
';
return $html;
}
/**
* Output a table line
*
* @param string $langkey
* @param string $value
*/
protected function line($langkey, $value) {
echo '';
echo '' . $this->getLang($langkey) . ' | ';
echo '' . $value . ' | ';
echo '
';
}
}
// vim:ts=4:sw=4:et: