• File: Timezone.php
  • Full Path: /var/www/crm_set/application/services/messages/Timezone.php
  • Date Modified: 09/21/2026 4:20 AM
  • File size: 1.11 KB
  • MIME-type: text/x-php
  • Charset: utf-8
<?php

namespace app\services\messages;

defined('BASEPATH') or exit('No direct script access allowed');

use app\services\messages\AbstractMessage;

class Timezone extends AbstractMessage
{
    private $timezonesList = [];

    public function __construct()
    {
        $this->timezonesList = array_flatten(get_timezones_list());
    }

    public function isVisible()
    {
        return get_option('default_timezone') == '' || !in_array(get_option('default_timezone'), $this->timezonesList);
    }

    public function getMessage()
    {
        $html = '';
        if (get_option('default_timezone') == '') {
            $html .= '<strong>Default timezone not set. Navigate to Setup->Settings->Localization to set default system timezone.</strong>';
        } else {
            if (!in_array(get_option('default_timezone'), $this->timezonesList)) {
                $html .= '<strong>We updated the timezone logic for the app. Seems like your previous timezone do not fit with the new logic. Navigate to Setup->Settings->Localization to set new proper timezone.</strong>';
            }
        }

        return $html;
    }
}