本文整理汇总了PHP中OA_Dal_Delivery_buildQuery函数的典型用法代码示例。如果您正苦于以下问题:PHP OA_Dal_Delivery_buildQuery函数的具体用法?PHP OA_Dal_Delivery_buildQuery怎么用?PHP OA_Dal_Delivery_buildQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OA_Dal_Delivery_buildQuery函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OA_Dal_Delivery_getLinkedAds
function OA_Dal_Delivery_getLinkedAds($search, $campaignid = '', $lastpart = true)
{
$conf = $GLOBALS['_MAX']['CONF'];
$campaignid = (int) $campaignid;
if ($campaignid > 0) {
$precondition = " AND d.campaignid = '" . $campaignid . "' ";
} else {
$precondition = '';
}
$aRows['xAds'] = array();
$aRows['ads'] = array();
$aRows['lAds'] = array();
$aRows['count_active'] = 0;
$aRows['zone_companion'] = false;
$aRows['count_active'] = 0;
$totals = array('xAds' => 0, 'ads' => 0, 'lAds' => 0);
$query = OA_Dal_Delivery_buildQuery($search, $lastpart, $precondition);
$rAds = OA_Dal_Delivery_query($query);
if (!is_resource($rAds)) {
return defined('OA_DELIVERY_CACHE_FUNCTION_ERROR') ? OA_DELIVERY_CACHE_FUNCTION_ERROR : null;
}
$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;
if ($aAd['campaign_priority'] == -1) {
$aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight'];
$aRows['xAds'][$aAd['ad_id']] = $aAd;
$aRows['count_active']++;
$totals['xAds'] += $aAd['priority'];
} elseif ($aAd['campaign_priority'] == 0) {
$aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight'];
$aRows['lAds'][$aAd['ad_id']] = $aAd;
$aRows['count_active']++;
$totals['lAds'] += $aAd['priority'];
} elseif ($aAd['campaign_priority'] == -2) {
$aRows['eAds'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd;
$aRows['count_active']++;
} else {
$aRows['ads'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd;
$aRows['count_active']++;
}
}
if (isset($aRows['xAds']) && is_array($aRows['xAds'])) {
$totals['xAds'] = _setPriorityFromWeights($aRows['xAds']);
}
if (isset($aRows['ads']) && is_array($aRows['ads'])) {
if (isset($aRows['lAds']) && is_array($aRows['lAds']) && count($aRows['lAds']) > 0) {
$totals['ads'] = _getTotalPrioritiesByCP($aRows['ads'], true);
} else {
$totals['ads'] = _getTotalPrioritiesByCP($aRows['ads'], false);
}
}
if (is_array($aRows['eAds'])) {
$totals['eAds'] = _getTotalPrioritiesByCP($aRows['eAds']);
}
if (isset($aRows['lAds']) && is_array($aRows['lAds'])) {
$totals['lAds'] = _setPriorityFromWeights($aRows['lAds']);
}
$aRows['priority'] = $totals;
return $aRows;
}
示例2: OA_Dal_Delivery_getLinkedAds
/**
* The function to get and return the ads for direct selection
*
* @param string $search The search string for this banner selection
* Usually 'bannerid:123' or 'campaignid:123'
* @param string $campaignid The campaign ID to fecth banners from, added in 2.3.32 to allow BC with 2.0
* @param boolean $lastpart Are there any other search strings left
*
* @return array|false The array of ads matching the search criteria
* or false on failure
*/
function OA_Dal_Delivery_getLinkedAds($search, $campaignid = '', $lastpart = true)
{
$conf = $GLOBALS['_MAX']['CONF'];
// Sanitise parameteres
$campaignid = (int) $campaignid;
if ($campaignid > 0) {
$precondition = " AND d.campaignid = '" . $campaignid . "' ";
} else {
$precondition = '';
}
$aRows['xAds'] = array();
$aRows['ads'] = array();
$aRows['lAds'] = array();
$aRows['count_active'] = 0;
$aRows['zone_companion'] = false;
$aRows['count_active'] = 0;
$totals = array('xAds' => 0, 'ads' => 0, 'lAds' => 0);
$query = OA_Dal_Delivery_buildQuery($search, $lastpart, $precondition);
$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
$aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight'];
$aRows['xAds'][$aAd['ad_id']] = $aAd;
$aRows['count_active']++;
$totals['xAds'] += $aAd['priority'];
} elseif ($aAd['campaign_priority'] == 0) {
// Creative is in a remnant campaign
$aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight'];
$aRows['lAds'][$aAd['ad_id']] = $aAd;
$aRows['count_active']++;
$totals['lAds'] += $aAd['priority'];
} elseif ($aAd['campaign_priority'] == -2) {
// Creative is in 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']++;
}
}
// If there are override campaign creatives, sort by priority
if (isset($aRows['xAds']) && is_array($aRows['xAds'])) {
$totals['xAds'] = _setPriorityFromWeights($aRows['xAds']);
}
// If there are contract campaign creatives, prepare array of priority totals
// to allow delivery to do the scaling work later
if (isset($aRows['ads']) && is_array($aRows['ads'])) {
// Are there any "lower" level creatives?
if (isset($aRows['lAds']) && is_array($aRows['lAds']) && count($aRows['lAds']) > 0) {
// "Lower" level creatives exist, INCLUDE the "blank" priority
$totals['ads'] = _getTotalPrioritiesByCP($aRows['ads'], true);
} else {
// "Lower" level creatives do NOT exist, EXCLUDE the "blank" priority
$totals['ads'] = _getTotalPrioritiesByCP($aRows['ads'], false);
}
}
// eCPM remnant campaigns
if (is_array($aRows['eAds'])) {
$totals['eAds'] = _getTotalPrioritiesByCP($aRows['eAds']);
}
// If there are remnant campaign creatives, sort by priority
if (isset($aRows['lAds']) && is_array($aRows['lAds'])) {
$totals['lAds'] = _setPriorityFromWeights($aRows['lAds']);
}
$aRows['priority'] = $totals;
return $aRows;
}
示例3: OA_Dal_Delivery_getLinkedAds
function OA_Dal_Delivery_getLinkedAds($search, $campaignid = '', $lastpart = true)
{
$conf = $GLOBALS['_MAX']['CONF'];
// Sanitise parameteres
$campaignid = (int) $campaignid;
if ($campaignid > 0) {
$precondition = " AND d.campaignid = '" . $campaignid . "' ";
} else {
$precondition = '';
}
$aRows['xAds'] = array();
$aRows['cAds'] = array();
$aRows['clAds'] = array();
$aRows['ads'] = array();
$aRows['lAds'] = array();
$aRows['count_active'] = 0;
$aRows['zone_companion'] = false;
$aRows['count_active'] = 0;
$totals = array('xAds' => 0, 'cAds' => 0, 'clAds' => 0, 'ads' => 0, 'lAds' => 0);
$query = OA_Dal_Delivery_buildQuery($search, $lastpart, $precondition);
$rAds = OA_Dal_Delivery_query($query);
if (!is_resource($rAds)) {
if (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) {
return OA_DELIVERY_CACHE_FUNCTION_ERROR;
} else {
return null;
}
}
// Get timezone data
$aTimezones = MAX_cacheGetAccountTZs();
while ($aAd = OA_Dal_Delivery_fetchAssoc($rAds)) {
// Add timezone
if (isset($aAd['account_id']) && isset($aTimezones['aAccounts'][$aAd['account_id']])) {
$aAd['timezone'] = $aTimezones['aAccounts'][$aAd['account_id']];
} else {
$aAd['timezone'] = $aTimezones['default'];
}
// Is the ad Exclusive, Low, or Normal Priority?
if ($aAd['campaign_priority'] == -1) {
// Ad is in an exclusive placement
$aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight'];
$aRows['xAds'][$aAd['ad_id']] = $aAd;
$aRows['count_active']++;
$totals['xAds'] += $aAd['priority'];
} elseif ($aAd['campaign_priority'] == 0) {
// Ad is in a low priority placement
$aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight'];
$aRows['lAds'][$aAd['ad_id']] = $aAd;
$aRows['count_active']++;
$totals['lAds'] += $aAd['priority'];
} elseif ($aAd['campaign_priority'] == -2) {
// Ad is in a low priority eCPM placement
$aRows['eAds'][$aAd['ad_id']] = $aAd;
$aRows['count_active']++;
} else {
// Ad is in a paid placement
$aRows['ads'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd;
$aRows['count_active']++;
}
// Also store Companion ads in additional array
if ($aAd['campaign_companion'] == 1) {
if ($aAd['campaign_priority'] == 0) {
// Store a low priority companion ad
$aRows['zone_companion'][] = $aAd['placement_id'];
$aRows['clAds'][$aAd['ad_id']] = $aAd;
$totals['clAds'] += $aAd['priority'];
} else {
// Store a paid priority companion ad
$aRows['zone_companion'][] = $aAd['placement_id'];
$aRows['cAds'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd;
}
}
}
// If there are exclusive ads, sort by priority
if (isset($aRows['xAds']) && is_array($aRows['xAds'])) {
$totals['xAds'] = _setPriorityFromWeights($aRows['xAds']);
}
// If there are paid ads, prepare array of priority totals
// to allow delivery to do the scaling work later
if (isset($aRows['ads']) && is_array($aRows['ads'])) {
$totals['ads'] = _getTotalPrioritiesByCP($aRows['ads']);
}
// If there are low priority ads, sort by priority
if (isset($aRows['lAds']) && is_array($aRows['lAds'])) {
$totals['lAds'] = _setPriorityFromWeights($aRows['lAds']);
}
// If there are paid companion ads, prepare array of priority totals
// to allow delivery to do the scaling work later
if (isset($aRows['cAds']) && is_array($aRows['cAds'])) {
$totals['cAds'] = _getTotalPrioritiesByCP($aRows['cAds']);
}
// If there are low priority companion ads, sort by priority
if (isset($aRows['clAds']) && is_array($aRows['clAds'])) {
$totals['clAds'] = _setPriorityFromWeights($aRows['clAds']);
}
$aRows['priority'] = $totals;
return $aRows;
}