- md5
- 31172e481374f73917e7b45222c14ce5
- sha1
- 455b3c150492a24251b73abc2fe52c0619f60612
- sha256
- c6fc73ed6729b545fcaf26b4a62e5563a699477571ae05f5956a42c268e89b05
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
<?php
/**
* @package Joomla.Libraries
* @subpackage HTML
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Utility class for Tabs elements.
*
* @since 1.6
*/
abstract class JHtmlTabs
{
/**
* Creates a panes and creates the JavaScript object for it.
*
* @param string $group The pane identifier.
* @param array $params An array of option.
*
* @return string
*
* @since 1.6
*/
public static function start($group = 'tabs', $params = array())
{
static::loadBehavior($group, $params);
return '<dl class="tabs" id="' . $group . '"><dt style="display:none;"></dt><dd style="display:none;">';
}
/**
* Close the current pane
*
* @return string HTML to close the pane
*
* @since 1.6
*/
public static function end()
{
return '</dd></dl>';
}
/**
* Begins the display of a new panel.
*
* @param string $text Text to display.
* @param string $id Identifier of the panel.
*
* @return string HTML to start a new panel
*
* @since 1.6
*/
public static function panel($text, $id)
{
return '</dd><dt class="tabs ' . $id . '"><span><h3><a href="javascript:void(0);">' . $text . '</a></h3></span></dt><dd class="tabs">';
}
/**
* Load the JavaScript behavior.
*
* @param string $group The pane identifier.
* @param array $params Array of options.
*
* @return void
*
* @since 1.6
*/
protected static function loadBehavior($group, $params = array())
{
static $loaded = array();
if (!array_key_exists((string) $group, $loaded))
{
// Include MooTools framework
JHtml::_('behavior.framework', true);
$opt['onActive'] = (isset($params['onActive'])) ? '\\' . $params['onActive'] : null;
$opt['onBackground'] = (isset($params['onBackground'])) ? '\\' . $params['onBackground'] : null;
$opt['display'] = (isset($params['startOffset'])) ? (int) $params['startOffset'] : null;
$opt['titleSelector'] = "dt.tabs";
$opt['descriptionSelector'] = "dd.tabs";
// When use storage is set and value is false - By default we allow to use storage
$opt['useStorage'] = (isset($params['useCookie']) && !$params['useCookie']) ? false : true;
$options = JHtml::getJSObject($opt);
$js = ' window.addEvent(\'domready\', function(){
$$(\'dl#' . $group . '.tabs\').each(function(tabs){
new JTabs(tabs, ' . $options . ');
});
});';
$document = JFactory::getDocument();
$document->addScriptDeclaration($js);
JHtml::_('script', 'system/tabs.js', false, true);
$loaded[(string) $group] = true;
}
}
}
The same content is in 16 releases, Joomla 3.6.0-alpha to 3.6.5. See them all, or every version of this file.