コード例 #1
0
 /**
  * 
  * init current gallery
  * for gallery view only
  */
 protected function initCurrentGallery()
 {
     switch (self::$view) {
         case GlobalsUG::VIEW_GALLERY:
         case GlobalsUG::VIEW_PREVIEW:
         case GlobalsUG::VIEW_CATEGORY_TABS:
         case GlobalsUG::VIEW_ADVANCED:
             $galleryID = UniteFunctionsUG::getPostGetVariable("id", "", UniteFunctionsUG::VALIDATE_NUMERIC_OR_EMPTY);
             break;
         case GlobalsUG::VIEW_ITEMS:
             $galleryID = UniteFunctionsUG::getPostGetVariable("galleryid", "", UniteFunctionsUG::VALIDATE_NUMERIC_OR_EMPTY);
             if (empty($galleryID)) {
                 return false;
             }
             break;
         default:
             return false;
             break;
     }
     $objGallery = "";
     if (!empty($galleryID)) {
         $objGallery = new UniteGalleryGallery();
         $objGallery->initByID($galleryID);
         $galleryTypeName = $objGallery->getTypeName();
     } else {
         $galleryTypeName = UniteFunctionsUG::getPostGetVariable("type");
     }
     self::initGalleryFramework($galleryTypeName, $galleryID);
 }
コード例 #2
0
 /**
  * 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);
     }
 }
コード例 #3
0
 /**
  * 
  * duplicate gallery from data
  */
 public function duplicateGalleryFromData($data)
 {
     $galleryID = UniteFunctionsUG::getVal($data, "galleryID");
     UniteFunctionsUG::validateNotEmpty($galleryID, "gallery id");
     $gallery = new UniteGalleryGallery();
     $gallery->initByID($galleryID);
     $gallery->duplicate();
 }
コード例 #4
0
 /**
  * get front html from data
  */
 public function getHtmlFrontFromData($data)
 {
     $catID = UniteFunctionsUG::getVal($data, "catid");
     $galleryID = UniteFunctionsUG::getVal($data, "galleryID");
     UniteFunctionsUG::validateNumeric($catID, "category id");
     if (empty($galleryID)) {
         UniteFunctionsUG::throwError("The gallery ID not given");
     }
     //get thumb resolution param from the gallery
     $gallery = new UniteGalleryGallery();
     $gallery->initByID($galleryID);
     //validate if enable categories
     $enableCatTabs = $gallery->getParam('enable_category_tabs');
     $enableCatTabs = UniteFunctionsUG::strToBool($enableCatTabs);
     if ($enableCatTabs == false) {
         UniteFunctionsUG::throwError("The tabs functionality disabled");
     }
     //check that the category id inside the params
     $params = $gallery->getParams();
     $tabCatIDs = $gallery->getParam("categorytabs_ids");
     $arrTabIDs = explode(",", $tabCatIDs);
     if (in_array($catID, $arrTabIDs) == false) {
         UniteFunctionsUG::throwError("Get items not alowed for this category");
     }
     //get thumb size
     $thumbSize = $gallery->getParam("thumb_resolution");
     $bigImageSize = $gallery->getParam("big_image_resolution");
     //get arrItems
     $arrItems = $this->getCatItems($catID);
     //get items html
     $htmlItems = $this->getItemsHtmlFront($arrItems, $thumbSize, $bigImageSize);
     return $htmlItems;
 }