function Plugin_CampaignhistoryExecute($campaignid, $delimiter = ",") { global $phpAds_config, $date_format; global $strCampaign, $strTotal, $strDay, $strViews, $strClicks, $strCTRShort; header("Content-type: application/csv\nContent-Disposition: \"inline; filename=campaignhistory.csv\""); $idresult = phpAds_dbQuery("\n\t\tSELECT\n\t\t\tbannerid\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\tWHERE\n\t\t\tcampaignid = '" . $campaignid . "'\n\t"); while ($row = phpAds_dbFetchArray($idresult)) { $bannerids[] = "bannerid = " . $row['bannerid']; } $res_query = "\n\t\tSELECT\n\t\t\tDATE_FORMAT(day, '" . $date_format . "') as day,\n\t\t\tSUM(views) AS adviews,\n\t\t\tSUM(clicks) AS adclicks\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_adstats'] . "\n\t\tWHERE\n\t\t\t(" . implode(' OR ', $bannerids) . ")\n\t\tGROUP BY\n\t\t\tday\n\t"; $res_banners = phpAds_dbQuery($res_query) or phpAds_sqlDie(); while ($row_banners = phpAds_dbFetchArray($res_banners)) { $stats[$row_banners['day']]['views'] = $row_banners['adviews']; $stats[$row_banners['day']]['clicks'] = $row_banners['adclicks']; } echo $strCampaign . ": " . strip_tags(phpAds_getCampaignName($campaignid)) . "\n\n"; echo $strDay . $delimiter . $strViews . $delimiter . $strClicks . $delimiter . $strCTRShort . "\n"; $totalclicks = 0; $totalviews = 0; if (isset($stats) && is_array($stats)) { for (reset($stats); $key = key($stats); next($stats)) { $row = array(); //$key = implode('/',array_reverse(split('[-]',$key))); $row[] = $key; $row[] = $stats[$key]['views']; $row[] = $stats[$key]['clicks']; $row[] = phpAds_buildCTR($stats[$key]['views'], $stats[$key]['clicks']); echo implode($delimiter, $row) . "\n"; $totalclicks += $stats[$key]['clicks']; $totalviews += $stats[$key]['views']; } } echo "\n"; echo $strTotal . $delimiter . $totalviews . $delimiter . $totalclicks . $delimiter . phpAds_buildCTR($totalviews, $totalclicks) . "\n"; }
$query = "SELECT clientid,clientname" . " FROM " . $phpAds_config['tbl_clients'] . " WHERE clientid!=" . $clientid . " AND agencyid=" . phpAds_getUserID(); } $res = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { $extra .= "\t\t\t\t\t<option value='" . $row['clientid'] . "'>" . phpAds_buildName($row['clientid'], $row['clientname']) . "</option>\n"; } $extra .= "\t\t\t\t</select> \n"; $extra .= "\t\t\t\t<input type='image' src='images/" . $phpAds_TextDirection . "/go_blue.gif'><br>\n"; $extra .= "\t\t\t\t<img src='images/break.gif' height='1' width='160' vspace='4'><br>\n"; $extra .= "\t\t\t\t<img src='images/icon-recycle.gif' align='absmiddle'>\n"; $extra .= "\t\t\t\t<a href='campaign-delete.php?clientid={$clientid}&campaignid={$campaignid}&returnurl=advertiser-campaigns.php'" . phpAds_DelConfirm($strConfirmDeleteTracker) . ">{$strDelete}</a><br>\n"; $extra .= "\t\t\t\t</form>\n"; phpAds_PageHeader("4.1.3.5", $extra); echo "<img src='images/icon-advertiser.gif' align='absmiddle'> " . phpAds_getParentClientName($campaignid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-campaign.gif' align='absmiddle'> <b>" . phpAds_getCampaignName($campaignid) . "</b><br><br><br>"; phpAds_ShowSections(array("4.1.3.2", "4.1.3.3", "4.1.3.4", "4.1.3.5")); } if (isset($campaignid) && $campaignid != '') { $res = phpAds_dbQuery("SELECT *" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE campaignid=" . $campaignid) or phpAds_sqlDie(); if (phpAds_dbNumRows($res)) { $campaign = phpAds_dbFetchArray($res); } } $tabindex = 1; // Header echo "\t\t\t\t<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>\n"; echo "\t\t\t\t<tr height='25'>\n"; echo "\t\t\t\t\t<td height='25' width='40%'>\n"; echo "\t\t\t\t\t\t<b> <a href='campaign-trackers.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&listorder=name'>" . $GLOBALS['strName'] . "</a>"; if ($listorder == "name" || $listorder == "") {
phpAds_PageContext(phpAds_buildBannerName($row['bannerid'], $row['description'], $row['alt']), "banner-edit.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&bannerid=" . $row['bannerid'], $bannerid == $row['bannerid']); } if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { phpAds_PageShortcut($strClientProperties, 'advertiser-edit.php?clientid=' . $clientid, 'images/icon-advertiser.gif'); phpAds_PageShortcut($strCampaignProperties, 'campaign-edit.php?clientid=' . $clientid . '&campaignid=' . $campaignid, 'images/icon-campaign.gif'); phpAds_PageShortcut($strBannerHistory, 'stats.php?entity=banner&breakdown=history&clientid=' . $clientid . '&campaignid=' . $campaignid . '&bannerid=' . $bannerid, 'images/icon-statistics.gif'); phpAds_PageHeader("4.1.3.4.5"); echo "<img src='" . OX::assetPath() . "/images/icon-advertiser.gif' align='absmiddle'> " . phpAds_getParentClientName($campaignid); echo " <img src='" . OX::assetPath() . "/images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='" . OX::assetPath() . "/images/icon-campaign.gif' align='absmiddle'> " . phpAds_getCampaignName($campaignid); echo " <img src='" . OX::assetPath() . "/images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='" . OX::assetPath() . "/images/icon-banner-stored.gif' align='absmiddle'> <b>" . phpAds_getBannerName($bannerid) . "</b><br /><br />"; phpAds_ShowSections(array("4.1.3.4.5")); } else { phpAds_PageHeader("1.2.2.3"); echo "<img src='" . OX::assetPath() . "/images/icon-campaign.gif' align='absmiddle'> " . phpAds_getCampaignName($campaignid); echo " <img src='" . OX::assetPath() . "/images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='" . OX::assetPath() . "/images/icon-banner-stored.gif' align='absmiddle'> <b>" . phpAds_getBannerName($bannerid) . "</b><br /><br />"; phpAds_ShowSections(array("1.2.2.3")); } $doBanners = OA_Dal::factoryDO('banners'); $doBanners->get($bannerid); $row = $doBanners->toArray(); if ($row['contenttype'] == 'swf') { if ($row['storagetype'] == 'sql' || $row['storagetype'] == 'web') { $swf_file = phpAds_ImageRetrieve($row['storagetype'], $row['filename']); } } else { // Banner is not a flash banner, return to banner-edit.php header("Location: banner-edit.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&bannerid=" . $bannerid); exit;