Commit 2d7fa976 authored by tolleiv.nietsch's avatar tolleiv.nietsch

Added mode to "just" show all banners without duplicates - required to avoid...

Added mode to "just" show all banners without duplicates - required to avoid duplicates in the 2x2 block on the homepage

git-svn-id: http://svn.t3o.typo3.org/extensions/projects/t3org/randombanners/trunk@1697 e8cb78a8-64f2-4011-8042-bd1ea5058d47
parent 7de0f64e
......@@ -80,37 +80,41 @@ class Tx_Randombanners_Controller_BannerController extends Tx_Extbase_MVC_Contro
// get the last set of banners from session
$lastBanners = $GLOBALS['TSFE']->fe_user->getKey('ses', 'tx_randombanners');
$numberOfBannersShown = ($numberOfBannersShown?$numberOfBannersShown:$this->settings['numberOfBannersShown']);
// first round to get all banners not displayed the last time
foreach ($banners as $key => $banner) {
$banner->setLogo(Tx_ExtbaseDam_Utility_Dam::getOne('tx_randombanners_domain_model_banner', $banner->getUid(), 'tx_randombanner_dam_images'));
if (sizeof($newBanners) < $numberOfBannersShown) {
if (empty($lastBanners)) {
$newBanners[] = $banner;
} elseif (array_search($banner->getUid(), $lastBanners) === FALSE) {
$newBanners[] = $banner;
unset($banners[$key]);
$numberOfBannersShown = ($numberOfBannersShown!==0?$numberOfBannersShown:$this->settings['numberOfBannersShown']);
if ($numberOfBannersShown == -1) {
// just show all banners
$newBanners = $banners;
} else {
// first round to get all banners not displayed the last time
foreach ($banners as $key => $banner) {
if (sizeof($newBanners) < $numberOfBannersShown) {
if (empty($lastBanners)) {
$newBanners[] = $banner;
} elseif (array_search($banner->getUid(), $lastBanners) === FALSE) {
$newBanners[] = $banner;
unset($banners[$key]);
}
} else {
break;
}
} else {
break;
}
}
// second round to get some other banners if not enough banners in the list
foreach ($banners as $banner) {
if (sizeof($newBanners) < $numberOfBannersShown) {
if (!($banner->getLogo() instanceof Tx_Extbase_Domain_Model_Dam)) {
$banner->setLogo(Tx_ExtbaseDam_Utility_Dam::getOne('tx_randombanners_domain_model_banner', $banner->getUid(), 'tx_randombanner_dam_images'));
// second round to get some other banners if not enough banners in the list
foreach ($banners as $banner) {
if (sizeof($newBanners) < $numberOfBannersShown) {
$newBanners[] = $banner;
} else {
break;
}
$newBanners[] = $banner;
} else {
break;
}
}
foreach ($newBanners as $newBanner) {
if (!($newBanner->getLogo() instanceof Tx_Extbase_Domain_Model_Dam)) {
$newBanner->setLogo(Tx_ExtbaseDam_Utility_Dam::getOne('tx_randombanners_domain_model_banner', $newBanner->getUid(), 'tx_randombanner_dam_images'));
}
// get uids of all shown banners to save into session
$saveIntoSession[] = $newBanner->getUid();
......
......@@ -12,6 +12,10 @@ plugin.tx_randombanners {
}
}
[globalVar = TSFE:id = ${const.page.root}]
plugin.tx_randombanners.settings.numberOfBannersShown = -1
[global]
lib.misc.bannerWidget = USER
lib.misc.bannerWidget {
userFunc = tx_extbase_core_bootstrap->run
......
var banner_position_array = new Array();
function clickBanner(el) {
console.log('9');
$.ajax({
url: 'index.php?type=69&tx_randombanners_list[action]=show&tx_randombanners_list[banner]=' + parseInt($(el).attr('rel')) +'&tx_randombanners_list[controller]=Banner',
success: function(backData) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment