Source for file standard.php

Documentation is available at standard.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 standard button
  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 = 'Standard';
  26.  
  27.     /**
  28.      * Fetch the HTML for the button
  29.      *
  30.      * @param   string   $type  Unused string.
  31.      * @param   string   $name  The name of the button icon class.
  32.      * @param   string   $text  Button text.
  33.      * @param   string   $task  Task associated with the button.
  34.      * @param   boolean  $list  True to allow lists
  35.      *
  36.      * @return  string  HTML string for the button
  37.      *
  38.      * @since   3.0
  39.      */
  40.     public function fetchButton($type 'Standard'$name ''$text ''$task ''$list true)
  41.     {
  42.         // Store all data to the options array for use with JLayout
  43.         $options array();
  44.         $options['text'JText::_($text);
  45.         $options['class'$this->fetchIconClass($name);
  46.         $options['doTask'$this->_getCommand($options['text']$task$list);
  47.  
  48.         if ($name == 'apply' || $name == 'new')
  49.         {
  50.             $options['btnClass''btn btn-small btn-success';
  51.             $options['class'.= ' icon-white';
  52.         }
  53.         else
  54.         {
  55.             $options['btnClass''btn btn-small';
  56.         }
  57.  
  58.         // Instantiate a new JLayoutFile instance and render the layout
  59.         $layout new JLayoutFile('joomla.toolbar.standard');
  60.  
  61.         return $layout->render($options);
  62.     }
  63.  
  64.     /**
  65.      * Get the button CSS Id
  66.      *
  67.      * @param   string   $type      Unused string.
  68.      * @param   string   $name      Name to be used as apart of the id
  69.      * @param   string   $text      Button text
  70.      * @param   string   $task      The task associated with the button
  71.      * @param   boolean  $list      True to allow use of lists
  72.      * @param   boolean  $hideMenu  True to hide the menu on click
  73.      *
  74.      * @return  string  Button CSS Id
  75.      *
  76.      * @since   3.0
  77.      */
  78.     public function fetchId($type 'Standard'$name ''$text ''$task ''$list true$hideMenu false)
  79.     {
  80.         return $this->_parent->getName('-' $name;
  81.     }
  82.  
  83.     /**
  84.      * Get the JavaScript command for the button
  85.      *
  86.      * @param   string   $name  The task name as seen by the user
  87.      * @param   string   $task  The task used by the application
  88.      * @param   boolean  $list  True is requires a list confirmation.
  89.      *
  90.      * @return  string   JavaScript command string
  91.      *
  92.      * @since   3.0
  93.      */
  94.     protected function _getCommand($name$task$list)
  95.     {
  96.         JHtml::_('behavior.framework');
  97.         $message JText::_('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST');
  98.         $message addslashes($message);
  99.  
  100.         if ($list)
  101.         {
  102.             $cmd "if (document.adminForm.boxchecked.value==0){alert('$message');}else{ Joomla.submitbutton('$task')}";
  103.         }
  104.         else
  105.         {
  106.             $cmd "Joomla.submitbutton('$task')";
  107.         }
  108.  
  109.         return $cmd;
  110.     }
  111. }

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