Source for file help.php

Documentation is available at help.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 help popup window button
  14.  *
  15.  * @package     Joomla.Libraries
  16.  * @subpackage  Toolbar
  17.  * @since       3.0
  18.  */
  19. {
  20.     /**
  21.      * @var    string    Button type
  22.      */
  23.     protected $_name = 'Help';
  24.  
  25.     /**
  26.      * Fetches the button HTML code.
  27.      *
  28.      * @param   string   $type       Unused string.
  29.      * @param   string   $ref        The name of the help screen (its key reference).
  30.      * @param   boolean  $com        Use the help file in the component directory.
  31.      * @param   string   $override   Use this URL instead of any other.
  32.      * @param   string   $component  Name of component to get Help (null for current component)
  33.      *
  34.      * @return  string 
  35.      *
  36.      * @since   3.0
  37.      */
  38.     public function fetchButton($type 'Help'$ref ''$com false$override null$component null)
  39.     {
  40.         // Store all data to the options array for use with JLayout
  41.         $options array();
  42.         $options['text']   JText::_('JTOOLBAR_HELP');
  43.         $options['doTask'$this->_getCommand($ref$com$override$component);
  44.  
  45.         // Instantiate a new JLayoutFile instance and render the layout
  46.         $layout new JLayoutFile('joomla.toolbar.help');
  47.  
  48.         return $layout->render($options);
  49.     }
  50.  
  51.     /**
  52.      * Get the button id
  53.      *
  54.      * Redefined from JButton class
  55.      *
  56.      * @return  string    Button CSS Id
  57.      *
  58.      * @since   3.0
  59.      */
  60.     public function fetchId()
  61.     {
  62.         return $this->_parent->getName('-help';
  63.     }
  64.  
  65.     /**
  66.      * Get the JavaScript command for the button
  67.      *
  68.      * @param   string   $ref        The name of the help screen (its key reference).
  69.      * @param   boolean  $com        Use the help file in the component directory.
  70.      * @param   string   $override   Use this URL instead of any other.
  71.      * @param   string   $component  Name of component to get Help (null for current component)
  72.      *
  73.      * @return  string   JavaScript command string
  74.      *
  75.      * @since   3.0
  76.      */
  77.     protected function _getCommand($ref$com$override$component)
  78.     {
  79.         JHtml::_('behavior.framework');
  80.  
  81.         // Get Help URL
  82.         $url JHelp::createURL($ref$com$override$component);
  83.         $url htmlspecialchars($urlENT_QUOTES);
  84.         $cmd "Joomla.popupWindow('$url', 'JText::_('JHELP'true"', 700, 500, 1)";
  85.  
  86.         return $cmd;
  87.     }
  88. }

Documentation generated on Tue, 19 Nov 2013 15:04:14 +0100 by phpDocumentor 1.4.3