dokuwiki-template-sprintdoc.../Template.php
Andreas Gohr 2387fd467e moved tab logic to a new class
More of the logic should be moved to this class
2017-02-15 17:05:00 +01:00

83 lines
1.8 KiB
PHP

<?php
namespace dokuwiki\template\sprintdoc;
/**
* Class Template
*
* provides additional logic for the sprintdoc template
*
* @package dokuwiki\template\sprintdoc
*/
class Template {
/**
* @var array loaded plugins
*/
protected $plugins = array(
'sqlite' => null,
'tagging' => null,
);
/**
* Get the singleton instance
*
* @return Template
*/
public static function getInstance() {
static $instance = null;
if($instance === null) $instance = new Template();
return $instance;
}
/**
* Template constructor.
*/
protected function __construct() {
$this->initializePlugins();
}
/**
* Load all the plugins we support directly
*/
protected function initializePlugins() {
$this->plugins['sqlite'] = plugin_load('helper', 'sqlite');
if($this->plugins['sqlite']) {
$this->plugins['tagging'] = plugin_load('helper', 'tagging');
}
}
/**
* Get all the tabs to display
*
* @return array
*/
public function getMetaBoxTabs() {
global $lang;
$tabs = array();
$toc = tpl_toc(true);
if($toc) {
$tabs[] = array(
'id' => 'spr__tab-toc',
'label' => $lang['toc'],
'tab' => $toc,
'count' => null,
);
}
if($this->plugins['tagging']) {
$tabs[] = array(
'id' => 'spr__tab-tags',
'label' => tpl_getLang('tab_tags'),
'tab' => $this->plugins['tagging']->tpl_tags(false),
'count' => null, // FIXME
);
}
// fixme add magicmatcher info
return $tabs;
}
}