本文整理汇总了PHP中Piwik\Date::getUtcOffset方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::getUtcOffset方法的具体用法?PHP Date::getUtcOffset怎么用?PHP Date::getUtcOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Date
的用法示例。
在下文中一共展示了Date::getUtcOffset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$view = new View('@ScheduledReports/index');
$this->setGeneralVariablesView($view);
$siteTimezone = $this->site->getTimezone();
$view->timeZoneDifference = Date::getUtcOffset($siteTimezone) / 3600;
$view->countWebsites = count(APISitesManager::getInstance()->getSitesIdWithAtLeastViewAccess());
// get report types
$reportTypes = API::getReportTypes();
$reportTypeOptions = array();
foreach ($reportTypes as $reportType => $icon) {
$reportTypeOptions[$reportType] = mb_strtoupper($reportType);
}
$view->reportTypes = $reportTypes;
$view->reportTypeOptions = $reportTypeOptions;
$view->defaultReportType = self::DEFAULT_REPORT_TYPE;
$view->defaultReportFormat = ScheduledReports::DEFAULT_REPORT_FORMAT;
$view->displayFormats = ScheduledReports::getDisplayFormats();
$reportsByCategoryByType = array();
$reportFormatsByReportTypeOptions = array();
$reportFormatsByReportType = array();
$allowMultipleReportsByReportType = array();
foreach ($reportTypes as $reportType => $reportTypeIcon) {
// get report formats
$reportFormatsByReportType[$reportType] = API::getReportFormats($reportType);
$reportFormatsByReportTypeOptions[$reportType] = $reportFormatsByReportType[$reportType];
foreach ($reportFormatsByReportTypeOptions[$reportType] as $type => $icon) {
$reportFormatsByReportTypeOptions[$reportType][$type] = mb_strtoupper($type);
}
$allowMultipleReportsByReportType[$reportType] = API::allowMultipleReports($reportType);
// get report metadata
$reportsByCategory = array();
$availableReportMetadata = API::getReportMetadata($this->idSite, $reportType);
foreach ($availableReportMetadata as $reportMetadata) {
$reportsByCategory[$reportMetadata['category']][] = $reportMetadata;
}
$reportsByCategoryByType[$reportType] = $reportsByCategory;
}
$view->reportsByCategoryByReportType = $reportsByCategoryByType;
$view->reportFormatsByReportType = $reportFormatsByReportType;
$view->reportFormatsByReportTypeOptions = $reportFormatsByReportTypeOptions;
$view->allowMultipleReportsByReportType = $allowMultipleReportsByReportType;
$reports = array();
$reportsById = array();
if (!Piwik::isUserIsAnonymous()) {
$reports = API::getInstance()->getReports($this->idSite, $period = false, $idReport = false, $ifSuperUserReturnOnlySuperUserReports = true);
foreach ($reports as &$report) {
$report['recipients'] = API::getReportRecipients($report);
$reportsById[$report['idreport']] = $report;
}
}
$view->reports = $reports;
$view->reportsJSON = json_encode($reportsById);
$view->downloadOutputType = API::OUTPUT_INLINE;
$view->periods = ScheduledReports::getPeriodToFrequency();
$view->defaultPeriod = ScheduledReports::DEFAULT_PERIOD;
$view->defaultHour = ScheduledReports::DEFAULT_HOUR;
$view->language = LanguagesManager::getLanguageCodeForCurrentUser();
$view->segmentEditorActivated = false;
if (API::isSegmentEditorActivated()) {
$savedSegmentsById = array('' => Piwik::translate('SegmentEditor_DefaultAllVisits'));
foreach (APISegmentEditor::getInstance()->getAll($this->idSite) as $savedSegment) {
$savedSegmentsById[$savedSegment['idsegment']] = $savedSegment['name'];
}
$view->savedSegmentsById = $savedSegmentsById;
$view->segmentEditorActivated = true;
}
return $view->render();
}
示例2: adjustTimezoneBySite
protected function adjustTimezoneBySite($hour, $idSite)
{
$timezone = Site::getTimezoneFor($idSite);
$timeZoneDifference = -ceil(Date::getUtcOffset($timezone) / 3600);
return (24 + $hour + $timeZoneDifference) % 24;
}