diff --git a/private/lib/AnalyticsHelper.php b/private/lib/AnalyticsHelper.php index b47f38e..00a4f4f 100644 --- a/private/lib/AnalyticsHelper.php +++ b/private/lib/AnalyticsHelper.php @@ -281,7 +281,7 @@ class AnalyticsHelper { * @param int $position * @param string $replaced id del banner rimpiazzato */ - public static function getBannerToShow($position, $replaced = null){ + public static function getBannerToShow($position, $replaced = null, $category = BannerModel::GENERAL_CATEGORY){ // Rimuovi il replaced dalla lista $shown = array(); $rval = null; @@ -306,7 +306,7 @@ class AnalyticsHelper { } } - $baseSearchArray = array("position"=>$position,"end"=>array('$gte'=>new MongoDate(strtotime("tomorrow")))); + $baseSearchArray = array("position"=>$position,"end"=>array('$gte'=>new MongoDate(strtotime("tomorrow"))),"categories"=>$category); // Prendi il primo dei "mai mostrati oggi" tra quelli non presenti nella pagina $todayPlusShown = array_merge($idList,$shown); if (sizeof($todayPlusShown)>0){ diff --git a/private/lib/BannerHelper.php b/private/lib/BannerHelper.php index 3a49f50..670ebdb 100644 --- a/private/lib/BannerHelper.php +++ b/private/lib/BannerHelper.php @@ -7,10 +7,14 @@ Creation Date: 11/mar/2016 class BannerHelper{ private static $INTERNAL_COUNT = 1; - public static function printBanner($position = BannerModel::POSITION_HEAD){ + public static function printBanner($position = BannerModel::POSITION_HEAD, $category = null){ + if (is_null($category)){ + $category = BannerModel::GENERAL_CATEGORY; + } + $cur = self::getPlaceholderId(); ?> -
+ array("label"=>"Testata"), self::POSITION_BODY=>array("label"=>"Corpo") ); + public function __construct($saveableObject = null){ + parent::__construct($saveableObject); + + if (!$this->hasProperty("categories")){ + $this->categories = array(self::GENERAL_CATEGORY); + } + } + + public function __set($attr,$value){ if (strcmp("type", $attr)==0 || strcmp("position", $attr)==0){ $value = intval($value); diff --git a/private/lib/gui/GUIHandler.php b/private/lib/gui/GUIHandler.php index afeaa76..e6e43f1 100644 --- a/private/lib/gui/GUIHandler.php +++ b/private/lib/gui/GUIHandler.php @@ -169,7 +169,7 @@ class GUIHandler { self::$onLoadEvents[] = $script; } - public static function generateHeadPublic(){ + public static function generateHeadPublic($bannerCategory = BannerModel::GENERAL_CATEGORY){ $mesi = array(1=>'Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre','Dicembre'); @@ -218,12 +218,12 @@ class GUIHandler { @@ -372,7 +372,7 @@ class GUIHandler { } - public static function generateRightBannerBlock(){ + public static function generateRightBannerBlock($category = BannerModel::GENERAL_CATEGORY){ $stats = GlobalVariables::get("dao")->aggregate("StatisticModel",PipelineHelper::getMostViewedOfLastDays(strtotime("-7 days"),5)); $idArray = array_map(function ($ele){ return new MongoId($ele["_id"]["notizia"]);}, $stats); @@ -405,8 +405,8 @@ class GUIHandler { ?>