本文整理汇总了PHP中OA::getNow方法的典型用法代码示例。如果您正苦于以下问题:PHP OA::getNow方法的具体用法?PHP OA::getNow怎么用?PHP OA::getNow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OA
的用法示例。
在下文中一共展示了OA::getNow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _pruneDataSummaryAdZoneAssocOldData
/**
* A method to prune the data_summary_ad_zone_assoc table
* Pruning can be performed where zone_id = 0 (i.e. for direct selection) and where the entry is older than MAX_PREVIOUS_AD_DELIVERY_INFO_LIMIT minutes ago.
*
* @return integer : number of records deleted
*/
function _pruneDataSummaryAdZoneAssocOldData()
{
$doDSAZA = OA_Dal::factoryDO('data_summary_ad_zone_assoc');
$doDSAZA->whereAdd('zone_id=0', 'AND');
$doDSAZA->whereAdd('created < DATE_ADD(' . $this->oDbh->quote(OA::getNow()) . ', ' . OA_Dal::quoteInterval(-MAX_PREVIOUS_AD_DELIVERY_INFO_LIMIT, 'SECOND') . ')', 'AND');
return $doDSAZA->delete(true, false);
}
示例2: phpAds_userlogAdd
function phpAds_userlogAdd($action, $object, $details = '')
{
$oDbh =& OA_DB::singleton();
$conf = $GLOBALS['_MAX']['CONF'];
global $phpAds_Usertype;
if ($phpAds_Usertype != 0) {
$usertype = $phpAds_Usertype;
$userid = 0;
} else {
$usertype = phpAds_userAdministrator;
$userid = 0;
}
$now = strtotime(OA::getNow());
$query = "\n INSERT INTO\n " . $oDbh->quoteIdentifier($conf['table']['prefix'] . $conf['table']['userlog'], true) . "\n (\n timestamp,\n usertype,\n userid,\n action,\n object,\n details\n )\n VALUES\n (\n " . $oDbh->quote($now, 'integer') . ",\n " . $oDbh->quote($usertype, 'integer') . ",\n " . $oDbh->quote($userid, 'integer') . ",\n " . $oDbh->quote($action, 'integer') . ",\n " . $oDbh->quote($object, 'integer') . ",\n " . $oDbh->quote($details, 'text') . "\n )";
$res = $oDbh->exec($query);
if (PEAR::isError($res)) {
return $res;
}
return true;
}
示例3: sendCampaignDeliveryEmail
function sendCampaignDeliveryEmail($aAdvertiser, $oStartDate = null, $oEndDate = null, $campaignId = null)
{
$aConf = $GLOBALS['_MAX']['CONF'];
$aAdvertiserPrefs = OA_Preferences::loadAccountPreferences($aAdvertiser['account_id'], true);
$oTimezone = new Date_Timezone($aAdvertiserPrefs['timezone']);
$this->convertStartEndDate($oStartDate, $oEndDate, $oTimezone);
$aLinkedUsers = $this->getUsersLinkedToAccount('clients', $aAdvertiser['clientid']);
// Add the advertiser to the linked users if there isn't any linked user with the advertiser's email address
$aLinkedUsers = $this->_addAdvertiser($aAdvertiser, $aLinkedUsers);
$copiesSent = 0;
if (!empty($aLinkedUsers) && is_array($aLinkedUsers)) {
if ($aConf['email']['useManagerDetails']) {
$aFromDetails = $this->_getAgencyFromDetails($aAdvertiser['agencyid']);
}
foreach ($aLinkedUsers as $aUser) {
$aEmail = $this->prepareCampaignDeliveryEmail($aUser, $aAdvertiser['clientid'], $oStartDate, $oEndDate, $campaignId);
if ($aEmail !== false) {
if (!isset($aEmail['hasAdviews']) || $aEmail['hasAdviews'] !== false) {
if ($this->sendMail($aEmail['subject'], $aEmail['contents'], $aUser['email_address'], $aUser['contact_name'], $aFromDetails)) {
$copiesSent++;
if ($aConf['email']['logOutgoing']) {
phpAds_userlogSetUser(phpAds_userMaintenance);
phpAds_userlogAdd(phpAds_actionAdvertiserReportMailed, $aAdvertiser['clientid'], "{$aEmail['subject']}\n\n\n {$aUser['contact_name']}({$aUser['email_address']})\n\n\n {$aEmail['contents']}");
}
}
}
}
}
}
// Only update the last sent date if we actually sent out at least one copy of the email
if ($copiesSent) {
// Update the last run date to "today"
OA::debug(' - Updating the date the report was last sent for advertiser ID ' . $aAdvertiser['clientid'] . '.', PEAR_LOG_DEBUG);
$doUpdateClients = OA_Dal::factoryDO('clients');
$doUpdateClients->clientid = $aAdvertiser['clientid'];
$doUpdateClients->reportlastdate = OA::getNow();
$doUpdateClients->update();
}
return $copiesSent;
}
示例4: updateAuditAction
function updateAuditAction($aParams = array())
{
$id = isset($aParams['id']) ? $aParams['id'] : $this->getUpgradeActionId();
unset($aParams['id']);
if (!$id) {
$this->logError('upgrade_action_id is empty');
return false;
}
$aParams = $this->_escapeParams($aParams);
$values = '';
foreach ($aParams as $k => $v) {
$values .= "{$k}={$v},";
}
$values .= "updated='" . OA::getNow() . "'";
$table = $this->getLogTableName();
$query = "UPDATE {$table} SET {$values} WHERE upgrade_action_id={$id}";
$result = $this->oDbh->exec($query);
if ($this->isPearError($result, "error inserting {$this->prefix}{$this->logTable}")) {
return false;
}
return true;
}
示例5: generateTestData
/**
* method for extending OA_Test_Data_DataObject
*/
function generateTestData()
{
if (!parent::init()) {
return false;
}
// Disable Auditing while loading the test data:
$GLOBALS['_MAX']['CONF']['audit']['enabled'] = false;
parent::generateTestData();
for ($hour = 0; $hour < 24; $hour++) {
$doDSAH = OA_Dal::factoryDO('data_summary_ad_hourly');
$doDSAH->date_time = sprintf('%s %02d:00:00', substr(OA::getNow(), 0, 10), $hour);
$doDSAH->ad_id = $this->aIds['banners'][1];
$doDSAH->creative_id = rand(1, 999);
$doDSAH->zone_id = $this->aIds['zones'][1];
$doDSAH->requests = rand(1, 999);
$doDSAH->impressions = rand(1, 999);
$doDSAH->clicks = rand(1, 999);
$doDSAH->conversions = rand(1, 999);
$doDSAH->total_basket_value = 0;
$this->aIds['DSAH'][] = DataGenerator::generateOne($doDSAH);
}
return $this->aIds;
}
示例6: test_MAX_AclSave
function test_MAX_AclSave()
{
// insert a channel
$doChannel = OA_Dal::factoryDO('channel');
$channelId = DataGenerator::generateOne($doChannel);
$doChannel->channelid = $channelId;
// insert a banner
$doBanners = OA_Dal::factoryDO('banners');
$bannerId = DataGenerator::generateOne($doBanners);
$doBanners->bannerid = $bannerId;
$doBanners->acls_updated = OA::getNow();
$doBanners->update();
$updated1 = $doBanners->acls_updated;
// save a banner limited by date/time
$aAcls[1]['data'] = '0,1';
$aAcls[1]['logical'] = 'and';
$aAcls[1]['type'] = 'Dummy:Dummy';
$aAcls[1]['comparison'] = '=~';
$aAcls[1]['executionorder'] = 1;
$sLimitation = "MAX_checkDummy_Dummy('0,1', '=~')";
$aEntities = array('bannerid' => $bannerId);
$this->assertTrue(MAX_AclSave(array($aAcls[1]), $aEntities, 'banner-acl.php'));
$doBanners = OA_Dal::staticGetDO('banners', $bannerId);
$this->assertTrue($doBanners);
$this->assertEqual($sLimitation, $doBanners->compiledlimitation);
$doAcls = OA_Dal::factoryDO('acls');
$doAcls->whereAdd('bannerid = ' . $bannerId);
$this->assertTrue($doAcls->find(true));
$this->assertEqual($doAcls->bannerid, $bannerId);
$this->assertEqual($doAcls->logical, $aAcls[1]['logical']);
$this->assertEqual($doAcls->type, $aAcls[1]['type']);
$this->assertEqual($doAcls->comparison, $aAcls[1]['comparison']);
$this->assertEqual($doAcls->data, $aAcls[1]['data']);
$this->assertEqual($doAcls->executionorder, $aAcls[1]['executionorder']);
$this->assertFalse($doAcls->fetch());
}
示例7: _pruneDataSummaryAdZoneAssocInactiveExpired
/**
* A method to prune the data_summary_ad_zone_assoc table
* Prune all entries where the ad_id is for a banner in a High Priority Campaign where:
* The campaign does not have any booked lifetime target values AND the caMpaign has an end date AND the end date has been passed AND the campaign is not active.
*
* @return integer : number of records deleted
*/
function _pruneDataSummaryAdZoneAssocInactiveExpired()
{
$tblAssoc = $this->_getTablename('data_summary_ad_zone_assoc');
$tblBanners = $this->_getTablename('banners');
$tblCampaigns = $this->_getTablename('campaigns');
$queryEnd = '' . ' LEFT JOIN ' . $tblCampaigns . ' AS c ON b.campaignid = c.campaignid' . ' WHERE ( ( c.status <> ' . OA_ENTITY_STATUS_RUNNING . ') AND (c.priority > 0 )) ' . ' AND' . '(' . ' (' . ' (c.target_impression < 1)' . ' AND' . ' (c.target_click < 1)' . ' AND' . ' (c.target_conversion < 1)' . ' )' . ' AND' . ' (UNIX_TIMESTAMP(c.expire) > 0)' . ' AND' . ' (c.expire < ' . $this->oDbh->quote(OA::getNow('Y-m-d')) . ')' . ')';
if ($this->oDbh->dbsyntax == 'pgsql') {
$query = 'DELETE FROM ' . $tblAssoc . ' WHERE data_summary_ad_zone_assoc_id IN (' . ' SELECT dsaza.data_summary_ad_zone_assoc_id FROM' . ' ' . $tblAssoc . ' AS dsaza' . ' LEFT JOIN ' . $tblBanners . ' AS b ON dsaza.ad_id = b.bannerid' . $queryEnd . ')';
} else {
$query = 'DELETE FROM ' . $tblAssoc . ' USING ' . $tblAssoc . ' LEFT JOIN ' . $tblBanners . ' AS b ON ' . $tblAssoc . '.ad_id = b.bannerid' . $queryEnd;
}
return $this->oDbh->exec($query);
}
示例8: processForm
function processForm($aAdvertiser, $form)
{
$aFields = $form->exportValues();
// Name
if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$aAdvertiser['clientname'] = $aFields['clientname'];
}
// Default fields
$aAdvertiser['contact'] = $aFields['contact'];
$aAdvertiser['email'] = $aFields['email'];
$aAdvertiser['comments'] = $aFields['comments'];
// Same advertiser limitation
$aAdvertiser['advertiser_limitation'] = $aFields['advertiser_limitation'] == '1' ? 1 : 0;
// Reports
$aAdvertiser['report'] = $aFields['report'] == 't' ? 't' : 'f';
$aAdvertiser['reportdeactivate'] = $aFields['reportdeactivate'] == 't' ? 't' : 'f';
$aAdvertiser['reportinterval'] = (int) $aFields['reportinterval'];
if ($aAdvertiser['reportinterval'] == 0) {
$aAdvertiser['reportinterval'] = 1;
}
if ($aFields['reportlastdate'] == '' || $aFields['reportlastdate'] == '0000-00-00' || $aFields['reportprevious'] != $aAdvertiser['report']) {
$aAdvertiser['reportlastdate'] = date("Y-m-d");
}
if (empty($aAdvertiser['clientid'])) {
// Set agency ID
$aAdvertiser['agencyid'] = OA_Permission::getAgencyId();
$doClients = OA_Dal::factoryDO('clients');
$doClients->setFrom($aAdvertiser);
$doClients->updated = OA::getNow();
// Insert
$aAdvertiser['clientid'] = $doClients->insert();
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strAdvertiserHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, 'advertiser-edit.php?clientid=' . $aAdvertiser['clientid']), htmlspecialchars($aAdvertiser['clientname']), MAX::constructURL(MAX_URL_ADMIN, 'campaign-edit.php?clientid=' . $aAdvertiser['clientid'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
// Go to next page
OX_Admin_Redirect::redirect("advertiser-index.php");
} else {
$doClients = OA_Dal::factoryDO('clients');
$doClients->get($aAdvertiser['clientid']);
$doClients->setFrom($aAdvertiser);
$doClients->updated = OA::getNow();
$doClients->update();
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strAdvertiserHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, 'advertiser-edit.php?clientid=' . $aAdvertiser['clientid']), htmlspecialchars($aAdvertiser['clientname'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
OX_Admin_Redirect::redirect('advertiser-edit.php?clientid=' . $aAdvertiser['clientid']);
}
exit;
}
示例9: _updateEntityTimestamp
/**
* Update "updated" status of entity (if necessesary)
*
* @param string $entity
* @param array $aVariables
*/
function _updateEntityTimestamp($entity, &$aVariables)
{
if (in_array($entity, $GLOBALS['_MAX']['Admin_DA']['updateEntities'])) {
$aVariables['updated'] = OA::getNow();
}
}
示例10: MAX_AclSave
function MAX_AclSave($acls, $aEntities, $page = false)
{
//$conf = $GLOBALS['_MAX']['CONF'];
$oDbh =& OA_DB::singleton();
if ($page === false) {
$page = basename($_SERVER['PHP_SELF']);
}
if ('banner-acl.php' == $page) {
$table = 'banners';
$aclsTable = 'acls';
$fieldId = 'bannerid';
} else {
if ('channel-acl.php' == $page) {
$table = 'channel';
$aclsTable = 'acls_channel';
$fieldId = 'channelid';
} else {
return false;
}
}
$aclsObjectId = $aEntities[$fieldId];
$sLimitation = OA_aclGetSLimitationFromAAcls($acls);
$doTable = OA_Dal::factoryDO($table);
$doTable->{$fieldId} = $aclsObjectId;
$found = $doTable->find(true);
if ($sLimitation == $doTable->compiledlimitation) {
return true;
// No changes to the ACL
}
$doAcls = OA_Dal::factoryDO($aclsTable);
$doAcls->whereAdd($fieldId . ' = ' . $aclsObjectId);
$doAcls->delete(true);
if (!empty($acls)) {
foreach ($acls as $acl) {
$deliveryLimitationPlugin =& OA_aclGetComponentFromRow($acl);
$doAcls = OA_Dal::factoryDO($aclsTable);
$doAcls->{$fieldId} = $aclsObjectId;
$doAcls->logical = $acl['logical'];
$doAcls->type = $acl['type'];
$doAcls->comparison = $acl['comparison'];
$doAcls->data = $deliveryLimitationPlugin->getData();
$doAcls->executionorder = $acl['executionorder'];
$id = $doAcls->insert();
if (!$id) {
return false;
}
}
}
$doTable->acl_plugins = MAX_AclGetPlugins($acls);
$doTable->compiledlimitation = $sLimitation;
$doTable->update();
// When a channel limitation changes - All banners with this channel must be re-learnt
if ($page == 'channel-acl.php') {
$affected_ads = array();
$table = modifyTableName('acls');
$query = "\n SELECT\n DISTINCT(bannerid)\n FROM\n {$table}\n WHERE\n type = 'Site:Channel'\n AND (data = '{$aclsObjectId}' OR data LIKE '%,{$aclsObjectId}' OR data LIKE '%,{$aclsObjectId},%' OR data LIKE '{$aclsObjectId},%')\n ";
$res = $oDbh->query($query);
if (PEAR::isError($res)) {
return $res;
}
while ($row = $res->fetchRow()) {
$doBanners = OA_Dal::staticGetDO('banners', $row['bannerid']);
if ($doBanners->bannerid == $row['bannerid']) {
$doBanners->acls_updated = OA::getNow();
$doBanners->update();
}
}
}
return true;
}
示例11: rejectEmptyVarConversions
/**
* A method to reject conversions which variables which are required to be
* non-empty, but which are in reality, empty, between the supplied operation
* interval start and end dates.
*
* @param PEAR::Date $oStart The start date/time of the operation interval.
* @param PEAR::Date $oEnd The end date/time of the operation interval.
*/
function rejectEmptyVarConversions($oStart, $oEnd)
{
$aConf = $GLOBALS['_MAX']['CONF'];
$query = "\n UPDATE\n {$aConf['table']['prefix']}{$aConf['table']['data_intermediate_ad_connection']} AS diac\n JOIN\n {$aConf['table']['prefix']}{$aConf['table']['variables']} AS v\n ON\n (\n diac.tracker_id = v.trackerid\n )\n LEFT JOIN\n {$aConf['table']['prefix']}{$aConf['table']['data_intermediate_ad_variable_value']} AS diavv\n ON\n (\n diac.data_intermediate_ad_connection_id = diavv.data_intermediate_ad_connection_id\n AND\n v.variableid = diavv.tracker_variable_id\n )\n SET\n diac.connection_status = " . MAX_CONNECTION_STATUS_DISAPPROVED . ",\n diac.updated = '" . OA::getNow() . "',\n diac.comments = CONCAT('Rejected because ', COALESCE(NULLIF(v.description, ''), v.name), ' is empty')\n WHERE\n diac.tracker_date_time >= " . $this->oDbh->quote($oStart->format('%Y-%m-%d %H:%M:%S'), 'timestamp') . "\n AND\n diac.tracker_date_time <= " . $this->oDbh->quote($oEnd->format('%Y-%m-%d %H:%M:%S'), 'timestamp') . "\n AND\n diac.inside_window = 1\n AND\n v.reject_if_empty = 1\n AND\n (diavv.value IS NULL OR diavv.value = '')\n ";
$message = '- Rejecting conversions with empty required variables between ' . $oStart->format('%Y-%m-%d %H:%M:%S') . ' ' . $oStart->tz->getShortName() . ' and ' . $oEnd->format('%Y-%m-%d %H:%M:%S') . ' ' . $oEnd->tz->getShortName();
OA::debug($message, PEAR_LOG_DEBUG);
$rows = $this->oDbh->exec($query);
if (PEAR::isError($rows)) {
return MAX::raiseError($rows, MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
}
示例12: updateLastRun
/**
* A method to update maintenance last run information for
* old maintenance code.
*/
function updateLastRun($bScheduled = false)
{
$sField = $bScheduled ? 'maintenance_cron_timestamp' : 'maintenance_timestamp';
OA_Dal_ApplicationVariables::set($sField, OA::getNow('U'));
// Make sure that the maintenance delivery cache is regenerated
MAX_cacheCheckIfMaintenanceShouldRun(false);
}
示例13: test_getAuditLogForAuditWidget
function test_getAuditLogForAuditWidget()
{
$dllAuditPartialMock = new PartialMockOA_Dll_Audit($this);
$oSpanDay = new Date_Span('1-0-0-0');
$oDate = new Date(OA::getNow());
$oDate->toUTC();
$oDate->subtractSpan(new Date_Span('8-0-0-0'));
// add 1 hour to make sure that the test passes even if it takes some time
$oDate->addSpan(new Date_Span('0-1-0-0'));
// record 1 - more than 7 days old so should not be returned
$oAudit = OA_Dal::factoryDO('audit');
$oAudit->account_id = 1;
$oAudit->context = 'campaigns';
$oAudit->contextid = 1;
$oAudit->parentid = null;
$oAudit->username = 'user1';
$oAudit->actionid = OA_AUDIT_ACTION_UPDATE;
$oAudit->updated = $oDate->getDate();
$aDetails['campaignname'] = 'Campaign 1';
$aDetails['status'] = OA_ENTITY_STATUS_EXPIRED;
$oAudit->details = serialize($aDetails);
$oAudit->insert();
// record 2
$oDate->addSpan($oSpanDay);
$oAudit->updated = $oDate->getDate();
$oAudit->username = 'user2';
$aDetails['status'] = OA_ENTITY_STATUS_RUNNING;
$oAudit->details = serialize($aDetails);
$idAudit = $oAudit->insert();
$aExpect[$idAudit] = $oAudit->toArray();
$aExpect[$idAudit]['details'] = $aDetails;
// record 3
$oDate->addSpan($oSpanDay);
$oAudit->updated = $oDate->getDate();
$oAudit->username = 'user3';
$aDetails['status'] = OA_ENTITY_STATUS_PAUSED;
$oAudit->details = serialize($aDetails);
$idAudit = $oAudit->insert();
$aExpect[$idAudit] = $oAudit->toArray();
$aExpect[$idAudit]['details'] = $aDetails;
// record 4
$oDate->addSpan($oSpanDay);
$oAudit->contextid = 2;
$oAudit->updated = $oDate->getDate();
$aDetails['campaignname'] = 'Campaign 2';
$aDetails['status'] = OA_ENTITY_STATUS_RUNNING;
$oAudit->details = serialize($aDetails);
$idAudit = $oAudit->insert();
$aExpect[$idAudit] = $oAudit->toArray();
$aExpect[$idAudit]['details'] = $aDetails;
// record 5
$oDate->addSpan($oSpanDay);
$oAudit->updated = $oDate->getDate();
$oAudit->username = 'user2';
$aDetails['status'] = OA_ENTITY_STATUS_EXPIRED;
$oAudit->details = serialize($aDetails);
$idAudit = $oAudit->insert();
$aExpect[$idAudit] = $oAudit->toArray();
$aExpect[$idAudit]['details'] = $aDetails;
// record 6
$oDate->addSpan($oSpanDay);
$oAudit->account_id = 2;
$oAudit->contextid = 3;
$oAudit->username = 'user1';
$oAudit->updated = $oDate->getDate();
$aDetails['campaignname'] = 'Campaign 3';
$aDetails['status'] = OA_ENTITY_STATUS_RUNNING;
$oAudit->details = serialize($aDetails);
$idAudit = $oAudit->insert();
$aExpect[$idAudit] = $oAudit->toArray();
$aExpect[$idAudit]['details'] = $aDetails;
// record 7 - is a maintenance audit rec so should not be returned
$oDate->addSpan($oSpanDay);
$oAudit->username = 'Maintenance';
$oAudit->contextid = 1;
$oAudit->updated = $oDate->getDate();
$aDetails['campaignname'] = 'Campaign 1';
$aDetails['status'] = OA_ENTITY_STATUS_RUNNING;
$oAudit->details = serialize($aDetails);
$oAudit->insert();
$aParams = array();
$aResults = $dllAuditPartialMock->getAuditLogForAuditWidget($aParams);
$this->assertIsA($aResults, 'array');
$this->assertEqual(count($aResults), 5);
foreach ($aResults as $i => $aResRow) {
$aExpRow = $aExpect[$aResRow['auditid']];
$this->assertEqual($aResRow['auditid'], $aExpRow['auditid']);
$this->assertEqual($aResRow['actionid'], $aExpRow['actionid']);
$this->assertEqual($aResRow['context'], $dllAuditPartialMock->getContextDescription($aExpRow['context']));
$this->assertEqual($aResRow['contextid'], $aExpRow['contextid']);
$this->assertEqual($aResRow['parentid'], $aExpRow['parentid']);
$this->assertEqual($aResRow['username'], $aExpRow['username']);
$this->assertEqual($aResRow['details']['campaignname'], $aExpRow['details']['campaignname']);
$this->assertEqual($aResRow['details']['status'], $aExpRow['details']['status']);
$oDate = new Date($aResRow['updated']);
$oDate->toUTC();
$this->assertEqual($oDate->getDate(), $aExpRow['updated']);
}
// Check that the account_id filter is working
$aParams = array('account_id' => 2);
//.........这里部分代码省略.........
示例14: basename
// Initialise some parameters
$pageName = basename($_SERVER['PHP_SELF']);
$tabindex = 1;
$aEntities = array('clientid' => $clientid, 'campaignid' => $campaignid, 'bannerid' => $bannerid);
if (!empty($action)) {
$acl = MAX_AclAdjust($acl, $action);
} elseif (!empty($submit)) {
$acl = isset($acl) ? $acl : array();
// Only save when inputs are valid
if (OX_AclCheckInputsFields($acl, $pageName) === true) {
$aBannerPrev = MAX_cacheGetAd($bannerid, false);
MAX_AclSave($acl, $aEntities);
$block = _initCappingVariables($time, $cap, $session_capping);
$values = array();
$acls_updated = false;
$now = OA::getNow();
if ($aBannerPrev['block_ad'] != $block) {
$values['block'] = $block;
$acls_updated = $block == 0 ? true : $acls_updated;
}
if ($aBannerPrev['cap_ad'] != $cap) {
$values['capping'] = $cap;
$acls_updated = $cap == 0 ? true : $acls_updated;
}
if ($aBannerPrev['session_cap_ad'] != $session_capping) {
$values['session_capping'] = $session_capping;
$acls_updated = $session_capping == 0 ? true : $acls_updated;
}
if ($acls_updated) {
$values['acls_updated'] = $now;
}
示例15: addConversion
/**
* TODO: Should we refactor this method in more general one?
* (maybe by creating common abstract class for all summary tables?)
*
* @param string $operation Either + or -
* @param int $basketValue
* @param int $numItems
* @param int $ad_id
* @param int $creative_id
* @param int $zone_id
* @param strin $day
* @param string $hour
* @return unknown
*/
function addConversion($operation, $basketValue, $numItems, $ad_id, $creative_id, $zone_id, $day, $hour, $table = null)
{
$prefix = $this->getTablePrefix();
if ($operation != '-') {
$operation = '+';
}
if ($table == null) {
$table = $this->table;
}
$oDbh = OA_DB::singleton();
$table = $oDbh->quoteIdentifier($prefix . $table, true);
$query = '
UPDATE ' . $table . ' SET conversions=conversions' . $operation . '1
, total_basket_value=total_basket_value' . $operation . DBC::makeLiteral($basketValue) . '
, total_num_items=total_num_items' . $operation . DBC::makeLiteral($numItems) . '
, updated = \'' . OA::getNow() . '\'
WHERE
ad_id = ' . DBC::makeLiteral($ad_id) . '
AND creative_id = ' . DBC::makeLiteral($creative_id) . '
AND zone_id = ' . DBC::makeLiteral($zone_id) . '
AND date_time = ' . DBC::makeLiteral(sprintf("%s %02d:00:00", $day, $hour));
return DBC::execute($query);
}