1<?php 2/** 3 * DokuWiki Plugin dwtimeline (Action Component) 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author saggi <saggi@gmx.de> 7 */ 8 9// must be run within Dokuwiki 10if(!defined('DOKU_INC')) die(); 11 12class action_plugin_dwtimeline extends DokuWiki_Action_Plugin { 13 14 /** 15 * Register the eventhandlers 16 */ 17 public function register(Doku_Event_Handler $controller) { 18 $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ()); 19 } 20 21 /** 22 * Inserts the toolbar button 23 */ 24 public function insert_button(Doku_Event $event, $param) { 25 $event->data[] = array ( 26 'type' => 'format', 27 'title' => $this->getLang('tl-button'), 28 'icon' => '../../plugins/dwtimeline/icons/timeline_marker.png', 29 'open' => $this->buildSkeleton(), 30 'sample' => $this->getLang('ms-content'), 31 'close' => '\n</milestone>\n</dwtimeline title="'.$this->getLang('tl-end').'">', 32 ); 33 } 34 35 private function buildSkeleton() { 36 $skeleton .= '<dwtimeline title="'.$this->getLang('tl-title').'" description="'.$this->getLang('tl-desc').'">\n'; 37 $skeleton .= '<milestone title="'.$this->getLang('ms-title').'" description="'.$this->getLang('ms-desc').'" '; 38 $skeleton .= 'data="'.$this->getLang('ms-data').'">\n'; 39 return $skeleton; 40 } 41 42 43} 44 45