PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / trunk
VikAppointments Services Booking Calendar vtrunk
trunk 1.2.17 1.2.18 1.2.19
vikappointments / libraries / adapter / html / classes / access.php
vikappointments / libraries / adapter / html / classes Last commit date
access.php 2 years ago behavior.php 5 months ago bootstrap.php 5 months ago contentlanguage.php 2 years ago date.php 1 month ago form.php 2 years ago formbehavior.php 5 months ago grid.php 2 years ago jquery.php 2 years ago list.php 2 years ago number.php 2 years ago select.php 2 years ago user.php 2 years ago
access.php
58 lines
1 <?php
2 /**
3 * @package VikWP - Libraries
4 * @subpackage adapter.html
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2023 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 /**
15 * Extended Utility class for all HTML drawing classes.
16 *
17 * @since 10.1.16
18 */
19 abstract class JHtmlAccess
20 {
21 /**
22 * Displays a list of the available access view levels
23 *
24 * @param string $name The form field name.
25 * @param string $selected The name of the selected section.
26 * @param string $attribs Additional attributes to add to the select field.
27 * @param mixed $params True to add "All Sections" option or an array of options.
28 * @param mixed $id The form field id or false if not used.
29 *
30 * @return string The required HTML for the SELECT tag.
31 */
32 public static function level($name, $selected, $attribs = '', $params = true, $id = false)
33 {
34 $options = array();
35 $options[] = JHtml::fetch('select.option', 1, JText::translate('JOPTION_ACCESS_PUBLIC'));
36 $options[] = JHtml::fetch('select.option', 5, JText::translate('JOPTION_ACCESS_GUEST'));
37 $options[] = JHtml::fetch('select.option', 2, JText::translate('JOPTION_ACCESS_REGISTERED'));
38 $options[] = JHtml::fetch('select.option', 3, JText::translate('JOPTION_ACCESS_SPECIAL'));
39 $options[] = JHtml::fetch('select.option', 6, JText::translate('JOPTION_ACCESS_SUPERUSER'));
40
41 // if params is an array, push these options to the array
42 if (is_array($params))
43 {
44 $options = array_merge($params, $options);
45 }
46 // if all levels is allowed, push it into the array.
47 else if ($params)
48 {
49 array_unshift($options, JHtml::fetch('select.option', '', JText::translate('JOPTION_ACCESS_SHOW_ALL_LEVELS')));
50 }
51
52 // generate select tag
53 return '<select name="' . $name . '"' . ($id ? ' id="' . $id . '"' : '') . ($attribs ? ' ' . $attribs : '') . '>'
54 . JHtml::fetch('select.options', $options, 'value', 'text', $selected)
55 . '</select>';
56 }
57 }
58