Source for file banner.php

Documentation is available at banner.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_banners
  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.  * Banner HTML class.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_banners
  17.  * @since       2.5
  18.  */
  19. abstract class JHtmlBanner
  20. {
  21.     /**
  22.      * Display a batch widget for the client selector.
  23.      *
  24.      * @return  string  The necessary HTML for the widget.
  25.      *
  26.      * @since   2.5
  27.      */
  28.     public static function clients()
  29.     {
  30.         JHtml::_('bootstrap.tooltip');
  31.  
  32.         // Create the batch selector to change the client on a selection list.
  33.         $lines array(
  34.             '<label id="batch-client-lbl" for="batch-client" class="hasTooltip" title="' JHtml::tooltipText('COM_BANNERS_BATCH_CLIENT_LABEL''COM_BANNERS_BATCH_CLIENT_LABEL_DESC''">',
  35.             JText::_('COM_BANNERS_BATCH_CLIENT_LABEL'),
  36.             '</label>',
  37.             '<select name="batch[client_id]" class="inputbox" id="batch-client-id">',
  38.             '<option value="">' JText::_('COM_BANNERS_BATCH_CLIENT_NOCHANGE''</option>',
  39.             '<option value="0">' JText::_('COM_BANNERS_NO_CLIENT''</option>',
  40.             JHtml::_('select.options'static::clientlist()'value''text'),
  41.             '</select>'
  42.         );
  43.  
  44.         return implode("\n"$lines);
  45.     }
  46.  
  47.     /**
  48.      * Method to get the field options.
  49.      *
  50.      * @return  array  The field option objects.
  51.      * @since   1.6
  52.      */
  53.     public static function clientlist()
  54.     {
  55.         $db JFactory::getDbo();
  56.         $query $db->getQuery(true)
  57.             ->select('id As value, name As text')
  58.             ->from('#__banner_clients AS a')
  59.             ->order('a.name');
  60.  
  61.         // Get the options.
  62.         $db->setQuery($query);
  63.  
  64.         try
  65.         {
  66.             $options $db->loadObjectList();
  67.         }
  68.         catch (RuntimeException $e)
  69.         {
  70.             JError::raiseWarning(500$e->getMessage());
  71.         }
  72.  
  73.         return $options;
  74.     }
  75.  
  76.     /**
  77.      * Returns a pinned state on a grid
  78.      *
  79.      * @param   integer       $value            The state value.
  80.      * @param   integer       $i                The row index
  81.      * @param   boolean       $enabled        An optional setting for access control on the action.
  82.      * @param   string        $checkbox        An optional prefix for checkboxes.
  83.      *
  84.      * @return  string        The Html code
  85.      *
  86.      * @see JHtmlJGrid::state
  87.      *
  88.      * @since   2.5.5
  89.      */
  90.     public static function pinned($value$i$enabled true$checkbox 'cb')
  91.     {
  92.         $states array(
  93.             => array(
  94.                 'sticky_unpublish',
  95.                 'COM_BANNERS_BANNERS_PINNED',
  96.                 'COM_BANNERS_BANNERS_HTML_PIN_BANNER',
  97.                 'COM_BANNERS_BANNERS_PINNED',
  98.                 true,
  99.                 'publish',
  100.                 'publish'
  101.             ),
  102.             => array(
  103.                 'sticky_publish',
  104.                 'COM_BANNERS_BANNERS_UNPINNED',
  105.                 'COM_BANNERS_BANNERS_HTML_UNPIN_BANNER',
  106.                 'COM_BANNERS_BANNERS_UNPINNED',
  107.                 true,
  108.                 'unpublish',
  109.                 'unpublish'
  110.             ),
  111.         );
  112.  
  113.         return JHtml::_('jgrid.state'$states$value$i'banners.'$enabledtrue$checkbox);
  114.     }
  115.  
  116. }

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