liberty
[ class tree: liberty ] [ index: liberty ] [ all elements ]

Source for file data.toc.php

Documentation is available at data.toc.php

  1. <?php
  2. /**
  3.  * @version  $Revision$
  4.  * @package  liberty
  5.  * @subpackage plugins_data
  6.  */
  7. // +----------------------------------------------------------------------+
  8. // | Copyright (c) 2004, bitweaver.org
  9. // +----------------------------------------------------------------------+
  10. // | All Rights Reserved. See below for details and a complete list of authors.
  11. // | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
  12. // |
  13. // | For comments, please use phpdocu.sourceforge.net documentation standards!!!
  14. // | -> see http://phpdocu.sourceforge.net/
  15. // +----------------------------------------------------------------------+
  16. // | Author: Christian Fowler <spiderr@users.sourceforge.net>
  17. // +----------------------------------------------------------------------+
  18. // $Id$
  19.  
  20. /**
  21.  * definitions
  22.  */
  23. global $gLibertySystem;
  24.  
  25. define'PLUGIN_GUID_DATATOC''datatoc' );
  26.  
  27. global $gLibertySystem;
  28. $pluginParams array (
  29.     'tag'           => 'toc',
  30.     'auto_activate' => TRUE,
  31.     'requires_pair' => FALSE,
  32.     'load_function' => 'data_toc',
  33.     'title'         => 'Structure Table Of Contents',
  34.     'help_page'     => 'DataPluginTOC',
  35.     'description'   => tra("Display a Table Of Contents for Structures"),
  36.     'help_function' => 'data_toc_help',
  37.     'syntax'        => '{toc structure_id= }',
  38.     'plugin_type'   => DATA_PLUGIN,
  39.     'booticon'       => '{booticon iname="icon-list-ol" iexplain="Structure Table of Contents"}',
  40.     'taginsert'     => '{toc}',
  41.     'structure_id'  => 'id of the structure to display'
  42. );
  43. $gLibertySystem->registerPluginPLUGIN_GUID_DATATOC$pluginParams );
  44. $gLibertySystem->registerDataTag$pluginParams['tag']PLUGIN_GUID_DATATOC );
  45.  
  46. /**
  47.  * Help Function
  48.  */
  49. function data_toc_help({
  50.     return '<table class="data help">'
  51.             .'<tr>'
  52.                 .'<th>' tra"Key" '</th>'
  53.                 .'<th>' tra"Type" '</th>'
  54.                 .'<th>' tra"Comments" '</th>'
  55.             .'</tr>'
  56.             .'<tr class="odd">'
  57.                 .'<td>display</td>'
  58.                 .'<td>' tra"string"'<br />' tra("(optional)"'</td>'
  59.                 .'<td>' tra"Will display a Table Of Contents for Structures, such as Wiki-books. Works only if the page where the tag is used is a part of some structure. If the page belongs to several wiki-books, use structure_id attribute."'</td>'
  60.             .'</tr>'
  61.         .'</table>'
  62.         . tra("Example: "'{toc structure_id=8 display=full_toc}';
  63. }
  64.  
  65. /**
  66.  * Load Function
  67.  */
  68. function data_toc$pData$pParams {
  69.     include_onceLIBERTY_PKG_PATH.'LibertyStructure.php' );
  70.     global $gStructure$gContent$gBitSmarty;
  71.  
  72.     ifis_object$gStructure && $gStructure->isValid() ) {
  73.         $struct &$gStructure;
  74.     elseif@BitBase::verifyId$pParams['structure_id') ) {
  75.             $struct new LibertyStructure$pParams['structure_id');
  76.             $struct->load();
  77.     elseifis_object$gContent ) ) {
  78.         $structures $gContent->getStructures();
  79.         // We take the first structure. not good, but works for now - spiderr
  80.         if!empty$structures[0) ) {
  81.             require_onceLIBERTY_PKG_PATH.'LibertyStructure.php' );
  82.             $struct new LibertyStructure$structures[0]['structure_id');
  83.             $struct->load();
  84.         }
  85.     }
  86.  
  87.     $repl ' ';
  88.     if!empty$struct&& is_object$struct && $struct->isValid()) {
  89.         if@BitBase::verifyId$structure_id ) ) {
  90.             $get_structure $structure_id;
  91.         else {
  92.             $get_structure $struct->mStructureId;
  93.         }
  94.  
  95.         $tree $struct->getSubTree$get_structure!empty$pParams['display'&& $pParams['display'== 'full_toc' ));
  96.         $gBitSmarty->assign"subtree"$tree );
  97.         $repl $gBitSmarty->fetch"bitpackage:liberty/plugins/data_toc.tpl" );
  98.     }
  99.  
  100.     return $repl;
  101. }
  102. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:21 +0000 by phpDocumentor 1.5.0-lsces