/** * add items category select */ public function addItemsCategorySelect($name = "category", $title = null, $isNewGallery = false) { if ($title == null) { $title = __("Item Category", UNITEGALLERY_TEXTDOMAIN); } $objCategories = new UniteGalleryCategories(); $addType = "empty"; if ($isNewGallery == true) { $addType = "new"; } $arrCats = $objCategories->getCatsShort($addType); //set selected category if ($isNewGallery == true) { $defaultCat = "new"; } else { $defaultCat = UniteFunctionsUG::getFirstNotEmptyKey($arrCats); } $this->addSelect($name, $arrCats, $title, $defaultCat); }
$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"); }
<?php defined('_JEXEC') or die('Restricted access'); $settingsMain = new UniteGallerySettingsUG(); $settingsMain->addRadioBoolean("enable_category_tabs", __("Enable Category Tabs", UNITEGALLERY_TEXTDOMAIN), false); $settingsMain->addHr(); $settingsMain->addRadio("tabs_type", array("tabs" => "Tabs", "select" => "Select Box"), __("Category Tabs Type", UNITEGALLERY_TEXTDOMAIN), "tabs"); $settingsMain->addHr(); //add categories select $objCategories = new UniteGalleryCategories(); $arrCats = $objCategories->getCatsShort(); $settingsMain->addSelect("available_cats", $arrCats, __("Available Categories", UNITEGALLERY_TEXTDOMAIN), ""); $settingsMain->addTextBox("categorytabs_ids", "", "Hidden Cats", array("hidden" => true)); $settingsMain->addSelect("tabs_init_catid", array(), __("First Selected Tab", UNITEGALLERY_TEXTDOMAIN), "");
/** * * 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 } }