Merge branch 'master' of ssh://gitolite@asdynamics.com:50005/projects/fdn2.git
This commit is contained in:
@@ -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){
|
||||
|
||||
@@ -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();
|
||||
?>
|
||||
<div id="<?php echo $cur;?>"><script type="text/javascript">$(document).ready(function () {bannerRoll('<?php echo $cur;?>',<?php echo $position;?>);});</script></div>
|
||||
<div id="<?php echo $cur;?>"><script type="text/javascript">$(document).ready(function () {bannerRoll('<?php echo $cur;?>',<?php echo $position;?>,<?php echo $category;?>);});</script></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
@@ -13,11 +13,22 @@ class BannerModel extends HasMediaModel{
|
||||
const POSITION_HEAD = 1;
|
||||
const POSITION_BODY = 2;
|
||||
|
||||
const GENERAL_CATEGORY = 0;
|
||||
|
||||
public static $BANNER_POSITIONS = array(
|
||||
self::POSITION_HEAD=>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);
|
||||
|
||||
@@ -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 {
|
||||
</div>
|
||||
<div class="middleBar">
|
||||
<div class="leftBanner topBanner mediaContent">
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?>
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_HEAD,$bannerCategory);?>
|
||||
<!-- <div id="topLeftBan"><script type="text/javascript">$(document).ready(function () {bannerRoll('topLeftBan');});</script></div> -->
|
||||
</div>
|
||||
<div class="logo"><a href="http://ifattidinapoli.com/index.php"><img src="images/logo_uff.png"></a></div>
|
||||
<div class="rightBanner topBanner mediaContent">
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?>
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_HEAD,$bannerCategory);?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottomBar" style="height:40px;width:1000px;"></div>
|
||||
@@ -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 {
|
||||
?>
|
||||
<div id="rightBarContainer" class="">
|
||||
<div class="rotoBanner">
|
||||
<div class="bannerContainer mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_BODY);?></div>
|
||||
<div class="bannerContainer mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_BODY);?></div>
|
||||
<div class="bannerContainer mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_BODY,$category);?></div>
|
||||
<div class="bannerContainer mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_BODY,$category);?></div>
|
||||
</div>
|
||||
<div class="reader">
|
||||
<div class="lastNews">
|
||||
@@ -429,8 +429,8 @@ class GUIHandler {
|
||||
</div>
|
||||
</div>
|
||||
<div class="rotoBanner not">
|
||||
<div class="bannerContainer mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_BODY);?></div>
|
||||
<div class="bannerContainer mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_BODY);?></div>
|
||||
<div class="bannerContainer mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_BODY,$category);?></div>
|
||||
<div class="bannerContainer mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_BODY,$category);?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user