| [ Indice ] |
Riferimento incrociato di Joomla! 1.5.14 - VM 1.1.4Servizio fornito da VMItalia |
[Vedi sommario] [Stampa] [Vedi testo]
1 <?php 2 /** 3 * @version $Id: pane.php 10707 2008-08-21 09:52:47Z eddieajau $ 4 * @package Joomla.Framework 5 * @subpackage HTML 6 * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. 7 * @license GNU/GPL, see LICENSE.php 8 * Joomla! is free software. This version may have been modified pursuant 9 * to the GNU General Public License, and as distributed it includes or 10 * is derivative of works licensed under the GNU General Public License or 11 * other free or open source software licenses. 12 * See COPYRIGHT.php for copyright notices and details. 13 */ 14 15 // Check to ensure this file is within the rest of the framework 16 defined('JPATH_BASE') or die(); 17 18 /** 19 * JPane abstract class 20 * 21 * @abstract 22 * @package Joomla.Framework 23 * @subpackage HTML 24 * @since 1.5 25 */ 26 class JPane extends JObject 27 { 28 29 var $useCookies = false; 30 31 /** 32 * Constructor 33 * 34 * @param array $params Associative array of values 35 */ 36 function __construct( $params = array() ) 37 { 38 } 39 40 /** 41 * Returns a reference to a JPanel object 42 * 43 * @param string $behavior The behavior to use 44 * @param boolean $useCookies Use cookies to remember the state of the panel 45 * @param array $params Associative array of values 46 * @return object 47 */ 48 function &getInstance( $behavior = 'Tabs', $params = array()) 49 { 50 $classname = 'JPane'.$behavior; 51 $instance = new $classname($params); 52 53 return $instance; 54 } 55 56 /** 57 * Creates a pane and creates the javascript object for it 58 * 59 * @abstract 60 * @param string The pane identifier 61 */ 62 function startPane( $id ) 63 { 64 return; 65 } 66 67 /** 68 * Ends the pane 69 * 70 * @abstract 71 */ 72 function endPane() 73 { 74 return; 75 } 76 77 /** 78 * Creates a panel with title text and starts that panel 79 * 80 * @abstract 81 * @param string $text The panel name and/or title 82 * @param string $id The panel identifer 83 */ 84 function startPanel( $text, $id ) 85 { 86 return; 87 } 88 89 /** 90 * Ends a panel 91 * 92 * @abstract 93 */ 94 function endPanel() 95 { 96 return; 97 } 98 99 /** 100 * Load the javascript behavior and attach it to the document 101 * 102 * @abstract 103 */ 104 function _loadBehavior() 105 { 106 return; 107 } 108 } 109 110 /** 111 * JPanelTabs class to to draw parameter panes 112 * 113 * @package Joomla.Framework 114 * @subpackage HTML 115 * @since 1.5 116 */ 117 class JPaneTabs extends JPane 118 { 119 /** 120 * Constructor 121 * 122 * @param array $params Associative array of values 123 */ 124 function __construct( $params = array() ) 125 { 126 static $loaded = false; 127 128 parent::__construct($params); 129 130 if (!$loaded) { 131 $this->_loadBehavior($params); 132 $loaded = true; 133 } 134 } 135 136 /** 137 * Creates a pane and creates the javascript object for it 138 * 139 * @param string The pane identifier 140 */ 141 function startPane( $id ) 142 { 143 return '<dl class="tabs" id="'.$id.'">'; 144 } 145 146 /** 147 * Ends the pane 148 */ 149 function endPane() 150 { 151 return "</dl>"; 152 } 153 154 /** 155 * Creates a tab panel with title text and starts that panel 156 * 157 * @param string $text The name of the tab 158 * @param string $id The tab identifier 159 */ 160 function startPanel( $text, $id ) 161 { 162 return '<dt id="'.$id.'"><span>'.$text.'</span></dt><dd>'; 163 } 164 165 /** 166 * Ends a tab page 167 */ 168 function endPanel() 169 { 170 return "</dd>"; 171 } 172 173 /** 174 * Load the javascript behavior and attach it to the document 175 * 176 * @param array $params Associative array of values 177 */ 178 function _loadBehavior($params = array()) 179 { 180 // Include mootools framework 181 JHTML::_('behavior.mootools'); 182 183 $document =& JFactory::getDocument(); 184 185 $options = '{'; 186 $opt['onActive'] = (isset($params['onActive'])) ? $params['onActive'] : null ; 187 $opt['onBackground'] = (isset($params['onBackground'])) ? $params['onBackground'] : null ; 188 $opt['display'] = (isset($params['startOffset'])) ? (int)$params['startOffset'] : null ; 189 foreach ($opt as $k => $v) 190 { 191 if ($v) { 192 $options .= $k.': '.$v.','; 193 } 194 } 195 if (substr($options, -1) == ',') { 196 $options = substr($options, 0, -1); 197 } 198 $options .= '}'; 199 200 $js = ' window.addEvent(\'domready\', function(){ $$(\'dl.tabs\').each(function(tabs){ new JTabs(tabs, '.$options.'); }); });'; 201 202 $document->addScriptDeclaration( $js ); 203 $document->addScript( JURI::root(true). '/media/system/js/tabs.js' ); 204 } 205 } 206 207 /** 208 * JPanelSliders class to to draw parameter panes 209 * 210 * @package Joomla.Framework 211 * @subpackage HTML 212 * @since 1.5 213 */ 214 class JPaneSliders extends JPane 215 { 216 /** 217 * Constructor 218 * 219 * @param int useCookies, if set to 1 cookie will hold last used tab between page refreshes 220 */ 221 function __construct( $params = array() ) 222 { 223 static $loaded = false; 224 225 parent::__construct($params); 226 227 if(!$loaded) { 228 $this->_loadBehavior($params); 229 $loaded = true; 230 } 231 } 232 233 /** 234 * Creates a pane and creates the javascript object for it 235 * 236 * @param string The pane identifier 237 */ 238 function startPane( $id ) 239 { 240 return '<div id="'.$id.'" class="pane-sliders">'; 241 } 242 243 /** 244 * Ends the pane 245 */ 246 function endPane() { 247 return '</div>'; 248 } 249 250 /** 251 * Creates a tab panel with title text and starts that panel 252 * 253 * @param string $text - The name of the tab 254 * @param string $id - The tab identifier 255 */ 256 function startPanel( $text, $id ) 257 { 258 return '<div class="panel">' 259 .'<h3 class="jpane-toggler title" id="'.$id.'"><span>'.$text.'</span></h3>' 260 .'<div class="jpane-slider content">'; 261 } 262 263 /** 264 * Ends a tab page 265 */ 266 function endPanel() 267 { 268 return '</div></div>'; 269 } 270 271 /** 272 * Load the javascript behavior and attach it to the document 273 * 274 * @param array $params Associative array of values 275 */ 276 function _loadBehavior($params = array()) 277 { 278 // Include mootools framework 279 JHTML::_('behavior.mootools'); 280 281 $document =& JFactory::getDocument(); 282 283 $options = '{'; 284 $opt['onActive'] = 'function(toggler, i) { toggler.addClass(\'jpane-toggler-down\'); toggler.removeClass(\'jpane-toggler\'); }'; 285 $opt['onBackground'] = 'function(toggler, i) { toggler.addClass(\'jpane-toggler\'); toggler.removeClass(\'jpane-toggler-down\'); }'; 286 $opt['duration'] = (isset($params['duration'])) ? (int)$params['duration'] : 300; 287 $opt['display'] = (isset($params['startOffset']) && ($params['startTransition'])) ? (int)$params['startOffset'] : null ; 288 $opt['show'] = (isset($params['startOffset']) && (!$params['startTransition'])) ? (int)$params['startOffset'] : null ; 289 $opt['opacity'] = (isset($params['opacityTransition']) && ($params['opacityTransition'])) ? 'true' : 'false' ; 290 $opt['alwaysHide'] = (isset($params['allowAllClose']) && ($params['allowAllClose'])) ? 'true' : null ; 291 foreach ($opt as $k => $v) 292 { 293 if ($v) { 294 $options .= $k.': '.$v.','; 295 } 296 } 297 if (substr($options, -1) == ',') { 298 $options = substr($options, 0, -1); 299 } 300 $options .= '}'; 301 302 $js = ' window.addEvent(\'domready\', function(){ new Accordion($$(\'.panel h3.jpane-toggler\'), $$(\'.panel div.jpane-slider\'), '.$options.'); });'; 303 304 $document->addScriptDeclaration( $js ); 305 } 306 }
titolo
Descrizione
Corpo
titolo
Descrizione
Corpo
titolo
Descrizione
Corpo
titolo
Corpo
| Generato il: Mon Oct 19 20:29:27 2009 | Generato con PHPXref 0.7 |