当前位置: 首页>>代码示例>>PHP>>正文


PHP DBC::FindRecord方法代码示例

本文整理汇总了PHP中DBC::FindRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP DBC::FindRecord方法的具体用法?PHP DBC::FindRecord怎么用?PHP DBC::FindRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBC的用法示例。


在下文中一共展示了DBC::FindRecord方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getZoneForInvocationForm

 /**
  * Gets the details to for generating invocation code.
  *
  * @param int $zoneId  the zone ID.
  * @return array  zone details to be passed into MAX_Admin_Invocation::placeInvocationForm()
  *
  * @see MAX_Admin_Invocation::placeInvocationForm()
  */
 function getZoneForInvocationForm($zoneId)
 {
     $prefix = $this->getTablePrefix();
     $oDbh = OA_DB::singleton();
     $tableZ = $oDbh->quoteIdentifier($prefix . 'zones', true);
     $tableAf = $oDbh->quoteIdentifier($prefix . 'affiliates', true);
     $query = "\n            SELECT\n                z.affiliateid,\n                z.width,\n                z.height,\n                z.delivery,\n                af.website\n            FROM\n                {$tableZ} AS z,\n                {$tableAf} AS af\n            WHERE\n                z.zoneid = " . DBC::makeLiteral($zoneId) . "\n            AND af.affiliateid = z.affiliateid";
     $rsZone = DBC::FindRecord($query);
     return $rsZone->toArray();
 }
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:18,代码来源:Zones.php

示例2: getDeliveredByCampaign

 /**
  * A method to determine the number of impressions, clicks and conversions
  * delivered by a given campaign to date.
  *
  * Can also determine the delivery information up to a given operation
  * interval end date.
  *
  * @param integer    $campaignId The campaign ID.
  * @param PEAR::Date $oDate      An optional date. If present, limits
  *                               delivery information to that which is
  *                               in or before this maximum possible
  *                               operation interval end date.
  * @return MDB2Record
  */
 function getDeliveredByCampaign($campaignId, $oDate = null)
 {
     $prefix = $this->getTablePrefix();
     $oDbh = OA_DB::singleton();
     $tableB = $oDbh->quoteIdentifier($prefix . 'banners', true);
     $tableD = $oDbh->quoteIdentifier($prefix . 'data_intermediate_ad', true);
     $query = "\n            SELECT\n                SUM(dia.impressions) AS impressions_delivered,\n                SUM(dia.clicks) AS clicks_delivered,\n                SUM(dia.conversions) AS conversions_delivered\n            FROM\n                {$tableB} AS b,\n                {$tableD} AS dia\n            WHERE\n                b.campaignid = " . DBC::makeLiteral($campaignId) . "\n                AND\n                b.bannerid = dia.ad_id";
     if (!is_null($oDate)) {
         $query .= "\n                AND\n                dia.interval_end <= '" . $oDate->format('%Y-%m-%d %H:%M:%S') . "'";
     }
     return DBC::FindRecord($query);
 }
开发者ID:villos,项目名称:tree_admin,代码行数:26,代码来源:Data_intermediate_ad.php

