$outputMain = new UniteSettingsProductUG();
$outputParams = new UniteSettingsProductSidebarUG();
$filepathBeforeDraw = HelperGalleryUG::getPathView("settings_before_draw", false);
if ($isNewGallery) {
    $galleryTitle = GlobalsUGGallery::$galleryTypeTitle;
    $headerTitle = $galleryTitle . __(" - [settings]", UNITEGALLERY_TEXTDOMAIN);
    if (file_exists($filepathBeforeDraw)) {
        require_once $filepathBeforeDraw;
    }
    $outputMain->init($settingsMain);
    $outputParams->init($settingsParams);
    require HelperGalleryUG::getPathHelperTemplate("gallery_new");
} else {
    $galleryTitle = GlobalsUGGallery::$gallery->getTitle();
    $headerTitle = $galleryTitle . __(" - [settings]", UNITEGALLERY_TEXTDOMAIN);
    $galleryType = GlobalsUGGallery::$gallery->getTypeName();
    $arrValues = GlobalsUGGallery::$gallery->getParamsForSettings();
    //get categories select dialog
    $objCategories = new UniteGalleryCategories();
    $arrCats = $objCategories->getCatsShort("component");
    $htmlSelectCats = UniteFunctionsUG::getHTMLSelect($arrCats, "", "id='ds_select_cats'", true);
    //set setting values from the slider
    $settingsMain->setStoredValues($arrValues);
    $settingsParams->setStoredValues($arrValues);
    if (isset($filepathBeforeDraw) && file_exists($filepathBeforeDraw)) {
        require_once $filepathBeforeDraw;
    }
    $outputMain->init($settingsMain);
    $outputParams->init($settingsParams);
    require HelperGalleryUG::getPathHelperTemplate("gallery_edit");
}
    /**
     * 
     * the form
     */
    public function form($instance)
    {
        $galleries = new UniteGalleryGalleries();
        $arrGalleries = $galleries->getArrGalleriesShort();
        $galleryID = UniteFunctionsUG::getVal($instance, "unitegallery");
        if (empty($arrGalleries)) {
            echo __("No galleries found, Please create a gallery", UNITEGALLERY_TEXTDOMAIN);
        } else {
            $fieldCat = "unitegallery_cat";
            $fieldIDCat = $this->get_field_id($fieldCat);
            $fieldNameCat = $this->get_field_name($fieldCat);
            $categoryID = UniteFunctionsUG::getVal($instance, "unitegallery_cat");
            $objCategories = new UniteGalleryCategories();
            $arrCats = $objCategories->getCatsShort("component");
            $selectCats = UniteFunctionsUG::getHTMLSelect($arrCats, $categoryID, 'name="' . $fieldNameCat . '" id="' . $fieldIDCat . '"', true);
            //output gallries select
            $field = "unitegallery";
            $fieldID = $this->get_field_id($field);
            $fieldName = $this->get_field_name($field);
            $selectGalleries = UniteFunctionsUG::getHTMLSelect($arrGalleries, $galleryID, 'name="' . $fieldName . '" id="' . $fieldID . '"', true);
            ?>
				<div style="padding-top:10px;padding-bottom:10px;">
				
				<?php 
            _e("Title", UNITEGALLERY_TEXTDOMAIN);
            ?>
: 
				<input type="text" id="<?php 
            echo $this->get_field_id("title");
            ?>
" name="<?php 
            echo $this->get_field_name("title");
            ?>
" value="<?php 
            echo UniteFunctionsUG::getVal($instance, 'title');
            ?>
" />
				
				<br><br>
				
				<?php 
            _e("Choose Gallery", UNITEGALLERY_TEXTDOMAIN);
            ?>
: 
				<?php 
            echo $selectGalleries;
            ?>
				
				<br><br>
				<?php 
            _e("Choose Category", UNITEGALLERY_TEXTDOMAIN);
            ?>
: 
				
				<?php 
            echo $selectCats;
            ?>
				
				</div>
				
				<br>
			<?php 
        }
    }