/** * * init gallery by record */ public function initByRecord($record) { UniteFunctionsUG::validateNotEmpty($record, "record empty"); $this->id = UniteFunctionsUG::getVal($record, "id"); $this->title = UniteFunctionsUG::getVal($record, "title"); $this->alias = UniteFunctionsUG::getVal($record, "alias"); $this->ordering = UniteFunctionsUG::getVal($record, "ordering"); $this->type = UniteFunctionsUG::getVal($record, "type"); //set type title: if (!empty($this->type)) { try { UniteFunctionsUG::validateNotEmpty($this->type, "Gallery Type"); $objGalleries = new UniteGalleryGalleries(); $this->objType = $objGalleries->getGalleryTypeByName($this->type); $this->typeTitle = $this->objType->getTypeTitle(); $this->isTypeExists = true; } catch (Exception $e) { $this->isTypeExists = false; $this->typeTitle = $this->type . " - gallery type not exists!"; } } $this->arrParams = array(); $params = UniteFunctionsUG::getVal($record, "params"); if (!empty($params)) { $this->arrParams = (array) json_decode($params); } }
/** * init the gallery framework by type name */ protected static function initGalleryFramework($galleryTypeName, $galleryID = "") { $objGallery = ""; if (!empty($galleryID)) { $objGallery = new UniteGalleryGallery(); $objGallery->initByID($galleryID); $galleryTypeName = $objGallery->getTypeName(); } UniteFunctionsUG::validateNotEmpty($galleryTypeName, "Gallery Type Name"); $galleries = new UniteGalleryGalleries(); self::$currentGalleryType = new UniteGalleryGalleryType(); self::$currentGalleryType = $galleries->getGalleryTypeByName($galleryTypeName); GlobalsUGGallery::init(self::$currentGalleryType, $objGallery, $galleryID); }