Your IP : 216.73.216.209


Current Path : /home/megadansyp/www/administrator/components/com_eventgallery/models/fields/
Upload File :
Current File : /home/megadansyp/www/administrator/components/com_eventgallery/models/fields/imagetypeset.php

<?php

/**
 * @package     Sven.Bluege
 * @subpackage  com_eventgallery
 *
 * @copyright   Copyright (C) 2005 - 2019 Sven Bluege All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

jimport('joomla.form.formfield');

// The class name must always be the same as the filename (in camel case)
class JFormFieldImagetypeset extends \Joomla\CMS\Form\FormField
{

    //The field class must know its own type through the variable $type.
    protected $type = 'imagetypeset';


    public function getInput()
    {
        /**
         * @var EventgalleryLibraryFactoryImagetypeset $imagetypesetFactory
         */

        $imagetypesetFactory = EventgalleryLibraryFactoryImagetypeset::getInstance();

        $imagetypesets = $imagetypesetFactory->getImageTypeSets(true);
        $showForFile = $this->getAttribute('showforfile');

        if (!$showForFile) {
            if ($this->value == null && $imagetypesetFactory->getDefaultImageTypeSet(false) != null) {
                $this->value = $imagetypesetFactory->getDefaultImageTypeSet(false)->getId();
            }
        }

        $return  = '<select class="form-control" name='.$this->name.' id='.$this->id.'>';

        if ($showForFile) {
            $return .= '<option value="-1">' . JText::_('COM_EVENTGALLERY_FILE_IMAGETYPESET_USE_PARENT') . '</option>';
        }

        foreach($imagetypesets as $imagetypeset) {
            /**
             * @var EventgalleryLibraryImagetypeset $imagetypeset
             */

            $this->value==$imagetypeset->getId()?$selected='selected="selected"':$selected ='';

            $return .= '<option '.$selected.' value="'.$imagetypeset->getId().'">'.$imagetypeset->getName().'</option>';
        }
        $return .= "</select>";
        return $return;

    }
}