Source for file slider.php

Documentation is available at slider.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Libraries
  4.  * @subpackage  Toolbar
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM'or die;
  11.  
  12. /**
  13.  * Renders a button to render an HTML element in a slider container
  14.  *
  15.  * @package     Joomla.Libraries
  16.  * @subpackage  Toolbar
  17.  * @since       3.0
  18.  */
  19. {
  20.     /**
  21.      * Button type
  22.      *
  23.      * @var    string 
  24.      */
  25.     protected $_name = 'Slider';
  26.  
  27.     /**
  28.      * Fetch the HTML for the button
  29.      *
  30.      * @param   string   $type     Unused string, formerly button type.
  31.      * @param   string   $name     Button name
  32.      * @param   string   $text     The link text
  33.      * @param   string   $url      URL for popup
  34.      * @param   integer  $width    Width of popup
  35.      * @param   integer  $height   Height of popup
  36.      * @param   string   $onClose  JavaScript for the onClose event.
  37.      *
  38.      * @return  string  HTML string for the button
  39.      *
  40.      * @since   3.0
  41.      */
  42.     public function fetchButton($type 'Slider'$name ''$text ''$url ''$width 640$height 480$onClose '')
  43.     {
  44.         JHtml::_('script''jui/cms.js'falsetrue);
  45.  
  46.         // Store all data to the options array for use with JLayout
  47.         $options array();
  48.         $options['text'JText::_($text);
  49.         $options['name'$name;
  50.         $options['class'$this->fetchIconClass($name);
  51.         $options['onClose''';
  52.  
  53.         $doTask $this->_getCommand($url);
  54.         $options['doTask''Joomla.setcollapse(\'' $doTask '\', \'' $name '\', \'' $height '\');';
  55.  
  56.         if ($onClose)
  57.         {
  58.             $options['onClose'' rel="{onClose: function() {' $onClose '}}"';
  59.         }
  60.  
  61.         // Instantiate a new JLayoutFile instance and render the layout
  62.         $layout new JLayoutFile('joomla.toolbar.slider');
  63.  
  64.         return $layout->render($options);
  65.     }
  66.  
  67.     /**
  68.      * Get the button id
  69.      *
  70.      * @param   string  $type  Button type
  71.      * @param   string  $name  Button name
  72.      *
  73.      * @return  string    Button CSS Id
  74.      *
  75.      * @since   3.0
  76.      */
  77.     public function fetchId($type$name)
  78.     {
  79.         return $this->_parent->getName('-slider-' $name;
  80.     }
  81.  
  82.     /**
  83.      * Get the JavaScript command for the button
  84.      *
  85.      * @param   string  $url  URL for popup
  86.      *
  87.      * @return  string  JavaScript command string
  88.      *
  89.      * @since   3.0
  90.      */
  91.     private function _getCommand($url)
  92.     {
  93.         if (substr($url04!== 'http')
  94.         {
  95.             $url JUri::base($url;
  96.         }
  97.  
  98.         return $url;
  99.     }
  100. }

Documentation generated on Tue, 19 Nov 2013 15:13:57 +0100 by phpDocumentor 1.4.3