-
- ";
+
if (!empty($sccp_defaults[$res_n]['systemdefault']) && ($sccp_defaults[$res_n]['systemdefault'] != $res_v)) {
$usingSysDefaults = false;
}
@@ -501,23 +429,10 @@ foreach ($items as $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'];
- }
- }
+
label.' -->';
}
-/*
- * Input element Select SLD - Date format
- * SLZ - Time Zone
- *
- * SLM - Music on hold
- * SLK - System KeySet
- * SLP - Dial Paterns
- */
-
- if ($child['type'] == 'SLD' || $child['type'] == 'SLM'|| $child['type'] == 'SLK'|| $child['type'] == 'SLP') {
-// $value = $child -> select;
+ function addElementSL($child, $fvalues, $sccp_defaults, $npref) {
+ /*
+ * Input element Select SLD - Date format
+ * SLZ - Time Zone
+ *
+ * SLM - Music on hold
+ * SLK - System KeySet
+ * SLP - Dial Paterns
+ */
+ $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");
$res_n = (string)$child ->name;
$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 ($child->meta_help == '1' || $child->help == 'Help!') {
$child->help = $metaInfo[$res_n];
@@ -589,26 +512,18 @@ foreach ($items as $child) {
$select_opt= $moh_list;
}
if ($child['type'] == 'SLK') {
- if (empty($sofkey_list)) {
- $sofkey_list = \FreePBX::Sccp_manager()->aminterface->sccp_list_keysets();
+ if (empty($softKeyList)) {
+ $softKeyList = \FreePBX::Sccp_manager()->aminterface->sccp_list_keysets();
}
- $select_opt= $sofkey_list;
+ $select_opt= $softKeyList;
}
if ($child['type'] == 'SLP') {
- if (empty($dialplan_list)) {
- foreach (\FreePBX::Sccp_manager()->getDialPlanList() as $tmpkey) {
- $tmp_id = $tmpkey['id'];
- $dialplan_list[$tmp_id] = $tmp_id;
- }
+ foreach (\FreePBX::Sccp_manager()->getDialPlanList() as $tmpkey) {
+ $tmp_id = $tmpkey['id'];
+ $dialplan_list[$tmp_id] = $tmp_id;
}
$select_opt= $dialplan_list;
}
-// if ($child['type'] == 'SLZ') {
-// $select_opt= $timeZoneOffsetList;
-// }
-
- echo '';
-
?>
@@ -639,67 +554,67 @@ foreach ($items as $child) {
label.' -->';
}
-/*
- * Input element Select SLS - System Language
- */
- if ($child['type'] == 'SLS' || $child['type'] == 'SLT' || $child['type'] == 'SLA' || $child['type'] == 'SLZ') {
-// $value = $child -> select;
+ function addElementSL2($child, $fvalues, $sccp_defaults,$npref) {
+ // Input element Select SLS - System Language
$res_n = (string)$child ->name;
$res_id = $npref.$res_n;
$child->value ='';
-
if (!empty($metainfo[$res_n])) {
if ($child->meta_help == '1' || $child->help == 'Help!') {
$child->help = $metaInfo[$res_n];
}
}
-
- if ($child['type'] == 'SLS') {
- $select_opt= $syslangs;
- }
- if ($child['type'] == 'SLT') {
- $select_opt= $tftp_lang;
- }
- if ($child['type'] == 'SLZ') {
- $select_opt= $timeZoneOffsetList;
-// $child->value = ($system_time_zone[offset]/60);
- }
-
- if ($child['type'] == 'SLA') {
+ switch ($child['type']) {
+ case 'SLS':
+ if (\FreePBX::Modules()->checkStatus("soundlang")) {
+ $syslangs = \FreePBX::Soundlang()->getLanguages();
+ if (!is_array($syslangs)) {
+ $syslangs = array();
+ }
+ }
+ $select_opt= $syslangs;
+ break;
+ case 'SLT':
+ $select_opt= $tftp_lang;
+ 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 ='';
- if (!empty($fvalues[$res_n])) {
- if (!empty($fvalues[$res_n]['data'])) {
- $res_value = explode(';', $fvalues[$res_n]['data']);
+ if (!empty($fvalues[$res_n])) {
+ if (!empty($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)) {
$child->class = 'form-control';
}
-
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$child->value = $fvalues[$res_n]['data'];
}
}
-
if (empty($child->value)) {
if (!empty($child->default)) {
$child->value = $child->default;
}
}
-
- echo '';
?>
@@ -731,15 +646,10 @@ foreach ($items as $child) {
help);?>
-
label.' -->';
}
-/*
- * Input element Select
- */
- if ($child['type'] == 'SL') {
+ function addElementSL3($child, $fvalues, $sccp_defaults,$npref) {
$res_n = (string)$child->name;
$res_id = $npref.$child->name;
@@ -752,8 +662,6 @@ foreach ($items as $child) {
if (empty($child ->class)) {
$child->class = 'form-control';
}
- echo '';
-
?>
@@ -790,17 +698,14 @@ foreach ($items as $child) {
label.' -->';
}
- /*
- * Input element Select SDM - Model List
- * SDMS - Sip model List
- * SDE - Extension List
- */
-
- if ($child['type'] == 'SDM' || $child['type'] == 'SDMS' || $child['type'] == 'SDE' || $child['type'] == 'SDD') {
-// $value = $child -> select;
+ function addElementSD($child, $fvalues, $sccp_defaults,$npref) {
+ /*
+ * Input element Select SDM - Model List
+ * SDMS - Sip model List
+ * SDE - Extension List
+ */
$res_n = (string)$child ->name;
$res_id = $npref.$res_n;
@@ -813,20 +718,16 @@ foreach ($items as $child) {
if (empty($child->class)) {
$child->class = 'form-control';
}
- if ($child['type'] == 'SDM') {
- if (empty($model_list)) {
+ switch ($child['type']) {
+ case 'SDM':
$model_list = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData("HWDevice");
- }
- $select_opt= $model_list;
- }
- if ($child['type'] == 'SDMS') {
- if (empty($model_list)) {
+ $select_opt= $model_list;
+ break;
+ case 'SDMS':
$model_list = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData("HWSipDevice");
- }
- $select_opt= $model_list;
- }
- if ($child['type'] == 'SDE') {
- if (empty($extension_list)) {
+ $select_opt= $model_list;
+ break;
+ case 'SDE':
$extension_list = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData("HWextension");
$extension_list[]=array( 'model' => 'NONE', 'vendor' => 'CISCO', 'dns' => '0');
foreach ($extension_list as &$data) {
@@ -838,19 +739,14 @@ foreach ($items as $child) {
}
}
unset($data);
- }
- $select_opt= $extension_list;
- }
- if ($child['type'] == 'SDD') {
- if (empty($device_list)) {
+ $select_opt= $extension_list;
+ break;
+ case 'SDD':
$device_list = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData("SccpDevice");
$device_list[]=array('name' => 'NONE', 'description' => 'No Device');
- }
- $select_opt = $device_list;
+ $select_opt = $device_list;
+ break;
}
-
- echo '';
-
?>
@@ -907,13 +803,13 @@ foreach ($items as $child) {
label.' -->';
}
- if ($child['type'] == 'ITED') {
+
+ function addElementITED($child, $fvalues, $sccp_defaults, $npref, $napref) {
$res_input = '';
$res_na = (string)$child->name;
-// $res_value
+ // $res_value
$lnhtm = '';
$res_id = $napref.$child->name;
$i = 0;
@@ -925,14 +821,9 @@ foreach ($items as $child) {
}
if (empty($res_value)) {
$res_value = array((string) $child->default);
-// $res_value = explode('/', (string) $child->default);
}
+ echo "
";
- echo '';
- ?>
-
-
- ';
if (!empty($child->label)) {
@@ -1009,17 +900,14 @@ foreach ($items as $child) {
$i++;
}
echo '
';
- echo '';
}
- if ($child['type'] == 'HLP') {
+ function addElementHLP($child, $fvalues, $sccp_defaults,$npref) {
$res_n = (string)$child ->name;
$res_id = $npref.$res_n;
if (empty($child->class)) {
$child->class = 'form-control';
}
- echo '';
-
?>
@@ -1052,19 +940,17 @@ foreach ($items as $child) {
}
}
?>
-
label.' -->';
}
- if ($child['type'] == 'MINFO') {
+
+ function addElementMINFO($child,$npref) {
$res_n = (string)$child ->name;
$res_id = $npref.$res_n;
if (empty($child->class)) {
$child->class = 'form-control';
}
- echo '';
?>
@@ -1083,14 +969,10 @@ foreach ($items as $child) {
label.' -->';
}
-/*
- * Input element Select SLTZN - System Time Zone
- */
- if ($child['type'] == 'SLTZN') {
-// $value = $child -> select;
+ function addElementSLTZN($child, $fvalues, $sccp_defaults,$npref) {
+ // Input element Select SLTZN - System Time Zone
$res_n = (string)$child ->name;
$res_id = $npref.$res_n;
$child->value ='';
@@ -1112,8 +994,6 @@ foreach ($items as $child) {
}
$child->value = \date_default_timezone_get();
-
- echo '';
?>
@@ -1132,13 +1012,94 @@ foreach ($items as $child) {
help);?>
-
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;
+ }
+ ?>
+
+
+
label) ?>
+
+
+
help)) {
+ $child->help = 'Help is not available.';
+ $child->meta_help = '1';
+ }
+ echo "";
+// $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 "";
+}
if ($h_show==1) {
echo '
';
}