/** * 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); }
/** * * init globals static vars by the gallery object */ public static function init(UniteGalleryGalleryType $galleryType, $objGallery, $galleryID) { self::$objGalleryType = new UniteGalleryGalleryType(); self::$objGalleryType = $galleryType; self::$galleryTypeName = self::$objGalleryType->getName(); self::$galleryTypeTitle = self::$objGalleryType->getTypeTitle(); self::$gallery = new UniteGalleryGallery(); self::$gallery = $objGallery; self::$galleryID = $galleryID; self::$type = self::$objGalleryType->getName(); self::$pathBase = self::$objGalleryType->getPathGallery(); self::$urlBase = self::$objGalleryType->getUrlGalleryBase(); self::$pathViews = self::$pathBase . "views/"; self::$pathTemplates = self::$pathViews . "templates/"; self::$pathSettings = self::$pathBase . "settings/"; self::$urlCss = self::$urlBase . "css/"; self::$urlJs = self::$urlBase . "js/"; self::$urlImages = self::$urlBase . "images/"; self::$isInited = true; }
/** * output some gallery by alias * mixed - alias or id * outputType - can be alias or ID * arrItems - alternative items */ public static function outputGallery($mixed, $catID = null, $outputType = "alias", $arrItems = null) { try { if ($mixed instanceof UniteGalleryGallery) { $objGallery = $mixed; } else { //init the gallery enviropment $objGallery = new UniteGalleryGallery(); if ($outputType == "alias") { $objGallery->initByAlias($mixed); } else { $objGallery->initByID($mixed); } } $galleryID = $objGallery->getID(); $objType = $objGallery->getObjType(); GlobalsUGGallery::init($objType, $objGallery, $galleryID); $filepathOutput = GlobalsUGGallery::$pathBase . "client_output.php"; UniteFunctionsUG::validateFilepath($filepathOutput); //require the gallery includes $filepathIncludes = GlobalsUGGallery::$pathBase . "includes.php"; if (file_exists($filepathIncludes)) { require_once $filepathIncludes; } $arrOptions = array(); $arrOptions["categoryid"] = ""; if ($catID && is_numeric($catID) && $catID > 0) { $arrOptions["categoryid"] = $catID; } if ($arrItems !== null) { $arrOptions["items"] = $arrItems; } //run the output require $filepathOutput; if (!isset($uniteGalleryOutput)) { UniteFunctionsUG::throwError("uniteGalleryOutput variable not found"); } return $uniteGalleryOutput; } catch (Exception $e) { $message = "<b>Unite Gallery Error:</b><br><br> " . $e->getMessage(); $operations = new UGOperations(); $operations->putModuleErrorMessage($message); } }