Your IP : 216.73.216.240


Current Path : /home/j/u/v/juvelize/martine/administrator/components/com_easybookreloaded/models/fields/
Upload File :
Current File : /home/j/u/v/juvelize/martine/administrator/components/com_easybookreloaded/models/fields/ebrgb.php

<?php

/**
 * @copyright
 * @package    Easybook Reloaded - EBR for Joomla! 3.x
 * @author     Viktor Vogel <admin@kubik-rubik.de>
 * @version    3.4.1.1-FREE - 2021-08-29
 * @link       https://kubik-rubik.de/ebr-easybook-reloaded
 *
 * @license    GNU/GPL
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
defined('_JEXEC') || die('Restricted access');

use Joomla\CMS\{Form\FormField, Factory, HTML\HTMLHelper, Language\Text};

/**
 * Class JFormFieldEbrGb
 *
 * @since   3.4.0-FREE
 */
class JFormFieldEbrGb extends FormField
{
    /**
     * @var string $type
     * @since 3.4.0-FREE
     */
    protected $type = 'EbrGb';

    /**
     * @return mixed|string
     * @since 3.4.0-FREE
     */
    protected function getInput()
    {
        $db = Factory::getDbo();

        $query = "SELECT " . $db->quoteName('a.title') . " AS " . $db->quoteName('title') . ", " . $db->quoteName('a.id') . " AS " . $db->quoteName('gbid') . " FROM " . $db->quoteName('#__easybook_gb') . " AS " . $db->quoteName('a') . " ORDER BY " . $db->quoteName('a.id') . " ASC";

        $db->setQuery($query);
        $guestbooks = $db->loadObjectList();

        array_unshift($guestbooks, HTMLHelper::_('select.option', '0', Text::_('COM_EASYBOOKRELOADED_SELECT_GUESTBOOK_ALL'), 'gbid', 'title'));
        array_unshift($guestbooks, HTMLHelper::_('select.option', '', '- ' . Text::_('COM_EASYBOOKRELOADED_SELECT_GUESTBOOK') . ' -', 'gbid', 'title'));

        return HTMLHelper::_('select.genericlist', $guestbooks, $this->name, 'class="inputbox required"', 'gbid', 'title', $this->value, $this->id);
    }
}