Convert formShowSysDefs to anonymous class

Allows use of methods per type, which allows clearer compartmentalisation of variables and code.
Improves loading as FreePBX instantiates only once
WIP - create a full class loaded with Sccp_Manager
This commit is contained in:
steve-lad 2021-07-04 16:46:18 +02:00
parent b6dfb51993
commit 503f227b98

View file

@ -18,74 +18,15 @@
* Help elemen HLP - Help Element * Help elemen HLP - Help Element
*/ */
// This will not work if the field already has the underscore
$npref = $form_prefix.'_';
$napref = $form_prefix.'-ar_';
if (empty($form_prefix)) {
$npref = "sccp_";
$napref ="sccp-ar_";
//} elseif ($form_prefix == 'vendorconfig') {
// $npref = 'vendorconfig';
// $napref = 'vendorconfig-ar';
}
$day_format = array("D.M.Y", "D.M.YA", "Y.M.D", "YA.M.D", "M-D-Y", "M-D-YA", "D-M-Y", "D-M-YA", "Y-M-D", "YA-M-D", "M/D/Y", "M/D/YA",
"D/M/Y", "D/M/YA", "Y/M/D", "YA/M/D", "M/D/Y", "M/D/YA");
$mysql_table = array("sccpdevice","sccpdeviceconfig");
$timeZoneOffsetList = array('-12' => 'GMT -12', '-11' => 'GMT -11', '-10' => 'GMT -10', '-09' => 'GMT -9', // Execution continues at end of file after the class definition. Anonymous class
'-08' => 'GMT -8', '-07' => 'GMT -7', '-06' => 'GMT -6', '-05' => 'GMT -5', // instantiated to allow function grouping into discrete methods, and avoid multiple includes.
'-04' => 'GMT -4', '-03' => 'GMT -3', '-02' => 'GMT -2', '-01' => 'GMT -1', $thisSccpView = new class{
'00' => 'GMT', '01' => 'GMT +1', '02' => 'GMT +2', '03' => 'GMT +3', public function __construct($parent_class = null) {
'04' => 'GMT +4', '05' => 'GMT +5', '06' => 'GMT +6', '07' => 'GMT +7',
'08' => 'GMT +8', '09' => 'GMT +9', '10' => 'GMT +10', '11'=> 'GMT +11', '12' => 'GMT +12');
$extension_list = array();
$sofkey_list = array();
$model_list = array();
$device_list = array();
$dialplan_list = array();
if (\FreePBX::Modules()->checkStatus("soundlang")) {
$syslangs = \FreePBX::Soundlang()->getLanguages();
if (!is_array($syslangs)) {
$syslangs = array();
} }
}
if (function_exists('music_list')) {
$moh_list = music_list();
// $cur = (isset($mohsilence) && $mohsilence != "" ? $mohsilence : 'default');
}
if (!is_array($moh_list)) {
$moh_list = array('default');
}
if (empty($fvalues)) {
$fvalues = $sccp_defaults;
}
$items = $itm -> children(); function addElementIE ($child, $fvalues, $sccp_defaults, $npref) {
if ($h_show==1) {
$sec_class ='';
if (!empty($items ->class)) {
$sec_class = (string)$items ->class;
}
?>
<div class="section-title" data-for="<?php echo $npref.$itm['name'];?>">
<h3><i class="fa fa-minus"></i><?php echo _($items ->label) ?></h3>
</div>
<div class="section <?php echo $sec_class;?>" data-id="<?php echo $npref.$itm['name'];?>">
<?php
}
foreach ($items as $child) {
if (empty($child->help)) {
$child->help = 'Help is not available.';
$child->meta_help = '1';
}
// $child->meta_help = '1'; // Remove comments to see original help !
if ($child['type'] == 'IE') {
$res_input = ''; $res_input = '';
$res_name = ''; $res_name = '';
$usingSysDefaults = true; $usingSysDefaults = true;
@ -107,7 +48,6 @@ foreach ($items as $child) {
$child->nameseparator = ' / '; $child->nameseparator = ' / ';
} }
$i = 0; $i = 0;
echo '<!-- Begin '.$child->label.' -->';
?> ?>
<div class="element-container"> <div class="element-container">
<div class="row"> <div class="row">
@ -243,11 +183,10 @@ foreach ($items as $child) {
</div> </div>
</div> </div>
</div> </div>
<?php <?php
echo '<!-- END '.$child->label.' -->';
} }
if ($child['type'] == 'IED') {
function addElementIED($child, $fvalues, $sccp_defaults,$npref, $napref) {
$res_input = ''; $res_input = '';
$res_value = ''; $res_value = '';
$opt_at = array(); $opt_at = array();
@ -258,7 +197,7 @@ foreach ($items as $child) {
$child->help = $metaInfo[$res_n]; $child->help = $metaInfo[$res_n];
} }
} }
// $res_value // $res_value
$lnhtm = ''; $lnhtm = '';
$res_id = $napref.$child->name; $res_id = $napref.$child->name;
$i = 0; $i = 0;
@ -274,10 +213,8 @@ foreach ($items as $child) {
} }
if (empty($res_value)) { if (empty($res_value)) {
$res_value = array((string) $child->default); $res_value = array((string) $child->default);
// $res_value = explode('/', (string) $child->default); // $res_value = explode('/', (string) $child->default);
} }
echo '<!-- Begin '.$child->label.' -->';
?> ?>
<div class="element-container"> <div class="element-container">
<div class="row"> <div class="row">
@ -389,10 +326,9 @@ foreach ($items as $child) {
</div></div> </div></div>
</div> </div>
<?php <?php
echo '<!-- END '.$child->label.' -->';
} }
if ($child['type'] == 'IS') { function addElementIS($child, $fvalues, $sccp_defaults,$npref) {
$res_n = (string)$child->name; $res_n = (string)$child->name;
$res_id = $npref.$res_n; $res_id = $npref.$res_n;
$res_ext = str_replace($npref,'',$res_n); $res_ext = str_replace($npref,'',$res_n);
@ -403,15 +339,11 @@ foreach ($items as $child) {
} }
} }
// --- Add Hidden option // --- Add Hidden option
$res_sec_class =''; $res_sec_class ='';
if (!empty($child ->class)) { if (!empty($child ->class)) {
$res_sec_class = (string)$child ->class; $res_sec_class = (string)$child ->class;
} else {
$res_sec_class = 'sccp-custom';
} }
echo '<!-- Begin '.$child->label.' -->';
?> ?>
<div class="element-container"> <div class="element-container">
<div class="row"> <div class="row">
@ -422,17 +354,6 @@ foreach ($items as $child) {
</div> </div>
<?php <?php
if (!empty($sccp_defaults[$res_n]['systemdefault'])) {
// There is a system default, so add button to customise or reset
// the closing } is after the code to include the button at line ~498
?>
<!-- Start include of defaults button -->
<div class="col-md-3">
<?php
$i = 0;
// $res_v = 'no';
$opt_hide = '';
$res_v = ''; $res_v = '';
// set res_v according to precedence Default here, value here, supplied value // set res_v according to precedence Default here, value here, supplied value
@ -447,6 +368,13 @@ foreach ($items as $child) {
$res_v = (string)$fvalues[$res_n]['data']; $res_v = (string)$fvalues[$res_n]['data'];
} }
} }
if (!empty($sccp_defaults[$res_n]['systemdefault'])) {
// There is a system default, so add button to customise or reset
// the closing } is after the code to include the button at line ~498
//-- Start include of defaults button --
echo "<div class=col-md-3>";
if (!empty($sccp_defaults[$res_n]['systemdefault']) && ($sccp_defaults[$res_n]['systemdefault'] != $res_v)) { if (!empty($sccp_defaults[$res_n]['systemdefault']) && ($sccp_defaults[$res_n]['systemdefault'] != $res_v)) {
$usingSysDefaults = false; $usingSysDefaults = false;
} }
@ -501,23 +429,10 @@ foreach ($items as $child) {
<div class="col-md-9 radioset " data-hide="on"> <div class="col-md-9 radioset " data-hide="on">
<?php <?php
$i = 0; $i = 0;
// $res_v = 'no'; $opt_hide = '';
$opt_hide = '';
$res_v = '';
// set res_v according to precedence Default here, value here, supplied value
if (!empty($child->default)) {
$res_v = (string)$child->default;
}
if (!empty($child->value)) {
$res_v = (string)$child->value;
}
if (!empty($fvalues[$res_n])) {
if (($fvalues[$res_n]['data'] != '') ) {
$res_v = (string)$fvalues[$res_n]['data'];
}
}
if (!$usingSysDefaults) { if (!$usingSysDefaults) {
$res_v = $sccp_defaults[$res_n]['systemdefault']; $res_v = $sccp_defaults[$res_n]['systemdefault'];
} }
@ -555,22 +470,30 @@ foreach ($items as $child) {
</div> </div>
<?php <?php
echo '<!-- END '.$child->label.' -->';
} }
/* function addElementSL($child, $fvalues, $sccp_defaults, $npref) {
* Input element Select SLD - Date format /*
* SLZ - Time Zone * Input element Select SLD - Date format
* * SLZ - Time Zone
* SLM - Music on hold *
* SLK - System KeySet * SLM - Music on hold
* SLP - Dial Paterns * SLK - System KeySet
*/ * SLP - Dial Paterns
*/
if ($child['type'] == 'SLD' || $child['type'] == 'SLM'|| $child['type'] == 'SLK'|| $child['type'] == 'SLP') { $day_format = array("D.M.Y", "D.M.YA", "Y.M.D", "YA.M.D", "M-D-Y", "M-D-YA", "D-M-Y", "D-M-YA", "Y-M-D", "YA-M-D", "M/D/Y", "M/D/YA",
// $value = $child -> select; "D/M/Y", "D/M/YA", "Y/M/D", "YA/M/D", "M/D/Y", "M/D/YA");
$res_n = (string)$child ->name; $res_n = (string)$child ->name;
$res_id = $npref.$res_n; $res_id = $npref.$res_n;
$select_opt = array();
$softKeyList = array();
$dialplan_list = array();
if (function_exists('music_list')) {
$moh_list = music_list();
}
if (!is_array($moh_list)) {
$moh_list = array('default');
}
if (!empty($metainfo[$res_n])) { if (!empty($metainfo[$res_n])) {
if ($child->meta_help == '1' || $child->help == 'Help!') { if ($child->meta_help == '1' || $child->help == 'Help!') {
$child->help = $metaInfo[$res_n]; $child->help = $metaInfo[$res_n];
@ -589,26 +512,18 @@ foreach ($items as $child) {
$select_opt= $moh_list; $select_opt= $moh_list;
} }
if ($child['type'] == 'SLK') { if ($child['type'] == 'SLK') {
if (empty($sofkey_list)) { if (empty($softKeyList)) {
$sofkey_list = \FreePBX::Sccp_manager()->aminterface->sccp_list_keysets(); $softKeyList = \FreePBX::Sccp_manager()->aminterface->sccp_list_keysets();
} }
$select_opt= $sofkey_list; $select_opt= $softKeyList;
} }
if ($child['type'] == 'SLP') { if ($child['type'] == 'SLP') {
if (empty($dialplan_list)) { foreach (\FreePBX::Sccp_manager()->getDialPlanList() as $tmpkey) {
foreach (\FreePBX::Sccp_manager()->getDialPlanList() as $tmpkey) { $tmp_id = $tmpkey['id'];
$tmp_id = $tmpkey['id']; $dialplan_list[$tmp_id] = $tmp_id;
$dialplan_list[$tmp_id] = $tmp_id;
}
} }
$select_opt= $dialplan_list; $select_opt= $dialplan_list;
} }
// if ($child['type'] == 'SLZ') {
// $select_opt= $timeZoneOffsetList;
// }
echo '<!-- Begin '.$child->label.' -->';
?> ?>
<div class="element-container"> <div class="element-container">
<div class="row"> <div class="form-group"> <div class="row"> <div class="form-group">
@ -639,67 +554,67 @@ foreach ($items as $child) {
</div></div> </div></div>
</div> </div>
<?php <?php
echo '<!-- END '.$child->label.' -->';
} }
/*
* Input element Select SLS - System Language
*/
if ($child['type'] == 'SLS' || $child['type'] == 'SLT' || $child['type'] == 'SLA' || $child['type'] == 'SLZ') { function addElementSL2($child, $fvalues, $sccp_defaults,$npref) {
// $value = $child -> select; // Input element Select SLS - System Language
$res_n = (string)$child ->name; $res_n = (string)$child ->name;
$res_id = $npref.$res_n; $res_id = $npref.$res_n;
$child->value =''; $child->value ='';
if (!empty($metainfo[$res_n])) { if (!empty($metainfo[$res_n])) {
if ($child->meta_help == '1' || $child->help == 'Help!') { if ($child->meta_help == '1' || $child->help == 'Help!') {
$child->help = $metaInfo[$res_n]; $child->help = $metaInfo[$res_n];
} }
} }
switch ($child['type']) {
if ($child['type'] == 'SLS') { case 'SLS':
$select_opt= $syslangs; if (\FreePBX::Modules()->checkStatus("soundlang")) {
} $syslangs = \FreePBX::Soundlang()->getLanguages();
if ($child['type'] == 'SLT') { if (!is_array($syslangs)) {
$select_opt= $tftp_lang; $syslangs = array();
} }
if ($child['type'] == 'SLZ') { }
$select_opt= $timeZoneOffsetList; $select_opt= $syslangs;
// $child->value = ($system_time_zone[offset]/60); break;
} case 'SLT':
$select_opt= $tftp_lang;
if ($child['type'] == 'SLA') { break;
case 'SLZ':
$timeZoneOffsetList = array('-12' => 'GMT -12', '-11' => 'GMT -11', '-10' => 'GMT -10', '-09' => 'GMT -9',
'-08' => 'GMT -8', '-07' => 'GMT -7', '-06' => 'GMT -6', '-05' => 'GMT -5',
'-04' => 'GMT -4', '-03' => 'GMT -3', '-02' => 'GMT -2', '-01' => 'GMT -1',
'00' => 'GMT', '01' => 'GMT +1', '02' => 'GMT +2', '03' => 'GMT +3',
'04' => 'GMT +4', '05' => 'GMT +5', '06' => 'GMT +6', '07' => 'GMT +7',
'08' => 'GMT +8', '09' => 'GMT +9', '10' => 'GMT +10', '11'=> 'GMT +11', '12' => 'GMT +12');
$select_opt= $timeZoneOffsetList;
break;
case 'SLA':
$select_opt =''; $select_opt ='';
if (!empty($fvalues[$res_n])) { if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) { if (!empty($fvalues[$res_n]['data'])) {
$res_value = explode(';', $fvalues[$res_n]['data']); $res_value = explode(';', $fvalues[$res_n]['data']);
}
if (empty($res_value)) {
$res_value = array((string) $child->default);
}
foreach ($res_value as $key) {
$select_opt[$key]= $key;
}
} }
if (empty($res_value)) {
$res_value = array((string) $child->default);
}
foreach ($res_value as $key) {
$select_opt[$key]= $key;
}
}
} }
if (empty($child->class)) { if (empty($child->class)) {
$child->class = 'form-control'; $child->class = 'form-control';
} }
if (!empty($fvalues[$res_n])) { if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) { if (!empty($fvalues[$res_n]['data'])) {
$child->value = $fvalues[$res_n]['data']; $child->value = $fvalues[$res_n]['data'];
} }
} }
if (empty($child->value)) { if (empty($child->value)) {
if (!empty($child->default)) { if (!empty($child->default)) {
$child->value = $child->default; $child->value = $child->default;
} }
} }
echo '<!-- Begin '.$child->label.' -->';
?> ?>
<div class="element-container"> <div class="element-container">
<div class="row"> <div class="form-group"> <div class="row"> <div class="form-group">
@ -731,15 +646,10 @@ foreach ($items as $child) {
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span> <span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div> </div></div>
</div> </div>
<!--END System Language-->
<?php <?php
echo '<!-- END '.$child->label.' -->';
} }
/*
* Input element Select
*/
if ($child['type'] == 'SL') { function addElementSL3($child, $fvalues, $sccp_defaults,$npref) {
$res_n = (string)$child->name; $res_n = (string)$child->name;
$res_id = $npref.$child->name; $res_id = $npref.$child->name;
@ -752,8 +662,6 @@ foreach ($items as $child) {
if (empty($child ->class)) { if (empty($child ->class)) {
$child->class = 'form-control'; $child->class = 'form-control';
} }
echo '<!-- Begin '.$child->label.' -->';
?> ?>
<div class="element-container"> <div class="element-container">
<div class="row"> <div class="form-group"> <div class="row"> <div class="form-group">
@ -790,17 +698,14 @@ foreach ($items as $child) {
</div></div> </div></div>
</div> </div>
<?php <?php
echo '<!-- END '.$child->label.' -->';
} }
/* function addElementSD($child, $fvalues, $sccp_defaults,$npref) {
* Input element Select SDM - Model List /*
* SDMS - Sip model List * Input element Select SDM - Model List
* SDE - Extension List * SDMS - Sip model List
*/ * SDE - Extension List
*/
if ($child['type'] == 'SDM' || $child['type'] == 'SDMS' || $child['type'] == 'SDE' || $child['type'] == 'SDD') {
// $value = $child -> select;
$res_n = (string)$child ->name; $res_n = (string)$child ->name;
$res_id = $npref.$res_n; $res_id = $npref.$res_n;
@ -813,20 +718,16 @@ foreach ($items as $child) {
if (empty($child->class)) { if (empty($child->class)) {
$child->class = 'form-control'; $child->class = 'form-control';
} }
if ($child['type'] == 'SDM') { switch ($child['type']) {
if (empty($model_list)) { case 'SDM':
$model_list = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData("HWDevice"); $model_list = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData("HWDevice");
} $select_opt= $model_list;
$select_opt= $model_list; break;
} case 'SDMS':
if ($child['type'] == 'SDMS') {
if (empty($model_list)) {
$model_list = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData("HWSipDevice"); $model_list = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData("HWSipDevice");
} $select_opt= $model_list;
$select_opt= $model_list; break;
} case 'SDE':
if ($child['type'] == 'SDE') {
if (empty($extension_list)) {
$extension_list = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData("HWextension"); $extension_list = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData("HWextension");
$extension_list[]=array( 'model' => 'NONE', 'vendor' => 'CISCO', 'dns' => '0'); $extension_list[]=array( 'model' => 'NONE', 'vendor' => 'CISCO', 'dns' => '0');
foreach ($extension_list as &$data) { foreach ($extension_list as &$data) {
@ -838,19 +739,14 @@ foreach ($items as $child) {
} }
} }
unset($data); unset($data);
} $select_opt= $extension_list;
$select_opt= $extension_list; break;
} case 'SDD':
if ($child['type'] == 'SDD') {
if (empty($device_list)) {
$device_list = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData("SccpDevice"); $device_list = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData("SccpDevice");
$device_list[]=array('name' => 'NONE', 'description' => 'No Device'); $device_list[]=array('name' => 'NONE', 'description' => 'No Device');
} $select_opt = $device_list;
$select_opt = $device_list; break;
} }
echo '<!-- Begin '.$child->label.' -->';
?> ?>
<div class="element-container"> <div class="element-container">
<div class="row"> <div class="form-group"> <div class="row"> <div class="form-group">
@ -907,13 +803,13 @@ foreach ($items as $child) {
</div></div> </div></div>
</div> </div>
<?php <?php
echo '<!-- END '.$child->label.' -->';
} }
if ($child['type'] == 'ITED') {
function addElementITED($child, $fvalues, $sccp_defaults, $npref, $napref) {
$res_input = ''; $res_input = '';
$res_na = (string)$child->name; $res_na = (string)$child->name;
// $res_value // $res_value
$lnhtm = ''; $lnhtm = '';
$res_id = $napref.$child->name; $res_id = $napref.$child->name;
$i = 0; $i = 0;
@ -925,14 +821,9 @@ foreach ($items as $child) {
} }
if (empty($res_value)) { if (empty($res_value)) {
$res_value = array((string) $child->default); $res_value = array((string) $child->default);
// $res_value = explode('/', (string) $child->default);
} }
echo "<table class=table table-striped id=dp-table-{$res_id}>";
echo '<!-- Begin '.$res_id.' -->';
?>
<table class="table table-striped" id="dp-table-<?php echo $res_id;?>">
<?php
foreach ($res_value as $dat_v) { foreach ($res_value as $dat_v) {
echo '<tr data-nextid="'.($i+1).'" class="'.$res_id.'" id="'.$res_id.'-row-'.($i).'"> '; echo '<tr data-nextid="'.($i+1).'" class="'.$res_id.'" id="'.$res_id.'-row-'.($i).'"> ';
if (!empty($child->label)) { if (!empty($child->label)) {
@ -1009,17 +900,14 @@ foreach ($items as $child) {
$i++; $i++;
} }
echo '</table>'; echo '</table>';
echo '<!-- END '.$res_id.' -->';
} }
if ($child['type'] == 'HLP') { function addElementHLP($child, $fvalues, $sccp_defaults,$npref) {
$res_n = (string)$child ->name; $res_n = (string)$child ->name;
$res_id = $npref.$res_n; $res_id = $npref.$res_n;
if (empty($child->class)) { if (empty($child->class)) {
$child->class = 'form-control'; $child->class = 'form-control';
} }
echo '<!-- Begin '.$child->label.' -->';
?> ?>
<div class="panel panel-default"> <div class="panel panel-default">
@ -1052,19 +940,17 @@ foreach ($items as $child) {
} }
} }
?> ?>
</div> </div>
</div> </div>
<?php <?php
echo '<!-- END '.$child->label.' -->';
} }
if ($child['type'] == 'MINFO') {
function addElementMINFO($child,$npref) {
$res_n = (string)$child ->name; $res_n = (string)$child ->name;
$res_id = $npref.$res_n; $res_id = $npref.$res_n;
if (empty($child->class)) { if (empty($child->class)) {
$child->class = 'form-control'; $child->class = 'form-control';
} }
echo '<!-- Begin '.$child->label.' -->';
?> ?>
<div class="modal fade malert" tabindex="-1" role="dialog" id="<?php echo $res_id;?>" aria-labelledby="<?php echo $res_n;?>"> <div class="modal fade malert" tabindex="-1" role="dialog" id="<?php echo $res_id;?>" aria-labelledby="<?php echo $res_n;?>">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
@ -1083,14 +969,10 @@ foreach ($items as $child) {
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div><!-- /.modal --> </div><!-- /.modal -->
<?php <?php
echo '<!-- END '.$child->label.' -->';
} }
/*
* Input element Select SLTZN - System Time Zone
*/
if ($child['type'] == 'SLTZN') { function addElementSLTZN($child, $fvalues, $sccp_defaults,$npref) {
// $value = $child -> select; // Input element Select SLTZN - System Time Zone
$res_n = (string)$child ->name; $res_n = (string)$child ->name;
$res_id = $npref.$res_n; $res_id = $npref.$res_n;
$child->value =''; $child->value ='';
@ -1112,8 +994,6 @@ foreach ($items as $child) {
} }
$child->value = \date_default_timezone_get(); $child->value = \date_default_timezone_get();
echo '<!-- Begin '.$child->label.' -->';
?> ?>
<div class="element-container"> <div class="element-container">
<div class="row"> <div class="row">
@ -1132,13 +1012,94 @@ foreach ($items as $child) {
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span> <span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div> </div></div>
</div> </div>
<!--END System Language-->
<?php <?php
echo '<!-- END '.$child->label.' -->';
} }
};
// End of class thisSCCPView ---------------------------------------------------
// Start building page here ------------------------------------------------
// This will not work if the field already has the underscore
$npref = $form_prefix.'_';
$napref = $form_prefix.'-ar_';
if (empty($form_prefix)) {
$npref = "sccp_";
$napref ="sccp-ar_";
//} elseif ($form_prefix == 'vendorconfig') {
// $npref = 'vendorconfig';
// $napref = 'vendorconfig-ar';
} }
?> if (empty($fvalues)) {
$fvalues = $sccp_defaults;
}
$items = $itm -> children();
if ($h_show==1) {
$sec_class ='';
if (!empty($items ->class)) {
$sec_class = (string)$items ->class;
}
?>
<div class="section-title" data-for="<?php echo $npref.$itm['name'];?>">
<h3><i class="fa fa-minus"></i><?php echo _($items ->label) ?></h3>
</div>
<div class="section <?php echo $sec_class;?>" data-id="<?php echo $npref.$itm['name'];?>">
<?php <?php
}
foreach ($items as $child) {
if (empty($child->help)) {
$child->help = 'Help is not available.';
$child->meta_help = '1';
}
echo "<!-- Begin {$child->label} -->";
// $child->meta_help = '1'; // Remove comments to see chan-sccp supplied help !
switch ($child['type']) {
case 'IE':
$thisSccpView->addElementIE($child, $fvalues, $sccp_defaults,$npref);
break;
case 'IED':
$thisSccpView->addElementIED($child, $fvalues, $sccp_defaults,$npref, $napref);
break;
case 'IS':
$thisSccpView->addElementIS($child, $fvalues, $sccp_defaults,$npref);
break;
case 'SLD':
case 'SLM':
case 'SLK':
case 'SLP':
$thisSccpView->addElementSL($child, $fvalues, $sccp_defaults,$npref);
break;
case 'SLS':
case 'SLT':
case 'SLA':
case 'SLZ':
$thisSccpView->addElementSL2($child, $fvalues, $sccp_defaults,$npref);
break;
case 'SL':
$thisSccpView->addElementSL3($child, $fvalues, $sccp_defaults,$npref);
break;
case 'SDM':
case 'SDMS':
case 'SDE':
case 'SDD':
$thisSccpView->addElementSD($child, $fvalues, $sccp_defaults,$npref);
break;
case 'ITED':
$thisSccpView->addElementITED($child, $fvalues, $sccp_defaults, $npref, $napref);
break;
case 'HLP':
$thisSccpView->addElementHLP($child, $fvalues, $sccp_defaults,$npref);
break;
case 'MINFO':
$thisSccpView->addElementMINFO($child, $npref);
break;
case 'SLTZN':
$thisSccpView->addElementSLTZN($child, $fvalues, $sccp_defaults,$npref);
break;
}
echo "<!-- END {$child->label} -->";
}
if ($h_show==1) { if ($h_show==1) {
echo '</div>'; echo '</div>';
} }