示例3: getDaysLeftString

 /**
  * A method to determine how long it will be until a campaign "expires".
  *
  * Returns the earliest possible date from the following values:
  *  - The campaign's expiration date, if set.
  *  - The eStimated expiration date based on lifetime impression delivery
  *    rate, if applicable.
  *  - The eStimated expiration date based on lifetime click delivery rate
  *    if applicable.
  *  - The eStimated expiration date based on lifetime conversion rate,
  *    if applicable.
  *
  * Usage:
  *   $desc = $dalCampaigns->getDaysLeftString($campaignid);
  *
  * Where:
  *   $desc is a string to display giving how the expiration was calculated
  *     eg. "Estimated expiration", or that there is no expiration date
  *
  * @param integer $campaignId The campaign ID.
  * @return string
  */
 function getDaysLeftString($campaignId)
 {
     global $date_format, $strNoExpiration, $strDaysLeft, $strEstimated, $strExpirationDate, $strNoExpirationEstimation, $strDaysAgo, $strCampaignStop;
     $prefix = $this->getTablePrefix();
     // Define array to store possible expiration date results
     $aExpiration = array();
     // Get the campaign target info
     $now = OA::getNow('Y-m-d');
     $doCampaigns = OA_Dal::factoryDO('campaigns');
     $doCampaigns->selectAdd("views AS impressions");
     $doCampaigns->get($campaignId);
     $aCampaignData = $doCampaigns->toArray();
     if (!empty($aCampaignData['expire_time'])) {
         $oNow = new Date($now);
         $oNow->setHour(0);
         $oNow->setMinute(0);
         $oNow->setSecond(0);
         $oDate = new Date($aCampaignData['expire_time']);
         $oDate->setTZbyID('UTC');
         $oDate->convertTZ($oNow->tz);
         $oDate->setHour(0);
         $oDate->setMinute(0);
         $oDate->setSecond(0);
         $oSpan = new Date_Span();
         $oSpan->setFromDateDiff($oNow, $oDate);
         $aCampaignData['expire_f'] = $oDate->format($date_format);
         $aCampaignData['days_left'] = $oSpan->toDays() * ($oDate->before($oNow) ? -1 : 1);
     }
     $oDbh = OA_DB::singleton();
     $tableB = $oDbh->quoteIdentifier($prefix . 'banners', true);
     $tableD = $oDbh->quoteIdentifier($prefix . 'data_intermediate_ad', true);
     // Define array to return the expiration dates (if they exist)
     $aReturn = array('estimatedExpiration' => '', 'campaignExpiration' => '');
     // Does the campaign have lifetime impression targets?
     // If yes, try to get a stimated expiration date
     if ($aCampaignData['impressions'] > 0) {
         $query = "\n        \t    SELECT\n        \t        SUM(dia.impressions) AS delivered,\n        \t        DATE_FORMAT(MIN(dia.date_time), '%Y-%m-%d') AS day_of_first\n        \t    FROM\n        \t        {$tableD} AS dia,\n        \t        {$tableB} AS b\n        \t    WHERE\n        \t        dia.ad_id = b.bannerid\n        \t        AND\n        \t        b.campaignid = " . DBC::makeLiteral($campaignId);
         $rsImpressions = DBC::FindRecord($query);
         if ($rsImpressions) {
             $aImpressions = $rsImpressions->toArray();
             // Get the number of days until the campaign will end
             // based on the impression target delivery data
             $aExpiration = $this->_calculateRemainingDays($aImpressions, $aCampaignData['impressions']);
         }
     } elseif ($aCampaignData['clicks'] > 0) {
         $query = "\n        \t    SELECT\n        \t        SUM(dia.clicks) AS delivered,\n        \t        DATE_FORMAT(MIN(dia.date_time), '%Y-%m-%d') AS day_of_first\n        \t    FROM\n        \t        {$tableD} AS dia,\n        \t        {$tableB} AS b\n        \t    WHERE\n        \t        dia.ad_id = b.bannerid\n        \t        AND\n        \t        b.campaignid = " . DBC::makeLiteral($campaignId);
         $rsClicks = DBC::FindRecord($query);
         if ($rsClicks) {
             $aClicks = $rsClicks->toArray();
             // Get the number of days until the campaign will end
             // based on the click target delivery data
             $aExpiration = $this->_calculateRemainingDays($aClicks, $aCampaignData['clicks']);
         }
     } elseif ($aCampaignData['conversions'] > 0) {
         $query = "\n        \t    SELECT\n        \t        SUM(dia.conversions) AS delivered,\n        \t        DATE_FORMAT(MIN(dia.date_time), '%Y-%m-%d') AS day_of_first\n        \t    FROM\n        \t        {$tableD} AS dia,\n        \t        {$tableB} AS b\n        \t    WHERE\n        \t        dia.ad_id = b.bannerid\n        \t        AND\n        \t        b.campaignid = " . DBC::makeLiteral($campaignId);
         $rsConversions = DBC::FindRecord($query);
         if ($rsConversions) {
             $aConversions = $rsConversions->toArray();
             // Get the number of days until the campaign will end
             // based on the conversion target delivery data
             $aExpiration = $this->_calculateRemainingDays($aConversions, $aCampaignData['conversions']);
         }
     }
     // flags to control if the campaign expiration date and
     // the estimated expiration date are going to be showed
     $existExpirationDate = false;
     $showEtimatedDate = false;
     // is there a expiration date?
     if (!empty($aCampaignData['expire_time'])) {
         $existExpirationDate = true;
     }
     if ($existExpirationDate) {
         // has the expiration date been reached?
         if ((int) $aCampaignData['days_left'] < 0) {
             $aReturn['campaignExpiration'] = $strCampaignStop . ": " . $aCampaignData['expire_f'];
             $aReturn['campaignExpiration'] = $aReturn['campaignExpiration'] . " (" . abs((int) round($aCampaignData['days_left'])) . " {$strDaysAgo})";
         } else {
             $aReturn['campaignExpiration'] = $strExpirationDate . ": " . $aCampaignData['expire_f'];
//.........这里部分代码省略.........
开发者ID:akirsch,项目名称:revive-adserver,代码行数:101,代码来源:Campaigns.php


注:本文中的DBC::FindRecord方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。