本文整理汇总了PHP中Admin_DA::_checkEmailZoneAdAssoc方法的典型用法代码示例。如果您正苦于以下问题:PHP Admin_DA::_checkEmailZoneAdAssoc方法的具体用法?PHP Admin_DA::_checkEmailZoneAdAssoc怎么用?PHP Admin_DA::_checkEmailZoneAdAssoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin_DA
的用法示例。
在下文中一共展示了Admin_DA::_checkEmailZoneAdAssoc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processCampaignForm
/**
* Processes submit values of campaign form
*
* @param OA_Admin_UI_Component_Form $form form to process
* @return An array of Pear::Error objects if any
*/
function processCampaignForm($form, &$oComponent = null)
{
$aFields = $form->exportValues();
if (!empty($aFields['start'])) {
$oDate = new Date(date('Y-m-d 00:00:00', strtotime($aFields['start'])));
$oDate->toUTC();
$activate = $oDate->getDate();
} else {
$oDate = new Date(date('Y-m-d 00:00:00'));
$oDate->toUTC();
$activate = $oDate->getDate();
}
if (!empty($aFields['end'])) {
$oDate = new Date(date('Y-m-d 23:59:59', strtotime($aFields['end'])));
$oDate->toUTC();
$expire = $oDate->getDate();
} else {
$expire = null;
}
if (empty($aFields['campaignid'])) {
// The form is submitting a new campaign, so, the ID is not set;
// set the ID to the string "null" so that the table auto_increment
// or sequence will be used when the campaign is created
$aFields['campaignid'] = "null";
} else {
// The form is submitting a campaign modification; need to test
// if any of the banners in the campaign are linked to an email zone,
// and if so, if the link(s) would still be valid if the change(s)
// to the campaign were made...
$dalCampaigns = OA_Dal::factoryDAL('campaigns');
$aCurrentLinkedEmalZoneIds = $dalCampaigns->getLinkedEmailZoneIds($aFields['campaignid']);
if (PEAR::isError($aCurrentLinkedEmalZoneIds)) {
OX::disableErrorHandling();
$errors[] = PEAR::raiseError($GLOBALS['strErrorDBPlain']);
OX::enableErrorHandling();
}
$errors = array();
foreach ($aCurrentLinkedEmalZoneIds as $zoneId) {
$thisLink = Admin_DA::_checkEmailZoneAdAssoc($zoneId, $aFields['campaignid'], $activate, $expire);
if (PEAR::isError($thisLink)) {
$errors[] = $thisLink;
break;
}
}
}
//correct and check revenue and ecpm
correctAdnCheckNumericFormField($aFields, $errors, 'revenue', $GLOBALS['strErrorEditingCampaignRevenue']);
correctAdnCheckNumericFormField($aFields, $errors, 'ecpm', $GLOBALS['strErrorEditingCampaignECPM']);
if (empty($errors)) {
//check booked limits values
// If this is a remnant, ecpm or exclusive campaign with an expiry date, set the target's to unlimited
if (!empty($expire) && ($aFields['campaign_type'] == OX_CAMPAIGN_TYPE_REMNANT || $aFields['campaign_type'] == OX_CAMPAIGN_TYPE_ECPM || $aFields['campaign_type'] == OX_CAMPAIGN_TYPE_CONTRACT_EXCLUSIVE)) {
$aFields['impressions'] = $aFields['clicks'] = $aFields['conversions'] = -1;
} else {
if (!empty($aFields['impr_unlimited']) && $aFields['impr_unlimited'] == 't') {
$aFields['impressions'] = -1;
} else {
if (empty($aFields['impressions']) || $aFields['impressions'] == '-') {
$aFields['impressions'] = 0;
}
}
if (!empty($aFields['click_unlimited']) && $aFields['click_unlimited'] == 't') {
$aFields['clicks'] = -1;
} else {
if (empty($aFields['clicks']) || $aFields['clicks'] == '-') {
$aFields['clicks'] = 0;
}
}
if (!empty($aFields['conv_unlimited']) && $aFields['conv_unlimited'] == 't') {
$aFields['conversions'] = -1;
} else {
if (empty($aFields['conversions']) || $aFields['conversions'] == '-') {
$aFields['conversions'] = 0;
}
}
}
//pricing model - reset fields not applicable to model to 0,
//note that in new flow MAX_FINANCE_CPA allows all limits to be set
if ($aFields['revenue_type'] == MAX_FINANCE_CPM) {
$aFields['clicks'] = -1;
$aFields['conversions'] = -1;
} else {
if ($aFields['revenue_type'] == MAX_FINANCE_CPC) {
$aFields['conversions'] = -1;
} else {
if ($aFields['revenue_type'] == MAX_FINANCE_MT) {
$aFields['impressions'] = -1;
$aFields['clicks'] = -1;
$aFields['conversions'] = -1;
}
}
}
//check type and set priority
if ($aFields['campaign_type'] == OX_CAMPAIGN_TYPE_REMNANT) {
//.........这里部分代码省略.........
示例2: _linkZonesToCampaignsBannersOrSingleBanner
/**
* Batch linking list of zones to campaign's banners or a specific banner
* This is a sub-function of linkZonesToCampaigns and linkZonesToBanner.
*
* Banners are linked when:
* - text text banner and text zone (ignore width/height)
* - link non text banners when matching width/height to non text zone
* Don't link banners to zone if that link already exists
* Don't link Email zones
*
* @param array $aZonesIds array of zones IDs
* @param int $campaignId the campaign ID.
* @param int $bannerId the banner ID.
* @return int number of linked banners
*/
function _linkZonesToCampaignsBannersOrSingleBanner($aZonesIds, $campaignId, $bannerId = null)
{
$prefix = $this->getTablePrefix();
$rsEmailZones = DBC::NewRecordSet("SELECT zoneid FROM {$prefix}zones WHERE delivery = " . MAX_ZoneEmail . " AND zoneid IN (" . implode(',', array_map('intval', $aZonesIds)) . ")");
$aEmailZoneIds = $rsEmailZones->getAll();
$fastLinking = !$GLOBALS['_MAX']['CONF']['audit']['enabledForZoneLinking'];
$fromWhereClause = " FROM\n {$prefix}banners AS b\n CROSS JOIN\n {$prefix}zones AS z\n LEFT JOIN {$prefix}ad_zone_assoc AS aza ON (aza.ad_id = b.bannerid AND aza.zone_id = z.zoneid)\n WHERE";
if (!empty($campaignId)) {
$fromWhereClause .= "\n b.campaignid = " . DBC::makeLiteral($campaignId) . "\n AND";
foreach ($aEmailZoneIds as $zoneId) {
$okToLink = Admin_DA::_checkEmailZoneAdAssoc($zoneId, $campaignId);
if (PEAR::isError($okToLink)) {
$aZonesIds = array_diff($aZonesIds, array($zoneId));
}
}
}
if (!empty($bannerId)) {
$fromWhereClause .= "\n b.bannerid = " . DBC::makeLiteral($bannerId) . "\n AND";
// Remove any zoneids which this banner cannot be linked to due to email zone restrictions
foreach ($aEmailZoneIds as $zoneId) {
$aAd = Admin_DA::getAd($bannerId);
$okToLink = Admin_DA::_checkEmailZoneAdAssoc($zoneId, $aAd['placement_id']);
if (PEAR::isError($okToLink)) {
$aZonesIds = array_diff($aZonesIds, array($zoneId));
}
}
}
$fromWhereClause .= "\n z.zoneid IN (" . implode(",", array_map('intval', $aZonesIds)) . ")\n AND\n (\n (\n b.storagetype = 'txt'\n AND\n z.delivery = " . phpAds_ZoneText . "\n )\n OR\n (\n z.delivery <> " . phpAds_ZoneText . "\n AND\n b.storagetype <> 'txt'\n AND\n (\n (\n ( z.width = -1\n OR\n z.width = b.width\n )\n AND\n ( z.height = -1\n OR\n z.height = b. height\n )\n )\n OR\n (\n b.height = -1 AND b.width = -1\n )\n )\n )\n )\n AND\n aza.ad_zone_assoc_id IS NULL\n ";
// if only one zone is selected and this zone is an email zone
// we only link it if it was not previously linked to any banner (email zones can be linked to one banner only)
if ($fastLinking) {
$query = "INSERT INTO {$prefix}ad_zone_assoc (zone_id, ad_id, priority_factor)\n SELECT z.zoneid, b.bannerid, 1\n {$fromWhereClause}\n ";
return $this->oDbh->exec($query);
} else {
$query = "\n SELECT z.zoneid AS zoneid,\n b.bannerid AS bannerid\n {$fromWhereClause}\n ";
$rsAdZones = DBC::NewRecordSet($query);
if (PEAR::isError($rsAdZones)) {
return $rsAdZones;
}
$aAdZones = $rsAdZones->getAll();
$doAdZoneAssoc = OA_Dal::factoryDO('ad_zone_assoc');
foreach ($aAdZones as $aAdZone) {
$doAdZoneAssoc->zone_id = $aAdZone['zoneid'];
$doAdZoneAssoc->ad_id = $aAdZone['bannerid'];
$doAdZoneAssoc->priority_factor = 1;
$doAdZoneAssoc->insert();
}
return count($aAdZones);
}
}
示例3: _isValidAdZoneAssoc
function _isValidAdZoneAssoc($aVariables)
{
$aAdZone = Admin_DA::getAdZones($aVariables);
if (empty($aAdZone)) {
if (!$aVariables['zone_id']) {
// Direct selection zone, always allow
return true;
}
$azParams = Admin_DA::getLinkedAdParams($aVariables['zone_id']);
$azParams['ad_id'] = $aVariables['ad_id'];
$azParams['market_ads_include'] = true;
$azAds = Admin_DA::getAds($azParams);
if (!empty($azAds)) {
// Ad seems OK to link, check if this is an email zone, and enforce only a single active linked ad at a time
$aZone = Admin_DA::getZone($aVariables['zone_id']);
if ($aZone['type'] == MAX_ZoneEmail) {
$aAd = Admin_DA::getAd($azParams['ad_id']);
$okToLink = Admin_DA::_checkEmailZoneAdAssoc($aZone['zone_id'], $aAd['placement_id']);
if (PEAR::isError($okToLink)) {
return $okToLink;
}
PEAR::pushErrorHandling(null);
$okToLink = Admin_DA::_checkBannerZoneAdAssoc($aZone, $aAd['type'], $aAd['contenttype']);
PEAR::popErrorHandling();
if (PEAR::isError($okToLink)) {
return $okToLink;
}
}
if ($aZone['type'] != phpAds_ZoneText && $azAds[$azParams['ad_id']]['type'] == 'txt') {
return PEAR::raiseError('Text banner can be linked only to text zone', MAX_ERROR_INVALIDBANNERSIZE);
}
return true;
} else {
return PEAR::raiseError('This banner is the wrong size for this zone', MAX_ERROR_INVALIDBANNERSIZE);
}
} else {
// If already linked...
return PEAR::raiseError('This banner is already linked to this zone', MAX_ERROR_ALREADYLINKED);
}
}