Create new function to get device defaults
Add new function in helperFunctions and use
This commit is contained in:
parent
a146cd2354
commit
416cedc425
|
@ -69,6 +69,16 @@ trait helperfunctions {
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
private function getDeviceDefaults() {
|
||||||
|
$def_val = array();
|
||||||
|
$sccpDeviceDesc = $this->dbinterface->HWextension_db_SccpTableData('get_columns_sccpdevice');
|
||||||
|
|
||||||
|
foreach ($sccpDeviceDesc as $data) {
|
||||||
|
$key = (string) $data['Field'];
|
||||||
|
$def_val[$key] = array("keyword" => $key, "data" => $data['Default'], "seq" => "99");
|
||||||
|
}
|
||||||
|
return $def_val;
|
||||||
|
}
|
||||||
|
|
||||||
private function findAllFiles($dir, $file_mask = null, $mode = 'full') {
|
private function findAllFiles($dir, $file_mask = null, $mode = 'full') {
|
||||||
$result = null;
|
$result = null;
|
||||||
|
|
|
@ -37,13 +37,8 @@ if (!empty($_REQUEST['new_id'])) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($_REQUEST['id'])) {
|
if (empty($_REQUEST['id'])) {
|
||||||
// Adding new device to database
|
// Adding new device to database. Get default values
|
||||||
$sccpDeviceDesc = $this->dbinterface->HWextension_db_SccpTableData('get_columns_sccpdevice');
|
$def_val = $this->getDeviceDefaults();
|
||||||
|
|
||||||
foreach ($sccpDeviceDesc as $data) {
|
|
||||||
$key = (string) $data['Field'];
|
|
||||||
$def_val[$key] = array("keyword" => $key, "data" => $data['Default'], "seq" => "99");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Editing an existing Device
|
// Editing an existing Device
|
||||||
$dev_id = $_REQUEST['id'];
|
$dev_id = $_REQUEST['id'];
|
||||||
|
|
|
@ -14,15 +14,10 @@
|
||||||
|
|
||||||
// originally, this was populated by sccpgeneral.xml but that should be static
|
// originally, this was populated by sccpgeneral.xml but that should be static
|
||||||
// now will populate from the db defaults.
|
// now will populate from the db defaults.
|
||||||
$defaultVal = array();
|
$defaultVals = $this->getDeviceDefaults();
|
||||||
$sccpDeviceDesc = $this->dbinterface->HWextension_db_SccpTableData('get_columns_sccpdevice');
|
|
||||||
|
|
||||||
foreach ($sccpDeviceDesc as $data) {
|
|
||||||
$key = (string) $data['Field'];
|
|
||||||
$defaultVal[$key] = array("keyword" => $key, "data" => $data['Default'], "seq" => "99");
|
|
||||||
}
|
|
||||||
echo $this->showGroup('sccp_srst', 1);
|
echo $this->showGroup('sccp_srst', 1);
|
||||||
echo $this->showGroup('sccp_dev_vendor_conf', 1,'vendorconfig',$defaultVal,false);
|
echo $this->showGroup('sccp_dev_vendor_conf', 1,'vendorconfig',$defaultVals,false);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in a new issue