Skip to content

Commit

Permalink
Disable TZ selection
Browse files Browse the repository at this point in the history
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
  • Loading branch information
steve-lad committed Jun 13, 2021
1 parent 3fee812 commit 0073301
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 44 deletions.
5 changes: 4 additions & 1 deletion Sccp_manager.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ public function __construct($freepbx = null) {
}

$this->sccpvalues = $this->dbinterface->get_db_SccpSetting(); // Overwrite Exist
// $this->getSccpSetingINI(false); // get from sccep.ini
$this->initializeSccpPath();
$this->initVarfromDefs();
$this->initTftpLang();
Expand Down Expand Up @@ -202,6 +201,10 @@ public function initVarfromDefs() {
$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());
}
}

/*
Expand Down
6 changes: 3 additions & 3 deletions conf/sccpgeneral.xml.v433
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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>

Expand Down
51 changes: 11 additions & 40 deletions views/formShow.php
Original file line number Diff line number Diff line change
Expand Up @@ -946,13 +946,6 @@
}
}

$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';
}
Expand All @@ -963,45 +956,23 @@
}
}

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>
Expand Down

0 comments on commit 0073301

Please sign in to comment.