1<?php 2/** 3 * Site Export Plugin 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author i-net software <tools@inetsoftware.de> 7 * @author Gerry Weissbach <gweissbach@inetsoftware.de> 8 */ 9 10// must be run within Dokuwiki 11if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); 12if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 13require_once(DOKU_PLUGIN.'action.php'); 14 15class action_plugin_siteexport_aggregate extends DokuWiki_Action_Plugin { 16 17 18 /** 19 * Register Plugin in DW 20 **/ 21 function register(&$controller) { 22 $controller->register_hook('TPL_ACT_RENDER', 'BEFORE', $this, 'siteexport_aggregate'); 23 $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'siteexport_aggregate_button', array ()); 24 } 25 26 function siteexport_aggregate(&$event) 27 { 28 global $ID; 29 30 //if ( $event->data != 'siteexport_aggregate' ) { return true; } 31 if ( !isset($_REQUEST['siteexport_aggregate']) ) { return true; } 32 33 $exportBase = cleanID($_REQUEST['baseID']); 34 $functions=& plugin_load('helper', 'siteexport'); 35 $values = $functions->__getOrderedListOfPagesForID($ID, $exportBase); 36 37 // Generate a TOC that can be exported 38 $TOC = "<toc merge mergeheader>\n"; 39 foreach( $values as $value ) { 40 list($id, $title, $sort) = $value; 41 $TOC .= " * [[{$title}]]\n"; 42 } 43 44 $TOC .= "</toc>\n"; 45 $info = null; 46 print p_render('xhtml', p_get_instructions($TOC),$info); 47 48 $event->preventDefault(); 49 return false; 50 } 51 52 /** 53 * Inserts a toolbar button 54 */ 55 function siteexport_aggregate_button(& $event, $param) { 56 $event->data[] = array ( 57 'type' => 'mediapopup', 58 'title' => $this->getLang('toolbarButton'), 59 'icon' => '../../plugins/siteexport/images/toolbar.png', 60 'url' => 'lib/plugins/siteexport/exe/siteexportmanager.php?ns=', 61 'options' => 'width=750,height=500,left=20,top=20,scrollbars=yes,resizable=yes', 62 'block' => false, 63 ); 64 } 65}