本文整理汇总了PHP中OA_Dal_Delivery_getZoneInfo函数的典型用法代码示例。如果您正苦于以下问题:PHP OA_Dal_Delivery_getZoneInfo函数的具体用法?PHP OA_Dal_Delivery_getZoneInfo怎么用?PHP OA_Dal_Delivery_getZoneInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OA_Dal_Delivery_getZoneInfo函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getZoneInfo
function _getZoneInfo($params)
{
$paramZoneId = $params->getParam(0);
$zoneId = $paramZoneId->scalarval();
$response = new XML_RPC_Value(serialize(OA_Dal_Delivery_getZoneInfo($zoneId)), 'base64');
return new XML_RPC_Response($response);
}
示例2: OA_Dal_Delivery_getZoneLinkedAds
/**
* The function to get and return the ads linked to a zone
*
* @param int $zoneid The id of the zone to get linked ads for
*
* @todo Refactor this query (and others) to use OA_Dal_Delivery_buildQuery()
* @return array|false
* The array containg zone information with nested arrays of linked ads
* or false on failure. Note that:
* - Override campaign creatives are in "xAds"
* - Contract campaign creatives are in "ads"
* - Remnant campaign creatives ads are in "lAds"
* - Override and Remnant campaign creatives have had
* their priorities calculated on the basis of the campaign and
* creative weights
*/
function OA_Dal_Delivery_getZoneLinkedAds($zoneid)
{
$conf = $GLOBALS['_MAX']['CONF'];
// Sanitise parameteres
$zoneid = (int) $zoneid;
$aRows = OA_Dal_Delivery_getZoneInfo($zoneid);
$aRows['xAds'] = array();
$aRows['ads'] = array();
$aRows['lAds'] = array();
$aRows['eAds'] = array();
$aRows['count_active'] = 0;
$aRows['zone_companion'] = false;
$aRows['count_active'] = 0;
$totals = array('xAds' => 0, 'ads' => 0, 'lAds' => 0);
$query = "\n SELECT\n d.bannerid AS ad_id,\n d.campaignid AS placement_id,\n d.status AS status,\n d.description AS name,\n d.storagetype AS type,\n d.contenttype AS contenttype,\n d.pluginversion AS pluginversion,\n d.filename AS filename,\n d.imageurl AS imageurl,\n d.htmltemplate AS htmltemplate,\n d.htmlcache AS htmlcache,\n d.width AS width,\n d.height AS height,\n d.weight AS weight,\n d.seq AS seq,\n d.target AS target,\n d.url AS url,\n d.alt AS alt,\n d.statustext AS statustext,\n d.bannertext AS bannertext,\n d.adserver AS adserver,\n d.block AS block_ad,\n d.capping AS cap_ad,\n d.session_capping AS session_cap_ad,\n d.compiledlimitation AS compiledlimitation,\n d.acl_plugins AS acl_plugins,\n d.prepend AS prepend,\n d.append AS append,\n d.bannertype AS bannertype,\n d.alt_filename AS alt_filename,\n d.alt_imageurl AS alt_imageurl,\n d.alt_contenttype AS alt_contenttype,\n d.parameters AS parameters,\n d.transparent AS transparent,\n d.ext_bannertype AS ext_bannertype,\n d.iframe_friendly AS iframe_friendly,\n az.priority AS priority,\n az.priority_factor AS priority_factor,\n az.to_be_delivered AS to_be_delivered,\n c.campaignid AS campaign_id,\n c.priority AS campaign_priority,\n c.weight AS campaign_weight,\n c.companion AS campaign_companion,\n c.block AS block_campaign,\n c.capping AS cap_campaign,\n c.session_capping AS session_cap_campaign,\n c.show_capped_no_cookie AS show_capped_no_cookie,\n c.clientid AS client_id,\n c.expire_time AS expire_time,\n c.revenue_type AS revenue_type,\n c.ecpm_enabled AS ecpm_enabled,\n c.ecpm AS ecpm,\n c.clickwindow AS clickwindow,\n c.viewwindow AS viewwindow,\n m.advertiser_limitation AS advertiser_limitation,\n a.account_id AS account_id,\n z.affiliateid AS affiliate_id,\n a.agencyid as agency_id\n FROM\n " . OX_escapeIdentifier($conf['table']['prefix'] . $conf['table']['banners']) . " AS d JOIN\n " . OX_escapeIdentifier($conf['table']['prefix'] . $conf['table']['ad_zone_assoc']) . " AS az ON (d.bannerid = az.ad_id) JOIN\n " . OX_escapeIdentifier($conf['table']['prefix'] . $conf['table']['zones']) . " AS z ON (az.zone_id = z.zoneid) JOIN\n " . OX_escapeIdentifier($conf['table']['prefix'] . $conf['table']['campaigns']) . " AS c ON (c.campaignid = d.campaignid) LEFT JOIN\n " . OX_escapeIdentifier($conf['table']['prefix'] . $conf['table']['clients']) . " AS m ON (m.clientid = c.clientid) LEFT JOIN\n " . OX_escapeIdentifier($conf['table']['prefix'] . $conf['table']['agency']) . " AS a ON (a.agencyid = m.agencyid)\n WHERE\n az.zone_id = {$zoneid}\n AND\n d.status <= 0\n AND\n c.status <= 0\n ";
// $query = OA_Dal_Delivery_buildQuery('', '', '');
$rAds = OA_Dal_Delivery_query($query);
if (!is_resource($rAds)) {
return defined('OA_DELIVERY_CACHE_FUNCTION_ERROR') ? OA_DELIVERY_CACHE_FUNCTION_ERROR : null;
}
// Get creatives with conversions enabled
$aConversionLinkedCreatives = MAX_cacheGetTrackerLinkedCreatives();
while ($aAd = OA_Dal_Delivery_fetchAssoc($rAds)) {
$aAd['tracker_status'] = !empty($aConversionLinkedCreatives[$aAd['ad_id']]['status']) ? $aConversionLinkedCreatives[$aAd['ad_id']]['status'] : null;
// Is the creative from an override, contract or remnant campaign?
if ($aAd['campaign_priority'] == -1) {
// Creative is in an override campaign
$aRows['xAds'][$aAd['ad_id']] = $aAd;
$aRows['count_active']++;
} elseif ($aAd['campaign_priority'] == 0) {
// Creative is in a remnant campaign
$aRows['lAds'][$aAd['ad_id']] = $aAd;
$aRows['count_active']++;
} elseif ($aAd['campaign_priority'] == -2) {
// Creative is in a an eCPM campaign
$aRows['eAds'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd;
$aRows['count_active']++;
} else {
// Creative is in a contract campaign
$aRows['ads'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd;
$aRows['count_active']++;
}
// Also store Companion ads in additional array
if ($aAd['campaign_companion'] == 1) {
$aRows['zone_companion'][] = $aAd['placement_id'];
}
}
// If there are override campaign creatives, sort by priority
if (is_array($aRows['xAds'])) {
$totals['xAds'] = _setPriorityFromWeights($aRows['xAds']);
}
// If there are contract campaign or eCPM campaign creatives, prepare array
// of priority totals to allow delivery to do the scaling work later
if (is_array($aRows['ads'])) {
$totals['ads'] = _getTotalPrioritiesByCP($aRows['ads']);
}
if (is_array($aRows['eAds'])) {
$totals['eAds'] = _getTotalPrioritiesByCP($aRows['eAds']);
}
// If there are remnant campaign creatives, sort by priority
if (is_array($aRows['lAds'])) {
$totals['lAds'] = _setPriorityFromWeights($aRows['lAds']);
}
$aRows['priority'] = $totals;
return $aRows;
}
示例3: MAX_cacheGetZoneInfo
function MAX_cacheGetZoneInfo($zoneId, $cached = true)
{
$sName = OA_Delivery_Cache_getName(__FUNCTION__, $zoneId);
if (!$cached || ($aRows = OA_Delivery_Cache_fetch($sName)) === false) {
MAX_Dal_Delivery_Include();
$aRows = OA_Dal_Delivery_getZoneInfo($zoneId);
$aRows = OA_Delivery_Cache_store_return($sName, $aRows);
}
return $aRows;
}
示例4: test_DeliveryDB_getZoneInfo
function test_DeliveryDB_getZoneInfo()
{
// Create the admin account
$doAccounts = OA_Dal::factoryDO('accounts');
$doAccounts->account_name = 'System Administrator';
$doAccounts->account_type = OA_ACCOUNT_ADMIN;
$adminAccountId = DataGenerator::generateOne($doAccounts);
// Create a manager "agency" and account
$doAgency = OA_Dal::factoryDO('agency');
$doAgency->name = 'Manager Account';
$doAgency->contact = 'Andrew Hill';
$doAgency->email = 'andrew.hill@openads.org';
$managerAgencyId = DataGenerator::generateOne($doAgency);
// Get the account ID for the manager "agency"
$doAgency = OA_Dal::factoryDO('agency');
$doAgency->agency_id = $managerAgencyId;
$doAgency->find();
$doAgency->fetch();
$aAgency = $doAgency->toArray();
$managerAccountId = $aAgency['account_id'];
// Create a trafficker "affiliate" and account, owned by the manager
$doAffiliates = OA_Dal::factoryDO('affiliates');
$doAffiliates->name = 'Trafficker Account';
$doAffiliates->contact = 'Andrew Hill';
$doAffiliates->email = 'andrew.hill@openads.org';
$doAffiliates->agencyid = $managerAgencyId;
$traffickerAffiliateId = DataGenerator::generateOne($doAffiliates);
// Get the account ID for the trafficker "affiliate"
$doAffiliates = OA_Dal::factoryDO('affiliates');
$doAffiliates->clientid = $traffickerAffiliateId;
$doAffiliates->find();
$doAffiliates->fetch();
$aTrafficker = $doAffiliates->toArray();
$traffickerAccountId = $aTrafficker['account_id'];
// Test 1: Test with no zone present
$aResult = OA_Dal_Delivery_getZoneInfo(1);
$this->assertFalse($aResult);
// Create a zone
$doZones = OA_Dal::factoryDO('zones');
$doZones->zonename = 'Zone 1';
$doZones->affiliateid = $aTrafficker['affiliateid'];
$doZones->delivery = 0;
$doZones->description = 'Zone Description';
$doZones->width = 468;
$doZones->height = 60;
$doZones->chain = 500;
$doZones->prepend = 'foo!';
$doZones->append = 'bar!';
$doZones->appendtype = 0;
$doZones->forceappend = 't';
$doZones->inventory_forecast_type = '0';
$doZones->block = 14400;
$doZones->capping = 100;
$doZones->session_capping = 10;
$zoneId = DataGenerator::generateOne($doZones);
// Test 2: Test with a non-existing zone
$aResult = OA_Dal_Delivery_getZoneInfo($zoneId + 1);
$this->assertFalse($aResult);
// Test 3: Test with an existing zone, no preferences
// or preference associations
$aResult = OA_Dal_Delivery_getZoneInfo($zoneId);
$this->assertTrue(is_array($aResult));
$this->assertEqual(count($aResult), 21);
$this->assertEqual($aResult['zone_id'], $zoneId);
$this->assertEqual($aResult['name'], 'Zone 1');
$this->assertEqual($aResult['type'], 0);
$this->assertEqual($aResult['description'], 'Zone Description');
$this->assertEqual($aResult['width'], 468);
$this->assertEqual($aResult['height'], 60);
$this->assertEqual($aResult['publisher_id'], $aTrafficker['affiliateid']);
$this->assertEqual($aResult['agency_id'], $aTrafficker['agencyid']);
// Add the "default_banner_image_url" preference
$doPreferences = OA_Dal::factoryDO('preferences');
$doPreferences->preference_name = 'default_banner_image_url';
$doPreferences->account_type = OA_ACCOUNT_TRAFFICKER;
$defaultBannerImageUrlPrefrenceID = DataGenerator::generateOne($doPreferences);
// Test 4: Test with an existing zone, one preference but
// no preference associations
$aResult = OA_Dal_Delivery_getZoneInfo($zoneId);
$this->assertTrue(is_array($aResult));
$this->assertEqual(count($aResult), 21);
$this->assertEqual($aResult['zone_id'], $zoneId);
$this->assertEqual($aResult['name'], 'Zone 1');
$this->assertEqual($aResult['type'], 0);
$this->assertEqual($aResult['description'], 'Zone Description');
$this->assertEqual($aResult['width'], 468);
$this->assertEqual($aResult['height'], 60);
$this->assertEqual($aResult['publisher_id'], $aTrafficker['affiliateid']);
$this->assertEqual($aResult['agency_id'], $aTrafficker['agencyid']);
// Add a "default_banner_image_url" preference value for the admin user
$doAccount_preference_assoc = OA_Dal::factoryDO('account_preference_assoc');
$doAccount_preference_assoc->account_id = $adminAccountId;
$doAccount_preference_assoc->preference_id = $defaultBannerImageUrlPrefrenceID;
$doAccount_preference_assoc->value = 'http://www.fornax.net/blog/uploads/service_with_a_smile.jpg';
DataGenerator::generateOne($doAccount_preference_assoc);
// Test 5: Test with an existing zone, one preference and
// one preference associations
$aResult = OA_Dal_Delivery_getZoneInfo($zoneId);
$this->assertTrue(is_array($aResult));
$this->assertEqual(count($aResult), 21);
//.........这里部分代码省略.........