本文整理汇总了PHP中OA_Dal::isValidDate方法的典型用法代码示例。如果您正苦于以下问题:PHP OA_Dal::isValidDate方法的具体用法?PHP OA_Dal::isValidDate怎么用?PHP OA_Dal::isValidDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OA_Dal
的用法示例。
在下文中一共展示了OA_Dal::isValidDate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isNullDate
/**
* Returns true if the $sqlDate represents 'empty' OpenX date,
* false otherwise.
*
* @static
* @param string $sqlDate
*/
function isNullDate($sqlDate)
{
return !OA_Dal::isValidDate($sqlDate);
}
示例2: setStatus
/**
* A method to set the correct status based on the other campaign properties
*
* If you ever need to disable this in a test, please use a Mock overriding this method
*
* @param DataObjects_Campaigns $oldDoCampaigns
*/
function setStatus($oldDoCampaigns = null)
{
$this->_coalesce($oldDoCampaigns, array('expire'));
if ($this->_isExpired()) {
$this->status = OA_ENTITY_STATUS_EXPIRED;
return;
}
$this->_coalesce($oldDoCampaigns, array('views', 'clicks', 'conversions'));
if ($this->_hasExceeededBookings()) {
$this->status = OA_ENTITY_STATUS_EXPIRED;
return;
}
$this->_coalesce($oldDoCampaigns, array('activate'));
if ($this->_isAwaiting()) {
$this->status = OA_ENTITY_STATUS_AWAITING;
return;
}
$this->_coalesce($oldDoCampaigns, array('status'));
if ($this->status == OA_ENTITY_STATUS_EXPIRED || $this->status == OA_ENTITY_STATUS_AWAITING) {
if (isset($oldDoCampaigns)) {
if ($oldDoCampaigns->status == OA_ENTITY_STATUS_EXPIRED || $oldDoCampaigns->status == OA_ENTITY_STATUS_AWAITING) {
$this->status = OA_ENTITY_STATUS_RUNNING;
} else {
$this->status = $oldDoCampaigns->status;
}
} else {
$this->status = OA_ENTITY_STATUS_RUNNING;
}
}
if ($this->priority == self::PRIORITY_ECPM || $this->ecpm_enabled == 1) {
$ecpmOk = floatval($this->revenue) > 0;
if ($this->status == OA_ENTITY_STATUS_RUNNING && !$ecpmOk) {
$this->status = OA_ENTITY_STATUS_INACTIVE;
} elseif ($this->status == OA_ENTITY_STATUS_INACTIVE && $ecpmOk) {
$this->status = OA_ENTITY_STATUS_RUNNING;
}
} else {
// Set campaign inactive if weight and target are both null and autotargeting is disabled
$this->_coalesce($oldDoCampaigns, array('target_impression', 'target_click', 'target_conversion', 'weight'));
$targetOk = $this->target_impression > 0 || $this->target_click > 0 || $this->target_conversion > 0;
$weightOk = $this->weight > 0;
$autotargeted = OA_Dal::isValidDate($this->expire) && ($this->views > 0 || $this->clicks > 0 || $this->conversions > 0);
if ($this->status == OA_ENTITY_STATUS_RUNNING && !$autotargeted && !($targetOk || $weightOk)) {
$this->status = OA_ENTITY_STATUS_INACTIVE;
} elseif ($this->status == OA_ENTITY_STATUS_INACTIVE && ($autotargeted || $targetOk || $weightOk)) {
$this->status = OA_ENTITY_STATUS_RUNNING;
}
}
}
示例3: testIsValidDate
function testIsValidDate()
{
$this->assertTrue(OA_Dal::isValidDate('2007-03-01'));
$this->assertFalse(OA_Dal::isValidDate('0'));
$this->assertFalse(OA_Dal::isValidDate(null));
}
示例4: elseif
$campaign['revenue'] = '';
$campaign['revenue_type'] = null;
$campaign['target_value'] = '-';
$campaign['impressionsRemaining'] = null;
$campaign['clicksRemaining'] = null;
$campaign['conversionsRemaining'] = null;
$campaign['companion'] = null;
$campaign['block'] = null;
$campaign['capping'] = null;
$campaign['session_capping'] = null;
$campaign['comments'] = null;
$campaign['target_type'] = null;
$campaign['min_impressions'] = 100;
$campaign['show_capped_no_cookie'] = 0;
}
if ($campaign['status'] == OA_ENTITY_STATUS_RUNNING && OA_Dal::isValidDate($campaign['expire']) && $campaign['impressions'] > 0) {
$campaign['delivery'] = 'auto';
} elseif ($campaign['target_value'] > 0) {
$campaign['delivery'] = 'manual';
} else {
$campaign['delivery'] = 'none';
}
$campaign['clientid'] = $clientid;
$campaign['campaignid'] = $campaignid;
/*-------------------------------------------------------*/
/* MAIN REQUEST PROCESSING */
/*-------------------------------------------------------*/
// Handle ajax call to update ecpm field.
if (isset($_REQUEST['ajax'])) {
if ($start) {
$startDate = date('Y-m-d', strtotime($start));
示例5: 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();
$expire = !empty($aFields['end']) ? date('Y-m-d', strtotime($aFields['end'])) : OA_Dal::noDateValue();
$activate = !empty($aFields['start']) ? date('Y-m-d', strtotime($aFields['start'])) : OA_Dal::noDateValue();
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 (OA_Dal::isValidDate($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) {
$aFields['priority'] = 0;
//low
} else {
if ($aFields['campaign_type'] == OX_CAMPAIGN_TYPE_CONTRACT_NORMAL) {
$aFields['priority'] = isset($aFields['high_priority_value']) ? $aFields['high_priority_value'] : 5;
//high
} else {
if ($aFields['campaign_type'] == OX_CAMPAIGN_TYPE_CONTRACT_EXCLUSIVE) {
$aFields['priority'] = -1;
//exclusive
} else {
if ($aFields['campaign_type'] == OX_CAMPAIGN_TYPE_ECPM) {
$aFields['priority'] = -2;
//ecpm
//.........这里部分代码省略.........