[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_banners 6 * 7 * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Banners\Administrator\Service\Html; 12 13 use Joomla\CMS\Factory; 14 use Joomla\CMS\HTML\HTMLHelper; 15 use Joomla\CMS\Language\Text; 16 use Joomla\Database\DatabaseAwareTrait; 17 18 // phpcs:disable PSR1.Files.SideEffects 19 \defined('_JEXEC') or die; 20 // phpcs:enable PSR1.Files.SideEffects 21 22 /** 23 * Banner HTML class. 24 * 25 * @since 2.5 26 */ 27 class Banner 28 { 29 use DatabaseAwareTrait; 30 31 /** 32 * Display a batch widget for the client selector. 33 * 34 * @return string The necessary HTML for the widget. 35 * 36 * @since 2.5 37 */ 38 public function clients() 39 { 40 // Create the batch selector to change the client on a selection list. 41 return implode( 42 "\n", 43 array( 44 '<label id="batch-client-lbl" for="batch-client-id">', 45 Text::_('COM_BANNERS_BATCH_CLIENT_LABEL'), 46 '</label>', 47 '<select class="form-select" name="batch[client_id]" id="batch-client-id">', 48 '<option value="">' . Text::_('COM_BANNERS_BATCH_CLIENT_NOCHANGE') . '</option>', 49 '<option value="0">' . Text::_('COM_BANNERS_NO_CLIENT') . '</option>', 50 HTMLHelper::_('select.options', static::clientlist(), 'value', 'text'), 51 '</select>' 52 ) 53 ); 54 } 55 56 /** 57 * Method to get the field options. 58 * 59 * @return array The field option objects. 60 * 61 * @since 1.6 62 */ 63 public function clientlist() 64 { 65 $db = $this->getDatabase(); 66 $query = $db->getQuery(true) 67 ->select( 68 [ 69 $db->quoteName('id', 'value'), 70 $db->quoteName('name', 'text'), 71 ] 72 ) 73 ->from($db->quoteName('#__banner_clients')) 74 ->order($db->quoteName('name')); 75 76 // Get the options. 77 $db->setQuery($query); 78 79 try { 80 $options = $db->loadObjectList(); 81 } catch (\RuntimeException $e) { 82 Factory::getApplication()->enqueueMessage($e->getMessage(), 'error'); 83 } 84 85 return $options; 86 } 87 88 /** 89 * Returns a pinned state on a grid 90 * 91 * @param integer $value The state value. 92 * @param integer $i The row index 93 * @param boolean $enabled An optional setting for access control on the action. 94 * @param string $checkbox An optional prefix for checkboxes. 95 * 96 * @return string The Html code 97 * 98 * @see HTMLHelperJGrid::state 99 * @since 2.5.5 100 */ 101 public function pinned($value, $i, $enabled = true, $checkbox = 'cb') 102 { 103 $states = array( 104 1 => array( 105 'sticky_unpublish', 106 'COM_BANNERS_BANNERS_PINNED', 107 'COM_BANNERS_BANNERS_HTML_PIN_BANNER', 108 'COM_BANNERS_BANNERS_PINNED', 109 true, 110 'publish', 111 'publish' 112 ), 113 0 => array( 114 'sticky_publish', 115 'COM_BANNERS_BANNERS_UNPINNED', 116 'COM_BANNERS_BANNERS_HTML_UNPIN_BANNER', 117 'COM_BANNERS_BANNERS_UNPINNED', 118 true, 119 'unpublish', 120 'unpublish' 121 ), 122 ); 123 124 return HTMLHelper::_('jgrid.state', $states, $value, $i, 'banners.', $enabled, true, $checkbox); 125 } 126 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |