Commit d2fe1312 authored by sylvieg's avatar sylvieg

[ENH]banner: now pref to display a banner of a zone except in some URIs

parent 11b88601
......@@ -1450,6 +1450,7 @@ installer/schema/20110419_kill_old_search_tiki.sql -text
installer/schema/20110420_newsletter_optional_group_inclusion_tiki.sql -text
installer/schema/20110421_compact_search_in_topbar_tiki.sql -text
installer/schema/20110507_remove_module_style_params_tiki.sql -text
installer/schema/20110513_banner_tiki.sql -text
installer/schema/99999999_image_plugins_kill_tiki.php -text
installer/schema/index.php -text
installer/shell.php -text
......
......@@ -216,6 +216,7 @@ CREATE TABLE `tiki_banners` (
`clicks` int(8) default NULL,
`zone` varchar(40) default NULL,
`onlyInURIs` text,
`exceptInURIs` text,
PRIMARY KEY (`bannerId`),
INDEX ban1(zone,`useDates`,impressions,`maxImpressions`,`hourFrom`,`hourTo`,`fromDate`,`toDate`,mon,tue,wed,thu,fri,sat,sun)
) ENGINE=MyISAM AUTO_INCREMENT=1 ;
......
ALTER TABLE `tiki_banners` ADD `exceptInURIs` text;
\ No newline at end of file
......@@ -40,7 +40,8 @@ class BannerLib extends TikiLib
$query = "select `bannerId` from `tiki_banners` where `$dw` = ? and `hourFrom`<=? and `hourTo`>=? and
( ((`useDates` = ?) and (`fromDate`<=? and `toDate`>=?)) or (`useDates` = ?) ) and
(`impressions`<`maxImpressions` or `maxImpressions`=?) and (`clicks`<`maxClicks` or `maxClicks`=? or `maxClicks` is NULL) and `zone`=? $mid";
(`impressions`<`maxImpressions` or `maxImpressions`=?) and (`clicks`<`maxClicks` or `maxClicks`=? or `maxClicks` is NULL) and `zone`=? $mid and (`exceptInURIs` not like ? or `exceptInURIs` IS NULL)";
$bindvars[] = '%#'.$_SERVER['REQUEST_URI'].'#%';
$query1 = "$query and `onlyInURIs` like ? order by ".$this->convertSortMode('random');
$result = $this->query($query1, array_merge($bindvars, array('%#'.$_SERVER['REQUEST_URI'].'#%')), 1, 0);
......@@ -229,7 +230,7 @@ class BannerLib extends TikiLib
function replace_banner($bannerId, $client, $url, $title = '', $alt = '', $use, $imageData, $imageType, $imageName, $HTMLData,
$fixedURLData, $textData, $fromDate, $toDate, $useDates, $mon, $tue, $wed, $thu, $fri, $sat, $sun, $hourFrom, $hourTo,
$maxImpressions, $maxClicks,$zone,$maxUserImpressions=-1, $onlyInURIs=null
$maxImpressions, $maxClicks,$zone,$maxUserImpressions=-1, $onlyInURIs=null, $exceptInURIs=null
) {
$imageData = urldecode($imageData);
//$imageData = '';
......@@ -255,11 +256,11 @@ class BannerLib extends TikiLib
`hourFrom` = ?,
`hourTo` = ?,
`mon` = ? ,`tue` = ?, `wed` = ?, `thu` = ?, `fri` = ?, `sat` = ?, `sun` = ?,
`maxImpressions` = ?, `maxUserImpressions`=?, `maxClicks` = ?, `onlyInURIs`=? where `bannerId`=?";
`maxImpressions` = ?, `maxUserImpressions`=?, `maxClicks` = ?, `onlyInURIs`=?, `exceptInURIs`=? where `bannerId`=?";
$bindvars=array($client,$url,$title,$alt,$use,$imageData,$imageType,$imageName,$HTMLData,
$fixedURLData, $textData, $fromDate, $toDate, $useDates,$this->now,$zone,$hourFrom,$hourTo,
$mon,$tue,$wed,$thu,$fri,$sat,$sun,$maxImpressions,$maxUserImpressions,$maxClicks,$onlyInURIs, $bannerId);
$mon,$tue,$wed,$thu,$fri,$sat,$sun,$maxImpressions,$maxUserImpressions,$maxClicks,$onlyInURIs, $exceptInURIs, $bannerId);
$result = $this->query($query,$bindvars);
......@@ -274,14 +275,14 @@ class BannerLib extends TikiLib
} else {
$query = "insert into `tiki_banners`(`client`, `url`, `title`, `alt`, `which`, `imageData`, `imageType`, `HTMLData`,
`fixedURLData`, `textData`, `fromDate`, `toDate`, `useDates`, `mon`, `tue`, `wed`, `thu`, `fri`, `sat`, `sun`,
`hourFrom`, `hourTo`, `maxImpressions`,`maxUserImpressions`,`maxClicks`,`created`,`zone`,`imageName`,`impressions`,`clicks`, `onlyInURIs`)
`hourFrom`, `hourTo`, `maxImpressions`,`maxUserImpressions`,`maxClicks`,`created`,`zone`,`imageName`,`impressions`,`clicks`, `onlyInURIs`, `exceptInURIs`)
values(?,?,?,?,?,?,?,?,?,
?,?,?,?,?,?,?,?,?,
?,?,?,?,?,?,?,?,?,?,?,?,?)";
?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$bindvars=array($client,$url,$title,$alt,$use,$imageData,$imageType,$HTMLData,
$fixedURLData, $textData, $fromDate, $toDate, $useDates, $mon,$tue,$wed,$thu,
$fri,$sat,$sun,$hourFrom,$hourTo,$maxImpressions,$maxUserImpressions,$maxClicks,$this->now,$zone,$imageName,0,0, $onlyInURIs);
$fri,$sat,$sun,$hourFrom,$hourTo,$maxImpressions,$maxUserImpressions,$maxClicks,$this->now,$zone,$imageName,0,0, $onlyInURIs, $exceptInURIs);
$result = $this->query($query,$bindvars);
......
......@@ -47,6 +47,10 @@
<td>{tr}URIs where the banner appears only{/tr}</td>
<td><input type="text" name="onlyInURIs" value="{$onlyInURIs|escape}" /><br /><i>Type each URI enclosed with the # character. Exemple:#/this_page#/tiki-index.php?page=this_page#</i>
</tr>
<tr>
<td>{tr}URIs where the banner will not appear {/tr}</td>
<td><input type="text" name="exceptInURIs" value="{$exceptInURIs|escape}" /><br /><i>Type each URI enclosed with the # character. Exemple:#/this_page#/tiki-index.php?page=this_page#</i>
</tr>
<tr>
<td>{tr}Zone:{/tr}</td>
<td>
......
......@@ -60,6 +60,7 @@ if (isset($_REQUEST["bannerId"]) && $_REQUEST["bannerId"] > 0) {
$smarty->assign("Dsun", $info["sun"]);
$smarty->assign("use", $info["which"]);
$smarty->assign('onlyInURIs', $info['onlyInURIs']);
$smarty->assign('exceptInURIs', $info['exceptInURIs']);
$smarty->assign("zone", $info["zone"]);
if ($info["which"] == 'useFlash') {
$movie = unserialize($info['HTMLData']);
......@@ -110,6 +111,7 @@ if (isset($_REQUEST["bannerId"]) && $_REQUEST["bannerId"] > 0) {
$smarty->assign('bannerId', 0);
$smarty->assign('zone', '');
$smarty->assign('onlyInURIS', '');
$smarty->assign('exceptInURIS', '');
$smarty->assign('use', 'useHTML');
$smarty->assign('HTMLData', '');
$smarty->assign('fixedURLData', '');
......@@ -158,6 +160,7 @@ if (isset($_REQUEST["save"]) || isset($_REQUEST["create_zone"])) {
$smarty->assign('zone', '');
}
$smarty->assign('onlyInURIs', $_REQUEST['onlyInURIs']);
$smarty->assign('exceptInURIs', $_REQUEST['exceptInURIs']);
$smarty->assign('url', $_REQUEST["url"]);
if (isset($_REQUEST["use"])) {
......@@ -307,7 +310,7 @@ if (isset($_REQUEST["save"]) || isset($_REQUEST["create_zone"])) {
$bannerId = $bannerlib->replace_banner($_REQUEST["bannerId"], $_REQUEST["client"], $_REQUEST["url"], '',
'', $_REQUEST["use"], $_REQUEST["imageData"], $_REQUEST["imageType"], $_REQUEST["imageName"], $_REQUEST["HTMLData"],
$_REQUEST["fixedURLData"], $_REQUEST["textData"], $fromDate, $toDate, $useDates, $Dmon, $Dtue, $Dwed, $Dthu, $Dfri,
$Dsat, $Dsun, $fromTime, $toTime, $_REQUEST["maxImpressions"],$_REQUEST["maxClicks"], $_REQUEST["zone"], $_REQUEST["maxUserImpressions"], $_REQUEST['onlyInURIs']);
$Dsat, $Dsun, $fromTime, $toTime, $_REQUEST["maxImpressions"],$_REQUEST["maxClicks"], $_REQUEST["zone"], $_REQUEST["maxUserImpressions"], $_REQUEST['onlyInURIs'], $_REQUEST['exceptInURIs']);
header("location:tiki-list_banners.php");
......
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