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


PHP OX_OperationInterval::secondsPerOperationInterval方法代码示例

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


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

示例1: _getTrendUpperDate

 /**
  * A private method to calculate the operation interval start date at the
  * upper bound of a range of operation intervals that require a ZIF update,
  * where the upper bound has been set back by the required number of
  * operation intervals so that current trends in differences between
  * forecast and actual delivery can be calculated.
  *
  * @access private
  * @param PEAR::Date $oDate The start date of the operation interval at the
  *                          upper bound of the operation interval range
  *                          requiring a ZIF update.
  * @return PEAR::Date The new upper bound date.
  */
 function _getTrendUpperDate($oDate)
 {
     $seconds = ZONE_FORECAST_TREND_OFFSET * OX_OperationInterval::secondsPerOperationInterval();
     $oDate->subtractSeconds($seconds);
     return $oDate;
 }
开发者ID:villos,项目名称:tree_admin,代码行数:19,代码来源:ForecastZoneImpressions.php

示例2: getRecentZones

 /**
  * A method to get all zones that have, within the last week, Zone Impression
  * Forecast data in the data_summary_zone_impression_history table that is
  * based on the default forecast, from a given list of zone IDs.
  *
  * @param array $aZoneIDs An array of zone IDs.
  * @param PEAR::Date $oNowDate The current date/time.
  * @return mixed Either:
  *      - An array of zone IDs, or
  *      - A PEAR::Error.
  */
 function getRecentZones($aZoneIDs, $oNowDate)
 {
     $aResult = array();
     // Check parameters
     if (!is_array($aZoneIDs) || is_array($aZoneIDs) && count($aZoneIDs) == 0) {
         return $aResult;
     }
     foreach ($aZoneIDs as $zoneId) {
         if (!is_integer($zoneId) || $zoneId < 0) {
             return $aResult;
         }
     }
     if (!is_a($oNowDate, 'Date')) {
         return $aResult;
     }
     // Convert the "now" date into a date range of the last week
     $aUpperDates = OX_OperationInterval::convertDateToPreviousOperationIntervalStartAndEndDates($oNowDate);
     $oLowerDate = new Date();
     $oLowerDate->copy($aUpperDates['start']);
     $oLowerDate->subtractSeconds(SECONDS_PER_WEEK - OX_OperationInterval::secondsPerOperationInterval());
     // Select those zone IDs where data does exist
     $table = $this->_getTablename('data_summary_zone_impression_history');
     $query = "\n            SELECT DISTINCT\n                zone_id\n            FROM\n                {$table}\n            WHERE\n                zone_id IN (" . implode(', ', $aZoneIDs) . ")\n                AND\n                est = 1\n                AND\n                interval_start > " . $this->oDbh->quote($oLowerDate->format('%Y-%m-%d %H:%M:%S'), 'timestamp') . "\n                AND\n                interval_end <= " . $this->oDbh->quote($aUpperDates['start']->format('%Y-%m-%d %H:%M:%S'), 'timestamp');
     $rc = $this->oDbh->query($query);
     if (PEAR::isError($rc)) {
         return $rc;
     }
     // Add zones found to the result array
     while ($aRow = $rc->fetchRow()) {
         $aResult[] = $aRow['zone_id'];
     }
     return $aResult;
 }
开发者ID:villos,项目名称:tree_admin,代码行数:44,代码来源:Priority.php

示例3: operationIntervalsPerDay

 /**
  * A method to return the number of operation intervals
  * during per day.
  *
  * @static
  * @return integer The number of operation intervals per day.
  */
 function operationIntervalsPerDay()
 {
     return SECONDS_PER_DAY / OX_OperationInterval::secondsPerOperationInterval();
 }
开发者ID:villos,项目名称:tree_admin,代码行数:11,代码来源:OperationInterval.php

示例4: getBlockedOperationIntervalCount

 /**
  * A method to calculate the number of operation intervals, from a given
  * date to the end date of the campaign, an advertisement will be blocked
  * from delivering in.
  *
  * @param PEAR::Date $oStartDate A Date object representing the start of the
  *                               current operation interval.
  * @param PEAR::Date $oEndDate A Date object representing the end date of the
  *                             campaign the advertisement is in.
  * @return integer The number of operation intervals in which the advertisement
  *                 will be blocked from delivering in.
  */
 function getBlockedOperationIntervalCount($oStartDate, $oEndDate)
 {
     // Ensure the campaign end date is at the END of the day
     $oCampaignEndDate = new Date();
     $oCampaignEndDate->copy($oEndDate);
     $oCampaignEndDate->setHour(23);
     $oCampaignEndDate->setMinute(59);
     $oCampaignEndDate->setSecond(59);
     // Copy the starting date to use in a loop
     $oLoopDate = new Date();
     $oLoopDate->copy($oStartDate);
     // Count the number of blocked operation intervals
     $blockedIntervals = 0;
     while (!$oLoopDate->after($oCampaignEndDate)) {
         if ($this->deliveryBlocked($oLoopDate)) {
             // Update the count of blocked intervals, but
             // also store the start/end dates of the blocked
             // interval for later use
             $blockedIntervals++;
             $aDates = OX_OperationInterval::convertDateToOperationIntervalStartAndEndDates($oLoopDate);
             $this->aBlockedOperationIntervalDates[$aDates['start']->format('%Y-%m-%d %H:%M:%S')] = $aDates;
         }
         $oLoopDate->addSeconds(OX_OperationInterval::secondsPerOperationInterval());
     }
     return $blockedIntervals;
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:38,代码来源:DeliveryLimitation.php


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