PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.18
VikAppointments Services Booking Calendar v1.2.18
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / libraries / adapter / html / classes / list.php
vikappointments / libraries / adapter / html / classes Last commit date
access.php 6 months ago behavior.php 6 months ago bootstrap.php 6 months ago contentlanguage.php 6 months ago date.php 6 months ago form.php 6 months ago formbehavior.php 6 months ago grid.php 6 months ago jquery.php 6 months ago list.php 6 months ago number.php 6 months ago select.php 6 months ago user.php 6 months ago
list.php
67 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 * Utility class for list behaviors.
16 *
17 * @since 10.0
18 */
19 abstract class JHtmlList
20 {
21 /**
22 * Select list of active users.
23 *
24 * @param string $name The name of the field.
25 * @param string $active The active user.
26 * @param integer $nouser If set include an option to select no user.
27 * @param string $javascript Custom javascript.
28 * @param string $order Specify a field to order by.
29 *
30 * @return string The HTML for a list of users list of users.
31 */
32 public static function users($name, $active, $nouser = 0, $javascript = null, $order = 'display_name')
33 {
34 if (empty($order))
35 {
36 $order = 'name';
37 }
38
39 $select = '';
40
41 if ($nouser)
42 {
43 $select = $nouser ? "<option value=\"0\">--</option>" : '';
44 }
45
46 $dbo = JFactory::getDbo();
47
48 $q = "SELECT `id`, `display_name`
49 FROM `#__users`
50 ORDER BY `{$order}` ASC";
51
52 $dbo->setQuery($q);
53 $dbo->execute();
54
55 if ($dbo->getNumRows())
56 {
57 foreach ($dbo->loadObjectlist() as $u)
58 {
59 $status = $active == $u->id ? ' selected="selected"' : '';
60 $select .= "<option value=\"{$u->id}\"{$status}>{$u->display_name}</option>";
61 }
62 }
63
64 return "<select name=\"{$name}\" {$javascript}>{$select}</select>";
65 }
66 }
67