本文整理汇总了PHP中Date::setTZbyID方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::setTZbyID方法的具体用法?PHP Date::setTZbyID怎么用?PHP Date::setTZbyID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date
的用法示例。
在下文中一共展示了Date::setTZbyID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSpan
/**
* A method that can be inherited and used by children classes to get the
* required date span of a statistics page.
*
* @param object $oCaller The calling object. Expected to have the
* the following class variables:
* $oCaller->aPlugins - An array of statistics fields plugins
* $oCaller->oStartDate - Will be set by method
* $oCaller->spanDays - Will be set by method
* $oCaller->spanWeeks - Will be set by method
* $oCaller->spanMonths - Will be set by method
* @param array $aParams An array of query parameters for
* {@link Admin_DA::fromCache()}.
*/
function getSpan(&$oCaller, $aParams)
{
$oStartDate = new Date(date('Y-m-d'));
$oStartDate->setHour(0);
$oStartDate->setMinute(0);
$oStartDate->setSecond(0);
// Check span using all plugins
foreach ($oCaller->aPlugins as $oPlugin) {
$aPluginParams = call_user_func(array($oPlugin, 'getHistorySpanParams'));
$aSpan = Admin_DA::fromCache('getHistorySpan', $aParams + $aPluginParams);
if (!empty($aSpan['start_date'])) {
$oDate = new Date($aSpan['start_date']);
$oDate->setTZbyID('UTC');
if ($oDate->before($oStartDate)) {
$oDate->convertTZ($oStartDate->tz);
$oStartDate = new Date($oDate);
}
}
}
$oStartDate->setHour(0);
$oStartDate->setMinute(0);
$oStartDate->setSecond(0);
$oNow = new Date();
$oSpan = new Date_Span(new Date($oStartDate), new Date($oNow->format('%Y-%m-%d')));
// Store the span data required for stats display
$oCaller->oStartDate = $oStartDate;
$oCaller->spanDays = (int) ceil($oSpan->toDays());
$oCaller->spanWeeks = (int) ceil($oCaller->spanDays / 7) + ($oCaller->spanDays % 7 ? 1 : 0);
$oCaller->spanMonths = ($oNow->getYear() - $oStartDate->getYear()) * 12 + ($oNow->getMonth() - $oStartDate->getMonth()) + 1;
// Set the caller's aDates span in the event that it's empty
if (empty($oCaller->aDates)) {
$oCaller->aDates['day_begin'] = $oStartDate->format('%Y-%m-%d');
$oCaller->aDates['day_end'] = $oNow->format('%Y-%m-%d');
}
}
示例2: Date
/**
* ???
*
* @param integer $zoneId The ID of the zone to be tested.
* @param unknown_type $campaignid ???
* @param unknown_type $newStart ???
* @param unknown_type $newEnd ???
* @return unknown ???
*/
function _checkEmailZoneAdAssoc($zoneId, $campaignid, $newStart = false, $newEnd = false)
{
// Suppress PEAR error handling for this method...
PEAR::pushErrorHandling(null);
require_once 'Date.php';
// This is an email zone, so check all current linked ads for active date ranges
$aOtherAds = Admin_DA::getAdZones(array('zone_id' => $zoneId));
$campaignVariables = Admin_DA::getPlacement($campaignid);
if ($newStart) {
$campaignVariables['activate_time'] = $newStart;
}
if ($newEnd) {
$campaignVariables['expire_time'] = $newEnd;
}
if (empty($campaignVariables['activate_time']) && empty($campaignVariables['expire_time'])) {
return PEAR::raiseError($GLOBALS['strEmailNoDates'], MAX_ERROR_EMAILNODATES);
}
$campaignStart = new Date($campaignVariables['activate_time']);
$campaignStart->setTZbyID('UTC');
$campaignEnd = new Date($campaignVariables['expire_time']);
$campaignEnd->setTZbyID('UTC');
$okToLink = true;
foreach ($aOtherAds as $azaID => $aAdVariables) {
$aOtherAdVariables = Admin_DA::getAd($aAdVariables['ad_id']);
if ($aOtherAdVariables['placement_id'] == $campaignid) {
continue;
}
$otherCampaignVariables = Admin_DA::getPlacement($aOtherAdVariables['placement_id']);
if (empty($otherCampaignVariables['activate_time']) || empty($otherCampaignVariables['expire_time'])) {
$okToLink = false;
break;
}
// Do not allow link if either start or end date is within another linked campaign dates
$otherCampaignStart = new Date($otherCampaignVariables['activate_time']);
$otherCampaignStart->setTZbyID('UTC');
$otherCampaignEnd = new Date($otherCampaignVariables['expire_time']);
$otherCampaignEnd->setTZbyID('UTC');
if ($campaignStart->after($otherCampaignStart) && $campaignStart->before($otherCampaignEnd) || $campaignStart->equals($otherCampaignStart)) {
$okToLink = false;
break;
}
if ($campaignEnd->after($otherCampaignStart) && $campaignEnd->before($otherCampaignEnd) || $campaignEnd->equals($otherCampaignEnd)) {
$okToLink = false;
break;
}
}
if (!$okToLink) {
$link = "campaign-edit.php?clientid={$otherCampaignVariables['advertiser_id']}&campaignid={$otherCampaignVariables['placement_id']}";
return PEAR::raiseError($GLOBALS['strDatesConflict'] . ": <a href='{$link}'>" . $otherCampaignVariables['name'] . "</a>", MAX_ERROR_EXISTINGCAMPAIGNFORDATES);
}
PEAR::popErrorHandling();
return true;
}
示例3: getDateGMT
/**
* Method used to convert the user date (that might be in a
* specific timezone) to a GMT date.
*
* @access public
* @param string $date The user based date
* @return string The date in the GMT timezone
*/
function getDateGMT($date)
{
$dt = new Date($date);
$dt->setTZbyID(Date_API::getPreferredTimezone());
$dt->toUTC();
return $dt->format('%Y-%m-%d %H:%M:%S');
}
示例4: MIN
/**
* A private method to prepare the report range information from an
* OA_Admin_DaySpan object.
*
* @access private
* @param OA_Admin_DaySpan $oDaySpan The OA_Admin_DaySpan object to set
* the report range information from.
*/
function _prepareReportRange($oDaySpan)
{
global $date_format;
if (!empty($oDaySpan)) {
$this->_oDaySpan = $oDaySpan;
$this->_startDateString = $oDaySpan->getStartDateString($date_format);
$this->_endDateString = $oDaySpan->getEndDateString($date_format);
} else {
$oDaySpan = new OA_Admin_DaySpan();
// take as the start date the date when adds were serverd
$aConf = $GLOBALS['_MAX']['CONF'];
$oDbh = OA_DB::singleton();
$query = "SELECT MIN(date_time) as min_datetime FROM " . $oDbh->quoteIdentifier($aConf['table']['prefix'] . $aConf['table']['data_summary_ad_hourly'], true) . " WHERE 1=1";
$startDate = $oDbh->queryRow($query);
$startDate = $startDate['min_datetime'];
$oStartDate = new Date($startDate);
$oEndDate = new Date();
$oDaySpan->setSpanDays($oStartDate, $oEndDate);
$this->_oDaySpan =& $oDaySpan;
$this->_startDateString = MAX_Plugin_Translation::translate('Beginning', $this->module, $this->package);
$this->_endDateString = $oDaySpan->getEndDateString($date_format);
}
$utcUpdate = OA_Dal_ApplicationVariables::get('utc_update');
if (!empty($utcUpdate)) {
$oUpdate = new Date($utcUpdate);
$oUpdate->setTZbyID('UTC');
// Add 12 hours
$oUpdate->addSeconds(3600 * 12);
$startDate = new Date($oDaySpan->oStartDate);
$endDate = new Date($oDaySpan->oEndDate);
if ($oUpdate->after($endDate) || $oUpdate->after($startDate)) {
$this->_displayInaccurateStatsWarning = true;
}
}
}
示例5: getEcpm
/**
* Calculates the effective CPM (eCPM)
*
* @param int $revenueType revenue type (CPM, CPA, etc) as defined in constants.php.
* @param double $revenue revenue amount, eg 1.55. CPM, CPC, CPA: the rate. Tenancy: the total.
* @param int $impressions the number of impressions.
* @param int $clicks the number of clicks
* @param int $conversions the number of conversions.
* @param string $startDate start date of the campaign. Required for tenancy.
* @param string $endDate end date of the campaign. Required for tenancy.
* @param double defaultClickRatio click ratio to use when there are no impressions.
* If null, uses the value in the config file.
* @param double defaultConversionRatio conversion ratio to use when there are no impressions.
* If null, uses the value in the config file.
*
* @return double the eCPM
*/
public static function getEcpm($revenueType, $revenue, $impressions = 0, $clicks = 0, $conversions = 0, $startDate = null, $endDate = null, $defaultClickRatio = null, $defaultConversionRatio = null)
{
$ecpm = 0.0;
switch ($revenueType) {
case MAX_FINANCE_CPM:
// eCPM = CPM
return $revenue;
break;
case MAX_FINANCE_CPC:
if ($impressions != 0) {
$ecpm = $revenue * $clicks / $impressions * 1000;
} else {
if (!$defaultClickRatio) {
$defaultClickRatio = $GLOBALS['_MAX']['CONF']['priority']['defaultClickRatio'];
}
$ecpm = $defaultClickRatio * $revenue * 1000;
}
break;
case MAX_FINANCE_CPA:
if ($impressions != 0) {
$ecpm = $revenue * $conversions / $impressions * 1000;
} else {
if (!$defaultConversionRatio) {
$defaultConversionRatio = $GLOBALS['_MAX']['CONF']['priority']['defaultConversionRatio'];
}
$ecpm = $defaultConversionRatio * $revenue * 1000;
}
break;
case MAX_FINANCE_MT:
if ($impressions != 0) {
if ($startDate && $endDate) {
$oStart = new Date($startDate);
$oStart->setTZbyID('UTC');
$oEnd = new Date($endDate);
$oEnd->setTZbyID('UTC');
$oNow = new Date(date('Y-m-d'));
$oNow->setTZbyID('UTC');
$daysInCampaign = new Date_Span();
$daysInCampaign->setFromDateDiff($oStart, $oEnd);
$daysInCampaign = ceil($daysInCampaign->toDays());
$daysSoFar = new Date_Span();
$daysSoFar->setFromDateDiff($oStart, $oNow);
$daysSoFar = ceil($daysSoFar->toDays());
$ecpm = $revenue / $daysInCampaign * $daysSoFar / $impressions * 1000;
} else {
// Not valid without start and end dates.
$ecpm = 0.0;
}
} else {
$ecpm = 0.0;
}
break;
}
return $ecpm;
}
示例6: Date
/**
* A method to check if the campaign is expired
*
* @return bool
*/
function _isExpired()
{
static $oServiceLocator;
if (!empty($this->expire_time) && $this->expire_time != OX_DATAOBJECT_NULL) {
if (!isset($oServiceLocator)) {
$oServiceLocator =& OA_ServiceLocator::instance();
}
if (!($oNow = $oServiceLocator->get('now'))) {
$oNow = new Date();
}
$oNow->toUTC();
$oExpire = new Date($this->expire_time);
$oExpire->setTZbyID('UTC');
if ($oNow->after($oExpire)) {
return true;
}
}
return false;
}
示例7: testPrepareCampaignDeliveryEmail
//.........这里部分代码省略.........
$adId1 = DataGenerator::generateOne($doBanners);
$doDataSummaryAdHourly = OA_Dal::factoryDO('data_summary_ad_hourly');
$doDataSummaryAdHourly->date_time = '2007-05-14 02:00:00';
$doDataSummaryAdHourly->ad_id = $adId1;
$doDataSummaryAdHourly->impressions = 5000;
$doDataSummaryAdHourly->clicks = 0;
$doDataSummaryAdHourly->conversions = 0;
DataGenerator::generateOne($doDataSummaryAdHourly);
$doDataSummaryAdHourly->date_time = '2007-05-14 03:00:00';
$doDataSummaryAdHourly->ad_id = $adId1;
$doDataSummaryAdHourly->impressions = 5000;
$doDataSummaryAdHourly->clicks = 0;
$doDataSummaryAdHourly->conversions = 0;
DataGenerator::generateOne($doDataSummaryAdHourly);
$doDataSummaryAdHourly->date_time = '2007-05-15 03:00:00';
$doDataSummaryAdHourly->ad_id = $adId1;
$doDataSummaryAdHourly->impressions = 5000;
$doDataSummaryAdHourly->clicks = 0;
$doDataSummaryAdHourly->conversions = 0;
DataGenerator::generateOne($doDataSummaryAdHourly);
$aResult = $oEmail->prepareCampaignDeliveryEmail($aUser, $advertiserId, null, $oEndDate);
$expectedSubject = "Advertiser report: {$clientName}";
$expectedContents = "Dear {$user_name},\n\n";
$expectedContents .= "Below you will find the banner statistics for {$clientName}:\n";
global $date_format;
$startDate = $oStartDate->format($date_format);
$endDate = $oEndDate->format($date_format);
$expectedContents .= "This report includes all statistics up to {$endDate}.\n\n";
$expectedContents .= "\nCampaign [id{$placementId1}] Default Campaign\n";
$expectedContents .= "http://{$aConf['webpath']['admin']}/stats.php?clientid={$advertiserId}&campaignid={$placementId1}&statsBreakdown=day&entity=campaign&breakdown=history&period_preset=all_stats&period_start=&period_end=\n";
$expectedContents .= "=======================================================\n\n";
$expectedContents .= " Banner [id{$adId1}] Test Banner\n";
$expectedContents .= " ------------------------------------------------------\n";
$expectedContents .= " Impressions (Total): 15,000\n";
$expectedContents .= " 15-05-2007: 5,000\n";
$expectedContents .= " 14-05-2007: 10,000\n";
$expectedContents .= " Total this period: 15,000\n";
$expectedContents .= "\n\n";
$expectedContents .= "Regards,\n Andrew Hill, OpenX Limited";
$this->assertTrue(is_array($aResult));
$this->assertEqual(count($aResult), 3);
$this->assertEqual($aResult['subject'], $expectedSubject);
$this->assertEqual(str_replace("\r", "", $aResult['contents']), str_replace("\r", "", $expectedContents));
// Retest with a different timezone, same interval
$oStartDate = new Date('2007-05-10 00:00:00');
$oEndDate = new Date('2007-05-19 23:59:00');
$oStartDate->setTZbyID('PST');
$oEndDate->setTZbyID('PST');
$aResult = $oEmail->prepareCampaignDeliveryEmail($aUser, $advertiserId, $oStartDate, $oEndDate);
$expectedSubject = "Advertiser report: {$clientName}";
$expectedContents = "Dear {$user_name},\n\n";
$expectedContents .= "Below you will find the banner statistics for {$clientName}:\n";
global $date_format;
$startDate = $oStartDate->format($date_format);
$endDate = $oEndDate->format($date_format);
$expectedContents .= "This report includes statistics from {$startDate} up to {$endDate}.\n\n";
$expectedContents .= "\nCampaign [id{$placementId1}] Default Campaign\n";
$expectedContents .= "http://{$aConf['webpath']['admin']}/stats.php?clientid={$advertiserId}&campaignid={$placementId1}&statsBreakdown=day&entity=campaign&breakdown=history&period_preset=all_stats&period_start=&period_end=\n";
$expectedContents .= "=======================================================\n\n";
$expectedContents .= " Banner [id{$adId1}] Test Banner\n";
$expectedContents .= " ------------------------------------------------------\n";
$expectedContents .= " Impressions (Total): 15,000\n";
$expectedContents .= " 14-05-2007: 5,000\n";
$expectedContents .= " 13-05-2007: 10,000\n";
$expectedContents .= " Total this period: 15,000\n";
$expectedContents .= "\n\n";
$expectedContents .= "Regards,\n Andrew Hill, OpenX Limited";
$this->assertTrue(is_array($aResult));
$this->assertEqual(count($aResult), 3);
$this->assertEqual($aResult['subject'], $expectedSubject);
$this->assertEqual(str_replace("\r", "", $aResult['contents']), str_replace("\r", "", $expectedContents));
// Retest with a different timezone, shorter interval
$oStartDate = new Date('2007-05-13 00:00:00');
$oEndDate = new Date('2007-05-13 23:59:00');
$oStartDate->setTZbyID('PST');
$oEndDate->setTZbyID('PST');
$aResult = $oEmail->prepareCampaignDeliveryEmail($aUser, $advertiserId, $oStartDate, $oEndDate);
$expectedSubject = "Advertiser report: {$clientName}";
$expectedContents = "Dear {$user_name},\n\n";
$expectedContents .= "Below you will find the banner statistics for {$clientName}:\n";
global $date_format;
$startDate = $oStartDate->format($date_format);
$endDate = $oEndDate->format($date_format);
$expectedContents .= "This report includes statistics from {$startDate} up to {$endDate}.\n\n";
$expectedContents .= "\nCampaign [id{$placementId1}] Default Campaign\n";
$expectedContents .= "http://{$aConf['webpath']['admin']}/stats.php?clientid={$advertiserId}&campaignid={$placementId1}&statsBreakdown=day&entity=campaign&breakdown=history&period_preset=all_stats&period_start=&period_end=\n";
$expectedContents .= "=======================================================\n\n";
$expectedContents .= " Banner [id{$adId1}] Test Banner\n";
$expectedContents .= " ------------------------------------------------------\n";
$expectedContents .= " Impressions (Total): 15,000\n";
$expectedContents .= " 13-05-2007: 10,000\n";
$expectedContents .= " Total this period: 10,000\n";
$expectedContents .= "\n\n";
$expectedContents .= "Regards,\n Andrew Hill, OpenX Limited";
$this->assertTrue(is_array($aResult));
$this->assertEqual(count($aResult), 3);
$this->assertEqual($aResult['subject'], $expectedSubject);
$this->assertEqual(str_replace("\r", "", $aResult['contents']), str_replace("\r", "", $expectedContents));
DataGenerator::cleanUp(array('accounts', 'account_user_assoc'));
}
示例8: Date
/**
* A method to check if the campaign is expired
*
* @return bool
*/
function _isExpired()
{
static $oServiceLocator;
// MySQL null date hardcoded for optimisation
if (!empty($this->expire) && $this->expire != '0000-00-00') {
if (!isset($oServiceLocator)) {
$oServiceLocator =& OA_ServiceLocator::instance();
}
if (!($oNow = $oServiceLocator->get('now'))) {
$oNow = new Date();
}
$oExpire = new Date($this->expire);
$oExpire->setHour(23);
$oExpire->setMinute(59);
$oExpire->setSecond(59);
if (!empty($this->clientid)) {
// Set timezone
$aAccounts = $this->getOwningAccountIds();
$aPrefs = OA_Preferences::loadAccountPreferences($aAccounts[OA_ACCOUNT_ADVERTISER], true);
if (isset($aPrefs['timezone'])) {
$oExpire->setTZbyID($aPrefs['timezone']);
}
}
if ($oNow->after($oExpire)) {
return true;
}
}
return false;
}
示例9: getAuditLogForAuditWidget
/**
* requires permission checks
*
* @param array $aParam
* @return array
*/
function getAuditLogForAuditWidget($aParam = array())
{
$oAudit = OA_Dal::factoryDO('audit');
// Apply account level filters
if (!empty($aParam['account_id'])) {
$oAudit->account_id = $aParam['account_id'];
}
if (!empty($aParam['advertiser_account_id'])) {
$oAudit->advertiser_account_id = $aParam['advertiser_account_id'];
}
if (!empty($aParam['website_account_id'])) {
$oAudit->website_account_id = $aParam['website_account_id'];
}
$oDate = new Date();
$oDate->toUTC();
$oDate->subtractSpan(new Date_Span('7-0-0-0'));
$oAudit->whereAdd("username <> 'Maintenance'");
$oAudit->whereAdd('parentid IS NULL');
$oAudit->whereAdd("updated >= " . DBC::makeLiteral($oDate->format('%Y-%m-%d %H:%M:%S')));
$oAudit->orderBy('auditid DESC');
$oAudit->limit(0, 5);
$numRows = $oAudit->find();
$oNow = new Date();
$aResult = array();
while ($oAudit->fetch()) {
$aAudit = $oAudit->toArray();
$oDate = new Date($aAudit['updated']);
$oDate->setTZbyID('UTC');
$oDate->convertTZ($oNow->tz);
$aAudit['updated'] = $oDate->format('%Y-%m-%d %H:%M:%S');
$aAudit['details'] = unserialize($aAudit['details']);
$aAudit['context'] = $this->getContextDescription($aAudit['context']);
$aResult[] = $aAudit;
}
return $aResult;
}
示例10: now
function now($format = DATE_FORMAT_ISO)
{
// this will force to the server time regardless of whether date() is returning UTC time or not
$dateobj = new Date(gmdate('Y-m-d H:i:s'));
$dateobj->setTZbyID('UTC');
if (is_int($format)) {
$date = $dateobj->getDate($format);
} else {
if (is_string($format)) {
$date = $dateobj->format($format);
}
}
unset($dateobj);
return $date;
}
示例11: getContainerContent
function getContainerContent($page_id, $container_id, $page_content_id = null)
{
$page_model =& $this->getDefaultModel();
$this->auto_render = false;
$page_id = (int) $page_id;
$container_id = (int) $container_id;
if (!$page_id || !$container_id) {
return null;
}
// instantiate the page content controller
// TODO: put some methods into the page_content controller to do some of this.
$page_content =& NController::factory('page_content');
$page_content_model =& $page_content->getDefaultModel();
$page_content_pk = $page_content_model->primaryKey();
$asset_ctrl =& NController::singleton('cms_asset_template');
if (SITE_WORKFLOW && $this->nterchange) {
// get the users rights and bit compare them below
$workflow =& NController::factory('workflow');
$user_rights = $workflow->getWorkflowUserRights($page_model);
}
// load up the content
$content = '';
// set the time using a trusted source
$now = new Date(gmdate('Y-m-d H:i:s'));
$now->setTZbyID('UTC');
if ($page_content_model->getContainerContent($page_id, $container_id, $this->nterchange, $page_content_id)) {
$page_content->set('page_id', $page_id);
while ($page_content_model->fetch()) {
$page_content->set('page_content_id', $page_content_model->{$page_content_pk});
$timed_start_obj = $page_content_model->timed_start && $page_content_model->timed_start != '0000-00-00 00:00:00' ? new Date($page_content_model->timed_start) : false;
$timed_end_obj = $page_content_model->timed_end && $page_content_model->timed_end != '0000-00-00 00:00:00' ? new Date($page_content_model->timed_end) : false;
if ($timed_start_obj) {
$timed_start_obj->setTZbyID('UTC');
}
if ($timed_end_obj) {
$timed_end_obj->setTZbyID('UTC');
}
// set cache lifetimes for the page
if ($timed_start_obj) {
$time_diff = $timed_start_obj->getDate(DATE_FORMAT_UNIXTIME) - $now->getDate(DATE_FORMAT_UNIXTIME);
if ($time_diff > 0) {
$this->view_cache_lifetimes[] = $time_diff;
}
}
if ($timed_end_obj) {
$time_diff = $timed_end_obj->getDate(DATE_FORMAT_UNIXTIME) - $now->getDate(DATE_FORMAT_UNIXTIME);
if ($time_diff > 0) {
$this->view_cache_lifetimes[] = $time_diff;
}
}
if ($timed_end_obj && $timed_end_obj->before($now)) {
$timed_end_active = true;
}
// if the timed end is in the past then kill it and continue.
if ($timed_end_obj && $now->after($timed_end_obj)) {
// remove the content, which also kills the page cache
$page_content_controller =& NController::factory('page_content');
$page_content_controller->_auth =& $this->_auth;
$page_content_controller->removeContent($page_content_model->{$page_content_pk}, false, true);
unset($page_content_controller);
continue;
} else {
if ($this->nterchange || !$timed_start_obj || $timed_start_obj && $timed_start_obj->before($now)) {
$content_controller =& NController::factory($page_content_model->content_asset);
if ($content_controller && is_object($content_controller)) {
$content_model =& $content_controller->getDefaultModel();
$fields = $content_model->fields();
$pk = $content_model->primaryKey();
// if we're on the public site, don't grab workflow or draft inserts
$conditions = array();
if ($this->nterchange && in_array('cms_draft', $fields)) {
$conditions = '(cms_draft = 0 OR (cms_draft=1 AND cms_modified_by_user=' . $this->_auth->currentUserId() . '))';
} else {
$content_model->cms_draft = 0;
}
$content_model->{$pk} = $page_content_model->content_asset_id;
if ($content_model->find(array('conditions' => $conditions), true)) {
// last modified
if (strtotime($content_model->cms_modified) > $this->page_last_modified) {
$this->page_last_modified = strtotime($content_model->cms_modified);
}
$template = $asset_ctrl->getAssetTemplate($page_content_model->content_asset, $page_content_model->page_template_container_id);
if (SITE_DRAFTS && $this->nterchange) {
$is_draft = false;
$user_owned = false;
$user_id = $this->_auth->currentUserId();
$draft_model =& NModel::factory('cms_drafts');
$draft_model->asset = $content_controller->name;
$draft_model->asset_id = $content_model->{$pk};
if ($draft_model->find(null, true)) {
$is_draft = true;
// fill the local model with the draft info
$current_user_id = isset($this->_auth) && is_object($this->_auth) ? $this->_auth->currentUserID() : 0;
if ($current_user_id == $draft_model->cms_modified_by_user) {
$draft_content = unserialize($draft_model->draft);
foreach ($draft_content as $field => $val) {
$content_model->{$field} = $val;
}
$user_owned = true;
$draft_msg = 'You have saved';
//.........这里部分代码省略.........
示例12: Date
compare('-sixth', $date2->formatLikeSQL('NPSTZHspth'), 'NPSTZHspth (2)');
compare('0', $date2->formatLikeSQL('TZI'), 'TZI (2)');
compare('00', $date2->formatLikeSQL('TZM'), 'TZM (2)');
compare('0', $date2->formatLikeSQL('NPTZM'), 'NPTZM (2)');
compare('Central Standard Time', $date2->formatLikeSQL('TZN'), 'TZN (2)');
compare('-06:00', $date2->formatLikeSQL('TZO'), 'TZO (2)');
compare('-06:00', $date2->formatLikeSQL('NPTZO'), 'NPTZO (2)');
compare('21600', $date2->formatLikeSQL('TZS'), 'TZS (2)');
compare('-21600', $date2->formatLikeSQL('STZS'), 'STZS (2)');
compare('21600', $date2->formatLikeSQL('NPTZS'), 'NPTZS (2)');
compare('-21600', $date2->formatLikeSQL('NPSTZS'), 'NPSTZS (2)');
compare('TWENTY-ONE THOUSAND SIX HUNDRED', $date2->formatLikeSQL('TZSSP'), 'TZSSP (2)');
compare('MINUS TWENTY-ONE THOUSAND SIX HUNDRED', $date2->formatLikeSQL('NPSTZSSP'), 'NPSTZSSP (2)');
compare('America/Chicago', $date2->formatLikeSQL('TZR'), 'TZR (2)');
$date3 = new Date($date);
$date3->setTZbyID("UTC");
compare('UTC', $date3->formatLikeSQL('TZC'), 'TZC (formatLikeDate)');
compare('00', $date3->formatLikeSQL('TZH'), 'TZH (formatLikeDate)');
compare('+00', $date3->formatLikeSQL('STZH'), 'STZH (formatLikeDate)');
compare('0', $date3->formatLikeSQL('NPTZH'), 'NPTZH (formatLikeDate)');
compare('+0', $date3->formatLikeSQL('NPSTZH'), 'NPSTZH (formatLikeDate)');
compare('ZERO', $date3->formatLikeSQL('NPTZHSP'), 'NPTZHSP (formatLikeDate)');
compare('+ZEROTH', $date3->formatLikeSQL('NPSTZHSPTH'), 'NPSTZHSPTH (formatLikeDate)');
compare('0', $date3->formatLikeSQL('TZI'), 'TZI (formatLikeDate)');
compare('00', $date3->formatLikeSQL('TZM'), 'TZM (formatLikeDate)');
compare('0', $date3->formatLikeSQL('NPTZM'), 'NPTZM (formatLikeDate)');
compare('Coordinated Universal Time', $date3->formatLikeSQL('TZN'), 'TZN (formatLikeDate)');
compare('00000', $date3->formatLikeSQL('TZS'), 'TZS (formatLikeDate)');
compare(' 00000', $date3->formatLikeSQL('STZS'), 'STZS (formatLikeDate)');
compare('0', $date3->formatLikeSQL('NPTZS'), 'NPTZS (formatLikeDate)');
compare('0', $date3->formatLikeSQL('NPSTZS'), 'NPSTZS (formatLikeDate)');
示例13: array
function _convertStatsArrayToTz($aStats, $aParams, $name, $method, $args = array(), $formatted = null)
{
$aResult = array();
foreach ($aStats as $k => $v) {
unset($v['date_time']);
$oDate = new Date($k);
$oDate->setTZbyID('UTC');
$oDate->convertTZbyID($aParams['tz']);
$key = call_user_func_array(array(&$oDate, $method), $args);
if (!isset($aResult[$key])) {
$v[$name] = $key;
if ($formatted) {
$v['date_f'] = $oDate->format($formatted);
}
$aResult[$key] = $v;
} else {
foreach ($v as $kk => $vv) {
$aResult[$key][$kk] += $vv;
}
}
}
return $aResult;
}
示例14: Date
/**
* A private method for formatting date strings for the report.
*
* @access private
* @param string $dateString The date in string format to format.
* @return string The formatting date string for the report, or false if
* the date should not be shown.
*/
function _formatDateForDisplay($dateString)
{
if (empty($dateString)) {
return false;
}
global $date_format;
$oDate = new Date($dateString);
$oTz = $oDate->tz;
$oDate->setTZbyID('UTC');
$oDate->convertTZ($oTz);
$formattedDate = $oDate->format($date_format);
return $formattedDate;
}
示例15: Date
$campaign['expire'] = $data['expire'];
if (!empty($data['expire_time'])) {
$oExpireDate = new Date($data['expire_time']);
$oTz = $oExpireDate->tz;
$oExpireDate->setTZbyID('UTC');
$oExpireDate->convertTZ($oTz);
$campaign['expire_f'] = $oExpireDate->format($date_format);
$campaign['expire_date'] = $oExpireDate->format('%Y-%m-%d');
}
$campaign['status'] = $doCampaigns->status;
$campaign['an_status'] = $doCampaigns->an_status;
$campaign['as_reject_reason'] = $doCampaigns->as_reject_reason;
if (!empty($data['activate_time'])) {
$oActivateDate = new Date($data['activate_time']);
$oTz = $oActivateDate->tz;
$oActivateDate->setTZbyID('UTC');
$oActivateDate->convertTZ($oTz);
$campaign['activate_f'] = $oActivateDate->format($date_format);
$campaign['activate_date'] = $oActivateDate->format('%Y-%m-%d');
}
$campaign['priority'] = $data['priority'];
$campaign['weight'] = $data['weight'];
$campaign['target_impression'] = $data['target_impression'];
$campaign['target_click'] = $data['target_click'];
$campaign['target_conversion'] = $data['target_conversion'];
$campaign['min_impressions'] = $data['min_impressions'];
$campaign['ecpm'] = OA_Admin_NumberFormat::formatNumber($data['ecpm'], 4);
$campaign['anonymous'] = $data['anonymous'];
$campaign['companion'] = $data['companion'];
$campaign['show_capped_no_cookie'] = $data['show_capped_no_cookie'];
$campaign['comments'] = $data['comments'];