Viewing file: banner-zone.php (12.28 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php // $Revision: 1.21 $
/************************************************************************/
/* phpAdsNew 2 */
/* =========== */
/* */
/* Copyright (c) 2001 by the phpAdsNew developers */
/* http://sourceforge.net/projects/phpadsnew */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
// Include required files
require ("config.php");
require ("lib-statistics.inc.php");
require ("lib-zones.inc.php");
require ("lib-size.inc.php");
// Security check
phpAds_checkAccess(phpAds_Admin);
/*********************************************************/
/* Process submitted form */
/*********************************************************/
if (isset($submit))
{
if (isset($previouszone) && is_array($previouszone))
{
for (reset($previouszone);$key=key($previouszone);next($previouszone))
{
if (($previouszone[$key] == 't' && $includezone[$key] != 't') or
($previouszone[$key] != 't' && $includezone[$key] == 't'))
{
phpAds_ToggleBannerInZone ($bannerid, $key);
}
}
}
}
/*********************************************************/
/* HTML framework */
/*********************************************************/
$res = phpAds_dbQuery("
SELECT
*
FROM
".$phpAds_config['tbl_banners']."
WHERE
clientid = $campaignid
");
while ($row = phpAds_dbFetchArray($res))
{
phpAds_PageContext (
phpAds_buildBannerName ($row['bannerid'], $row['description'], $row['alt']),
"banner-zone.php?clientid=".$clientid."&campaignid=".$campaignid."&bannerid=".$row['bannerid'],
$bannerid == $row['bannerid']
);
}
phpAds_PageShortcut($strClientProperties, 'client-edit.php?clientid='.$clientid, 'images/icon-client.gif');
phpAds_PageShortcut($strCampaignProperties, 'campaign-edit.php?clientid='.$clientid.'&campaignid='.$campaignid, 'images/icon-campaign.gif');
phpAds_PageShortcut($strBannerHistory, 'stats-banner-history.php?clientid='.$clientid.'&campaignid='.$campaignid.'&bannerid='.$bannerid, 'images/icon-statistics.gif');
$extra = "<form action='banner-modify.php'>";
$extra .= "<input type='hidden' name='clientid' value='$clientid'>";
$extra .= "<input type='hidden' name='campaignid' value='$campaignid'>";
$extra .= "<input type='hidden' name='bannerid' value='$bannerid'>";
$extra .= "<input type='hidden' name='returnurl' value='banner-zone.php'>";
$extra .= "<br><br>";
$extra .= "<b>$strModifyBanner</b><br>";
$extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>";
$extra .= "<img src='images/icon-duplicate-banner.gif' align='absmiddle'> <a href='banner-modify.php?clientid=".$clientid."&campaignid=".$campaignid."&bannerid=".$bannerid."&duplicate=true&returnurl=banner-zone.php'>$strDuplicate</a><br>";
$extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>";
$extra .= "<img src='images/icon-move-banner.gif' align='absmiddle'> $strMoveTo<br>";
$extra .= "<img src='images/spacer.gif' height='1' width='160' vspace='2'><br>";
$extra .= " ";
$extra .= "<select name='moveto' style='width: 110;'>";
$res = phpAds_dbQuery("SELECT * FROM ".$phpAds_config['tbl_clients']." WHERE parent != 0 AND clientid != ".$campaignid."") or phpAds_sqlDie();
while ($row = phpAds_dbFetchArray($res))
$extra .= "<option value='".$row['clientid']."'>".phpAds_buildClientName($row['clientid'], $row['clientname'])."</option>";
$extra .= "</select> <input type='image' name='moveto' src='images/".$phpAds_TextDirection."/go_blue.gif'><br>";
$extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>";
$extra .= "<img src='images/icon-recycle.gif' align='absmiddle'> <a href='banner-delete.php?clientid=".$clientid."&campaignid=".$campaignid."&bannerid=".$bannerid."&returnurl=campaign-index.php'".phpAds_DelConfirm($strConfirmDeleteBanner).">$strDelete</a><br>";
$extra .= "</form>";
$sections = array ("4.1.3.4.2");
if ($phpAds_config['acl']) $sections[] = "4.1.3.4.3";
$sections[] = "4.1.3.4.4";
phpAds_PageHeader("4.1.3.4.4", $extra);
echo "<img src='images/icon-client.gif' align='absmiddle'> ".phpAds_getParentName($campaignid);
echo " <img src='images/".$phpAds_TextDirection."/caret-rs.gif'> ";
echo "<img src='images/icon-campaign.gif' align='absmiddle'> ".phpAds_getClientName($campaignid);
echo " <img src='images/".$phpAds_TextDirection."/caret-rs.gif'> ";
echo "<img src='images/icon-banner-stored.gif' align='absmiddle'> <b>".phpAds_getBannerName($bannerid)."</b><br><br>";
echo phpAds_buildBannerCode($bannerid)."<br><br><br><br>";
phpAds_ShowSections($sections);
/*********************************************************/
/* Main code */
/*********************************************************/
?>
<script language='Javascript'>
<!--
function toggleZones()
{
var args=toggleZones.arguments;
affiliateid = args[0];
allchecked = true;
for (var i=0; i<document.zones.elements.length; i++)
{
if (document.zones.elements[i].name == 'affiliate[' + affiliateid + ']')
{
if (document.zones.elements[i].checked == false)
{
allchecked = false;
}
}
}
for (i=1; i<(args.length); i++)
{
zoneid = args[i];
for (var j=0; j<document.zones.elements.length; j++)
{
if (document.zones.elements[j].name == 'includezone[' + zoneid + ']')
{
document.zones.elements[j].checked = allchecked;
}
}
}
}
function toggleAffiliate()
{
var args=toggleAffiliate.arguments;
allchecked = true;
for (i=1; i<(args.length); i++)
{
zoneid = args[i];
for (var j=0; j<document.zones.elements.length; j++)
{
if (document.zones.elements[j].name == 'includezone[' + zoneid + ']')
{
if (document.zones.elements[j].checked == false)
{
allchecked = false;
}
}
}
}
affiliateid = args[0];
for (var i=0; i<document.zones.elements.length; i++)
{
if (document.zones.elements[i].name == 'affiliate[' + affiliateid + ']')
{
document.zones.elements[i].checked = allchecked;
}
}
}
//-->
</script>
<?php
$res = phpAds_dbQuery ("
SELECT
affiliateid,
name
FROM
".$phpAds_config['tbl_affiliates']."
ORDER BY
affiliateid
") or phpAds_sqlDie();
$affiliate_count = phpAds_dbNumRows($res);
while ($row = phpAds_dbFetchArray($res))
{
$affiliates[$row['affiliateid']] = $row;
}
$res = phpAds_dbQuery("
SELECT
z.zoneid as zoneid,
z.affiliateid as affiliateid,
z.zonename as zonename,
z.description as description,
z.width as width,
z.height as height,
z.what as what
FROM
".$phpAds_config['tbl_zones']." AS z,
".$phpAds_config['tbl_banners']." AS b
WHERE
b.bannerid = $bannerid AND
(z.width = b.width OR z.width = -1) AND
(z.height = b.height OR z.height = -1) AND
z.zonetype = ".phpAds_ZoneBanners."
ORDER BY
z.affiliateid, z.zoneid
") or phpAds_sqlDie();
$zone_count = phpAds_dbNumRows($res);
while ($row = phpAds_dbFetchArray($res))
{
if (isset($affiliates[$row['affiliateid']]))
{
$row['linked'] = (phpAds_IsBannerInZone ($bannerid, $row['zoneid']));
$affiliates[$row['affiliateid']]['zones'][$row['zoneid']] = $row;
}
}
echo "<br><br>";
echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
echo "<form name='zones' action='banner-zone.php' method='post'>";
echo "<input type='hidden' name='clientid' value='".$clientid."'>";
echo "<input type='hidden' name='campaignid' value='".$campaignid."'>";
echo "<input type='hidden' name='bannerid' value='".$bannerid."'>";
echo "<tr height='25'>";
echo "<td height='25' width='40%'><b> ".$GLOBALS['strName']."</b></td>";
echo "<td height='25'><b>".$GLOBALS['strID']."</b> </td>";
echo "<td height='25'><b>".$GLOBALS['strDescription']."</b> </td>";
echo "</tr>";
echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
if ($zone_count > 0 && $affiliate_count > 0)
{
$i=0;
for (reset($affiliates); $akey = key($affiliates); next($affiliates))
{
$affiliate = $affiliates[$akey];
if (isset($affiliate['zones']))
{
$zones = $affiliate['zones'];
if ($i > 0) echo "<td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td>";
echo "<tr height='25' ".($i%2==0?"bgcolor='#F6F6F6'":"").">";
$zoneids = array();
$zoneslinked = 0;
for (reset($zones); $zkey = key($zones); next($zones))
{
$zoneids[] = $zones[$zkey]['zoneid'];
if ($zones[$zkey]['linked']) $zoneslinked++;
}
echo "<td height='25'>";
if (count($zones) == $zoneslinked)
echo " <input name='affiliate[".$affiliate['affiliateid']."]' type='checkbox' value='t' checked ";
else
echo " <input name='affiliate[".$affiliate['affiliateid']."]' type='checkbox' value='t' ";
echo "onClick='toggleZones(".$affiliate['affiliateid'].",".implode(',', $zoneids).");'>";
echo " <img src='images/icon-affiliate.gif' align='absmiddle'> ";
echo "<a href='affiliate-edit.php?affiliateid=".$affiliate['affiliateid']."'>".$affiliate['name']."</a>";
echo " ";
echo "</td>";
// ID
echo "<td height='25'>".$affiliate['affiliateid']."</td>";
// Description
echo "<td height='25'> </td>";
echo "</tr>";
for (reset($zones); $zkey = key($zones); next($zones))
{
$zone = $zones[$zkey];
echo "<td ".($i%2==0?"bgcolor='#F6F6F6'":"")."><img src='images/spacer.gif' height=1'></td>";
echo "<td colspan='3' bgcolor='#888888'><img src='images/break-l.gif' height='1' width='100%'></td>";
echo "<tr height='25' ".($i%2==0?"bgcolor='#F6F6F6'":"").">";
echo "<td height='25'>";
echo " ";
if ($zone['linked'])
echo " <input name='includezone[".$zone['zoneid']."]' type='checkbox' value='t' checked ";
else
echo " <input name='includezone[".$zone['zoneid']."]' type='checkbox' value='t' ";
echo "onClick='toggleAffiliate(".$affiliate['affiliateid'].",".implode(',', $zoneids).");'>";
echo "<input type='hidden' name='previouszone[".$zone['zoneid']."]' value='".($zone['linked'] ? 't' : 'f')."'>";
echo " <img src='images/icon-zone.gif' align='absmiddle'> ";
echo "<a href='zone-edit.php?affiliateid=".$affiliate['affiliateid']."&zoneid=".$zone['zoneid']."'>".$zone['zonename']."</a>";
echo " ";
echo "</td>";
// ID
echo "<td height='25'>".$zone['zoneid']."</td>";
// Description
echo "<td height='25'>".stripslashes($zone['description'])."</td>";
echo "</tr>";
}
$i++;
}
}
echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
}
else
{
echo "<tr height='25' bgcolor='#F6F6F6'>";
echo "<td colspan='4'>";
echo " ".$strNoZonesToLink;
echo "</td>";
echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
}
echo "</table>";
if (isset($affiliates) && count($affiliates) > 0)
{
echo "<br><br>";
echo "<input type='submit' name='submit' value='$strSaveChanges'>";
}
echo "</form>";
/*********************************************************/
/* HTML framework */
/*********************************************************/
phpAds_PageFooter();
?>
|