Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /joomla/html/tooltips.php

Documentation is available at tooltips.php

  1. <?php
  2. /**
  3. * @version        $Id: pane.php 6138 2007-01-02 03:44:18Z eddiea $
  4. * @package        Joomla.Framework
  5. * @subpackage    HTML
  6. * @copyright    Copyright (C) 2005 - 2007 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. function loadTooltips($selector='.hasTip', $params=array())
  16. {
  17.     static $tips;
  18.  
  19.     if (!isset($tips)) {
  20.         $tips = array();
  21.     }
  22.  
  23.     $sig = md5(serialize(array($selector,$params)));
  24.     if (isset($tips[$sig]) && ($tips[$sig])) {
  25.         return;
  26.     }
  27.  
  28.     // Setup options object
  29.     $options = '{';
  30.     $opt['maxTitleChars']    = (isset($params['maxTitleChars']) && ($params['maxTitleChars'])) ? (int)$params['maxTitleChars'] : 50 ;
  31.     $opt['timeOut']            = (isset($params['timeOut'])) ? (int)$params['timeOut'] : null;
  32.     $opt['showDelay']        = (isset($params['showDelay'])) ? (int)$params['showDelay'] : null;
  33.     $opt['hideDelay']        = (isset($params['hideDelay'])) ? (int)$params['hideDelay'] : null;
  34.     $opt['className']        = (isset($params['className'])) ? $params['className'] : null;
  35.     $opt['fixed']            = (isset($params['fixed']) && ($params['fixed'])) ? 'true' : 'false';
  36.     $opt['onShow']            = (isset($params['onShow'])) ? $params['onShow'] : null;
  37.     $opt['onHide']            = (isset($params['onHide'])) ? $params['onHide'] : null;
  38.     foreach ($opt as $k => $v)
  39.     {
  40.         if ($v) {
  41.             $options .= $k.': '.$v.',';
  42.         }
  43.     }
  44.     if (substr($options, -1) == ',') {
  45.         $options = substr($options, 0, -1);
  46.     }
  47.     $options .= '}';
  48.  
  49.     // Attach tooltips to document
  50.     $document =& JFactory::getDocument();
  51.     $tooltipInit = '        Window.onDomReady(function(){ var JTooltips = new Tips($$(\''.$selector.'\'), '.$options.'); });';
  52.     $document->addScriptDeclaration($tooltipInit);
  53.  
  54.     // Set static array
  55.     $tips[$sig] = true;
  56.     return;
  57. }
  58.  
  59. // Create the default tooltips
  60. ?>

Documentation generated on Mon, 05 Mar 2007 21:29:39 +0000 by phpDocumentor 1.3.1