| @@ -1,0 +1,36 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * @package VikBooking | |
| 4 | + * @subpackage com_vikbooking | |
| 5 | + * @author Alessio Gaggii - e4j - Extensionsforjoomla.com | |
| 6 | + * @copyright Copyright (C) 2018 e4j - Extensionsforjoomla.com. All rights reserved. | |
| 7 | + * @license GNU General Public License version 2 or later; see LICENSE | |
| 8 | + * @link https://vikwp.com | |
| 9 | + */ | |
| 10 | + | |
| 11 | +defined('ABSPATH') or die('No script kiddies please!'); | |
| 12 | + | |
| 13 | +jimport('joomla.form.formfield'); | |
| 14 | + | |
| 15 | +class JFormFieldVbroomid extends JFormField { | |
| 16 | + protected $type = 'vbroomid'; | |
| 17 | + | |
| 18 | + function getInput() { | |
| 19 | + $rooms=""; | |
| 20 | + $dbo = JFactory::getDBO(); | |
| 21 | + $q="SELECT `id`,`name` FROM `#__vikbooking_rooms` ORDER BY `#__vikbooking_rooms`.`name` ASC;"; | |
| 22 | + $dbo->setQuery($q); | |
| 23 | + $dbo->execute(); | |
| 24 | + if ($dbo->getNumRows() > 0) { | |
| 25 | + $allvbr=$dbo->loadAssocList(); | |
| 26 | + foreach($allvbr as $vbr) { | |
| 27 | + $rooms.='<option value="'.$vbr['id'].'"'.($this->value == $vbr['id'] ? " selected=\"selected\"" : "").'>'.$vbr['name'].'</option>'; | |
| 28 | + } | |
| 29 | + } | |
| 30 | + $html = '<select class="widefat" name="' . $this->name . '" >'; | |
| 31 | + $html .= '<option value="">--</option>'; | |
| 32 | + $html .= $rooms; | |
| 33 | + $html .='</select>'; | |
| 34 | + return $html; | |
| 35 | + } | |
| 36 | +} | |