0byt3m1n1
Path:
/
data
/
applications
/
aps
/
tikiwiki
/
14.1-0
/
standard
/
htdocs
/
lib
/
smarty_tiki
/
[
Home
]
File: function.trackerheader.php
<?php // (c) Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project // // All Rights Reserved. See copyright.txt for details and a complete list of authors. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. // $Id: function.trackerheader.php 55471 2015-05-18 14:55:23Z jonnybradley $ //this script may only be included - so its better to die if called directly. if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) { header("location: index.php"); exit; } /* params level: level of tag <h> title: title of the <h> toggle: o for open, c for close inTable: table class in a table otherwise will insert div */ function smarty_function_trackerheader($params, $smarty) { global $prefs; $headerlib = TikiLib::lib('header'); $output = $js = ''; static $trackerheaderStack = array(); static $iTrackerHeader = 0; $last = count($trackerheaderStack); $default = array('level'=>3, 'inTable'=>''); $params = array_merge($default, $params); extract($params, EXTR_SKIP); if (!empty($inTable)) { $output .= '</table>'; } while (! empty($last) && $level <= $trackerheaderStack[$last -1]) { // need to close block $output .= "</div>"; array_pop($trackerheaderStack); --$last; } if (!empty($title)) { // new header array_push($trackerheaderStack, $level); $output .= "<!--PUSH".count($trackerheaderStack)." -->"; $id = "trackerHeader_$iTrackerHeader"; $div_id = "block_$id"; $output .= "<h$level id=\"$id\""; if ($prefs['javascript_enabled'] == 'y' && ($toggle == 'o' || $toggle == 'c')) { $output .= ' class="'.($toggle == 'c'?'trackerHeaderClose':'trackerHeaderOpen').'"'; } $output .= '>'; $output .= "$title"; $output .= "</h$level>"; if ($prefs['javascript_enabled'] == 'y' && ($toggle == 'o' || $toggle == 'c')) { $js = "\$('#$id').click(function(event){"; $js .= "\$('#$div_id').toggle();"; $js .= "\$('#$id').toggleClass('trackerHeaderClose');"; $js .= "\$('#$id').toggleClass('trackerHeaderOpen');"; $js .= "});"; $headerlib->add_jq_onready($js); if ($toggle == 'c') { $headerlib->add_jq_onready("\$('#$div_id').hide();"); } } $output .= '<'; $output .= (isset($inTable) && $inTable == 'y')?'tbody': 'div'; $output .= " id=\"$div_id\">"; ++$iTrackerHeader; } else { $last = 0; $trackerheaderStack = array(); } if (!empty($inTable)) { $output .= "<table class=\"$inTable\">"; } return $output; }