1<?php 2 3namespace dokuwiki\template\sprintdoc; 4 5/** 6 * Class Template 7 * 8 * provides additional logic for the sprintdoc template 9 * 10 * @package dokuwiki\template\sprintdoc 11 */ 12class Template { 13 14 /** 15 * @var array loaded plugins 16 */ 17 protected $plugins = array( 18 'sqlite' => null, 19 'tagging' => null, 20 ); 21 22 /** 23 * Get the singleton instance 24 * 25 * @return Template 26 */ 27 public static function getInstance() { 28 static $instance = null; 29 if($instance === null) $instance = new Template(); 30 return $instance; 31 } 32 33 34 /** 35 * Template constructor. 36 */ 37 protected function __construct() { 38 $this->initializePlugins(); 39 } 40 41 /** 42 * Load all the plugins we support directly 43 */ 44 protected function initializePlugins() { 45 $this->plugins['sqlite'] = plugin_load('helper', 'sqlite'); 46 if($this->plugins['sqlite']) { 47 $this->plugins['tagging'] = plugin_load('helper', 'tagging'); 48 } 49 } 50 51 /** 52 * Get all the tabs to display 53 * 54 * @return array 55 */ 56 public function getMetaBoxTabs() { 57 global $lang; 58 $tabs = array(); 59 60 $toc = tpl_toc(true); 61 if($toc) { 62 $tabs[] = array( 63 'id' => 'spr__tab-toc', 64 'label' => $lang['toc'], 65 'tab' => $toc, 66 'count' => null, 67 ); 68 } 69 70 if($this->plugins['tagging']) { 71 $tabs[] = array( 72 'id' => 'spr__tab-tags', 73 'label' => tpl_getLang('tab_tags'), 74 'tab' => $this->plugins['tagging']->tpl_tags(false), 75 'count' => null, // FIXME 76 ); 77 } 78 79 // fixme add magicmatcher info 80 81 return $tabs; 82 } 83} 84