1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8/**
9 * Smarty plugin
10 * @package Smarty
11 * @subpackage plugins
12 *
13 * \brief smarty_block_tabs : add tabs to a template
14 *
15 * params: name (optional but unique per page if set)
16 * params: toggle=y on n default
17 *
18 * usage:
19 * \code
20 *	{accordion}
21 * 		{accordion_group title="{tr}Title 1{/tr}"}tab content{/accordion_group}
22 * 		{accordion_group title="{tr}Title 2{/tr}"}tab content{/accordion_group}
23 *	{/accordion}
24 * \endcode
25 */
26
27//this script may only be included - so its better to die if called directly.
28if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
29	header("location: index.php");
30	exit;
31}
32
33function smarty_block_accordion($params, $content, $smarty, &$repeat)
34{
35	global $accordion_current_group;
36
37	if ($repeat) {
38		$accordion_current_group = null;
39		return;
40	} else {
41		return <<<CONTENT
42<div class="accordian" id="$accordion_current_group">
43$content
44</div>
45CONTENT;
46	}
47}
48