Source for file icons.php

Documentation is available at icons.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Libraries
  4.  * @subpackage  HTML
  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.txt
  8.  */
  9.  
  10. defined('JPATH_BASE'or die;
  11.  
  12. /**
  13.  * Utility class for icons.
  14.  *
  15.  * @package     Joomla.Libraries
  16.  * @subpackage  HTML
  17.  * @since       2.5
  18.  */
  19. abstract class JHtmlIcons
  20. {
  21.     /**
  22.      * Method to generate html code for a list of buttons
  23.      *
  24.      * @param   array  $buttons  Array of buttons
  25.      *
  26.      * @return  string 
  27.      *
  28.      * @since   2.5
  29.      */
  30.     public static function buttons($buttons)
  31.     {
  32.         $html array();
  33.         foreach ($buttons as $button)
  34.         {
  35.             $html[JHtml::_('icons.button'$button);
  36.         }
  37.         return implode($html);
  38.     }
  39.  
  40.     /**
  41.      * Method to generate html code for a list of buttons
  42.      *
  43.      * @param   array  $button  Button properties
  44.      *
  45.      * @return  string 
  46.      *
  47.      * @since   2.5
  48.      */
  49.     public static function button($button)
  50.     {
  51.         if (isset($button['access']))
  52.         {
  53.             if (is_bool($button['access']))
  54.             {
  55.                 if ($button['access'== false)
  56.                 {
  57.                     return '';
  58.                 }
  59.             }
  60.             else
  61.             {
  62.                 // Get the user object to verify permissions
  63.                 $user JFactory::getUser();
  64.  
  65.                 // Take each pair of permission, context values.
  66.                 for ($i 0$n count($button['access'])$i $n$i += 2)
  67.                 {
  68.                     if (!$user->authorise($button['access'][$i]$button['access'][$i 1]))
  69.                     {
  70.                         return '';
  71.                     }
  72.                 }
  73.             }
  74.         }
  75.  
  76.         // Instantiate a new JLayoutFile instance and render the layout
  77.         $layout new JLayoutFile('joomla.quickicons.icon');
  78.         return $layout->render($button);
  79.     }
  80. }

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