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

Source for file data.addtabs.php

Documentation is available at data.addtabs.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: StarRider <starrrider@users.sourceforge.net>
  17. // +----------------------------------------------------------------------+
  18. // $Id$
  19.  
  20. /**
  21.  * definitions
  22.  */
  23. define( 'PLUGIN_GUID_DATAADDTABS', 'dataaddtabs' );
  24. global $gLibertySystem;
  25. global $gContent;
  26. $pluginParams = array (
  27.     'tag' => 'ADDTABS',
  28.     'auto_activate' => FALSE,
  29.     'requires_pair' => FALSE,
  30.     'load_function' => 'data_addtabs',
  31.     'title' => 'AddTabs',
  32.     'help_page' => 'DataPluginAddTabs',
  33.     'description' => tra("Will join the contents from several sources in a Tabbed Interface."),
  34.     'help_function' => 'data_addtabs_help',
  35.     'syntax' => "{ADDTABS tab1= tab2= tab3= . . . tab99= }",
  36.     'plugin_type' => DATA_PLUGIN
  37. );
  38. $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAADDTABS, $pluginParams );
  39. $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAADDTABS );
  40.  
  41. /**
  42.  * Help Function
  43.  */
  44. function data_addtabs_help() {
  45.     $help =
  46.         '<table class="data help">'
  47.             .'<tr>'
  48.                 .'<th>' . tra( "Key" ) . '</th>'
  49.                 .'<th>' . tra( "Type" ) . '</th>'
  50.                 .'<th>' . tra( "Comments" ) . '</th>'
  51.             .'</tr>'
  52.             .'<tr class="odd">'
  53.                 .'<td>tab1 - tab99</td>'
  54.                 .'<td>' . tra( "numeric") . '<br />' . tra("(optional)") . '</td>'
  55.                 .'<td>' . tra( "Will create a Tab interface on a page. The name on each tab is the name given to the imported page.The value sent with the TabX parameter is a Numeric Content Id. This allows blog posts, images, wiki pages . . . (and more) to be added.")
  56.                 . tra("<br /><strong>Note 1:</strong> A listing of Content Id's can be found ")
  57.                 . '<a href="'.LIBERTY_PKG_URL.'list_content.php" title="Launch BitWeaver Content Browser in New Window" onkeypress="javascript:BitBase.popUpWin(this.href,\'standard\',800,800);" onclick="javascript:BitBase.popUpWin(this.href,\'standard\',800,800);return false;">' . tra( "Here" ) . '</a>'
  58.                 . tra("<br /><strong>Note 2:</strong> The order used when the tabs are specified does not matter. The Tabname does - Tab1 is always first and Tab99 will always be last.</td>")
  59.             .'</tr>'
  60.         .'</table>'
  61.         . tra("Example: ") . '{ADDTABS tab1=15 tab2=12 tab3=11}';
  62.     return $help;
  63. }
  64.  
  65. function data_addtabs($data, $params) {
  66.     extract ($params, EXTR_SKIP);
  67.     $id = 1000000 * microtime();
  68.     $ret = '<div class="tabpane" id="id_'.$id.'">';
  69.     $good = false;
  70.     for ($i = 1; $i <= 99; $i++) {
  71.         if( isset( ${'tab'.$i} ) ) {
  72.             if (is_numeric( ${'tab'.$i} ) ) {
  73.                 if( $obj = LibertyBase::getLibertyObject( ${'tab'.$i} ) ) {
  74.                     $ret .= '<div class="tabpage"><h4 id="tab_'.$id.'_'.$i.'" class="tab">'.$obj->getTitle().'</h4>'.$obj->mInfo['parsed_data'].'</div>';
  75.                     $good=True;
  76.                 }
  77.             }
  78.             else {
  79.                 $good=false;
  80.             }
  81.         }
  82.     }
  83.     $ret .= "</div><script type=\"text/javascript\">//<![CDATA[\nsetupAllTabs()\n//]]></script>";
  84.     if( !$good ) {
  85.         $ret = tra("The plugin AddTabs requires valid parameters. Numeric content id numbers can use the parameter names 'tab1' thru 'tab99'");
  86.     }
  87.     return $ret;
  88. }
  89. ?>

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