tabs.php
3.15 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
/**
* @package Joomla.Libraries
* @subpackage HTML
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_PLATFORM') or die;
/**
* Utility class for Tabs elements.
*
* @since 1.6
* @deprecated 3.7.0 These helpers are dependent on the deprecated MooTools support
*/
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
* @deprecated 3.7.0 These helpers are dependent on the deprecated MooTools support
*/
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
* @deprecated 3.7.0 These helpers are dependent on the deprecated MooTools support
*/
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
* @deprecated 3.7.0 These helpers are dependent on the deprecated MooTools support
*/
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
* @deprecated 3.7.0 These helpers are dependent on the deprecated MooTools support
*/
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']);
$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', array('version' => 'auto', 'relative' => true));
$loaded[(string) $group] = true;
}
}
}