Piwik\Site::getTimezone PHP Method

getTimezone() public method

Returns the timezone of the size.
public getTimezone ( ) : string
return string
    public function getTimezone()
    {
        return $this->get('timezone');
    }

Usage Example

Example #1
0
 /**
  * Returns true if it is likely that the data for this report has been purged and if the
  * user should be told about that.
  *
  * In order for this function to return true, the following must also be true:
  * - The data table for this report must either be empty or not have been fetched.
  * - The period of this report is not a multiple period.
  * - The date of this report must be older than the delete_reports_older_than config option.
  * @param  DataTableInterface $dataTable
  * @return bool
  */
 public static function hasReportBeenPurged($dataTable)
 {
     $strPeriod = Common::getRequestVar('period', false);
     $strDate = Common::getRequestVar('date', false);
     if (false !== $strPeriod && false !== $strDate && (is_null($dataTable) || !empty($dataTable) && $dataTable->getRowsCount() == 0)) {
         // if range, only look at the first date
         if ($strPeriod == 'range') {
             $idSite = Common::getRequestVar('idSite', '');
             if (intval($idSite) != 0) {
                 $site = new Site($idSite);
                 $timezone = $site->getTimezone();
             } else {
                 $timezone = 'UTC';
             }
             $period = new Range('range', $strDate, $timezone);
             $reportDate = $period->getDateStart();
         } elseif (Period::isMultiplePeriod($strDate, $strPeriod)) {
             // if a multiple period, this function is irrelevant
             return false;
         } else {
             // otherwise, use the date as given
             $reportDate = Date::factory($strDate);
         }
         $reportYear = $reportDate->toString('Y');
         $reportMonth = $reportDate->toString('m');
         if (static::shouldReportBePurged($reportYear, $reportMonth)) {
             return true;
         }
     }
     return false;
 }
All Usage Examples Of Piwik\Site::getTimezone