コード例 #1
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);
     }
 }