Disable TZ selection

TZ is a FreePBX property and should be only changed there.

Now only display for info with help

Ensure that at each initiation, we load the system value
This commit is contained in:
steve-lad 2021-06-13 15:39:43 +02:00
parent 3fee812cc6
commit 007330159e
3 changed files with 18 additions and 44 deletions

View file

@ -140,7 +140,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
}
$this->sccpvalues = $this->dbinterface->get_db_SccpSetting(); // Overwrite Exist
// $this->getSccpSetingINI(false); // get from sccep.ini
$this->initializeSccpPath();
$this->initVarfromDefs();
$this->initTftpLang();
@ -202,6 +201,10 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$this->sccpvalues[$key] = array('keyword' => $key, 'data' => $value, 'type' => '0', 'seq' => '0');
}
}
// Check timezone has not been changed in FreePBX and update if has
if ($this->sccpvalues['ntp_timezone'] != \date_default_timezone_get()) {
$this->sccpvalues['ntp_timezone'] = array('keyword' => 'ntp_timezone', 'seq'=>95, 'type' => 2, 'data' => \date_default_timezone_get());
}
}
/*

View file

@ -492,7 +492,7 @@ and open the template in the editor. Base Version before all crash :-)
<default>off</default>
<button value="on">Yes</button>
<button value="off">No</button>
<help>Enabling NTP settings in device configuration.</help>
<help>Enable NTP settings in device configuration.</help>
</item>
<item type="IE" id="2" seq="10">
<label>NTP Server name (ip)</label>
@ -501,7 +501,7 @@ and open the template in the editor. Base Version before all crash :-)
<default>pool.ntp.org</default>
<value>pool.ntp.org</value>
</input>
<help>NTP Server name or IP</help>
<help>NTP Server name or IP address</help>
</item>
<item type="IS" id="3" seq="10">
<name>ntp_server_mode</name>
@ -532,7 +532,7 @@ and open the template in the editor. Base Version before all crash :-)
<select>
<default>UTC</default>
</select>
<help>Date Format: Time zone</help>
<help>System Time zone - this is set by FreePBX and can be changed in Settings : Advanced Settings</help>
</item>
</page_group>

View file

@ -946,13 +946,6 @@ foreach ($items as $child) {
}
}
$time_regions = array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Russian', 'Indian', 'Pacific');
$time_zone_global = DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC);
$time_zone_ru = array('Russian/Kaliningrad', 'Russian/Moscow', 'Russian/St.Peterburg', 'Russian/Samara', 'Russian/Novosibirsk', 'Russian/Ekaterinburg', 'Russian/Irkutsk', 'Russian/Yakutsk', 'Russian/Khabarovsk', 'Russian/Vladivostok', 'Russian/Sakhalin', 'Russian/Magadan', 'Russian/Kamchatka');
$time_zone_list = array_merge($time_zone_global, $time_zone_ru);
$optgroup = '';
sort($time_zone_list);
if (empty($child->class)) {
$child->class = 'form-control';
}
@ -963,45 +956,23 @@ foreach ($items as $child) {
}
}
if (empty($child->value)) {
$child->value = \date_default_timezone_get();
// if (!empty($child->default)){
// $child->value = $child->default;
// }
}
$child->value = \date_default_timezone_get();
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="element-container">
<div class="row"> <div class="form-group">
<div class="col-md-3">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9"> <!-- <div class = "lnet form-group form-inline" data-nextid=1> --> <?php
echo '<select name="'.$res_id.'" class="'. $child->class . '" id="' . $res_id . '">';
foreach ($time_zone_list as $opt_key) {
$z = explode('/', $opt_key, 2);
if (count($z) != 2 || !in_array($z[0], $time_regions)) {
continue;
}
if ($optgroup != $z[0]) {
if ($optgroup !== '') {
echo '</optgroup>';
}
$optgroup = $z[0];
echo '<optgroup label="' . htmlentities($z[0]) . '">';
}
echo '<option value="' . htmlentities($opt_key) . '" label="' . htmlentities(str_replace('_', ' ', $z[1])) . '"' . ($opt_key == $child->value ? ' selected="selected" >' : '>'). htmlentities(str_replace('_', ' ', $opt_key)) . '</option>';
}
if ($optgroup !== '') {
echo '</optgroup>';
}
?> </select>
<!-- </div> --> </div>
</div></div>
</div>
<div class="col-md-9"> <?php
echo $child->value;
?>
</div>
</div>
</div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>