summaryrefslogtreecommitdiff
path: root/smarty_bit/block.jstabs.php
blob: b34aa853d7b4812898527cc584ef16d933d38251 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php 
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */

/**
 * Smarty {jstabs} block plugin
 *
 * Type:		block
 * Name:		jstabs
 * Input:		
 * Abstract:	Used to enclose a set of tabs
 */
function smarty_block_jstabs( $params, $content, &$gBitSmarty ) {
	global $gBitSystem;
	extract( $params );

	if( $gBitSystem->mPrefs['disable_jstabs'] == 'y' ) {
		$ret .= '<div class="tabpane">'.$content.'</div>';
	} else {
		$id = 1000000 * microtime();
		$ret .= '<div class="tabpane" id="id_'.$id.'">';
		$ret .= "<script type=\"text/javascript\">//<![CDATA[\ntabPane = new WebFXTabPane( document.getElementById( 'id_".$id."' ), true );\n//]]></script>";
		$ret .= $content;
		$ret .= "<script type=\"text/javascript\">//<![CDATA[\nsetupAllTabs();\nvar tabPane;".( !empty( $tab ) ? "\ntabPane.setSelectedIndex( $tab );" : '' )."\n//]]></script>";
		$ret .= '</div>';
	}

	return $ret;
}
?>