Simplify db queries and change alignment
This commit is contained in:
parent
97c1395eb1
commit
a4aa4eb03b
|
@ -55,7 +55,7 @@ class dbinterface
|
|||
return false;
|
||||
}
|
||||
switch ($dataid) {
|
||||
case 'sccp':
|
||||
case 'extGrid':
|
||||
// only called by getExtensionGrid from hardware.extension.php view
|
||||
$stmts = $this->db->prepare('SELECT sccpline.name, sccpline.label, sccpbuttonconfig.ref as mac
|
||||
FROM sccpline INNER JOIN sccpbuttonconfig ON sccpline.name=sccpbuttonconfig.name');
|
||||
|
@ -68,6 +68,18 @@ class dbinterface
|
|||
$stmts->bindParam(':name', $data['name'],\PDO::PARAM_STR);
|
||||
}
|
||||
break;
|
||||
case 'phoneGrid':
|
||||
$fld = 'name, name as mac, type, button, addon, _description as description';
|
||||
switch ($data['type']) {
|
||||
case "cisco-sip":
|
||||
$stmts = $this->db->prepare("SELECT {$fld} FROM sccpdeviceconfig WHERE type LIKE '%-sip' ORDER BY name");
|
||||
break;
|
||||
case "sccp": // Fall through to default intentionally
|
||||
default:
|
||||
$stmts = $this->db->prepare("SELECT {$fld} FROM sccpdeviceconfig WHERE type not LIKE '%-sip' ORDER BY name");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'SccpDevice':
|
||||
if (empty($data['fields'])) {
|
||||
$fld = 'name, name as mac, type, button, addon, _description as description';
|
||||
|
|
|
@ -315,19 +315,18 @@ trait ajaxHelper {
|
|||
break;
|
||||
case 'getPhoneGrid':
|
||||
$dbDevices = array();
|
||||
$cmd_type = !empty($request['type']) ? $request['type'] : '';
|
||||
|
||||
// Find all devices defined in the database
|
||||
$dbDevices = $this->dbinterface->getSccpDeviceTableData('SccpDevice', array('type' => $cmd_type));
|
||||
// Find all devices defined in the database.
|
||||
$dbDevices = $this->dbinterface->getSccpDeviceTableData('phoneGrid', array('type' => $request['type']));
|
||||
// Return if only interested in SIP devices
|
||||
if ($cmd_type == 'cisco-sip') {
|
||||
if ($request['type'] == 'cisco-sip') {
|
||||
return $dbDevices; //this may be empty
|
||||
}
|
||||
// Find all devices currently connected
|
||||
$activeDevices = $this->aminterface->sccp_get_active_device();
|
||||
|
||||
foreach ($dbDevices as &$dev_id) {
|
||||
$id_name = $dev_id['name'];
|
||||
$id_name = $dev_id['mac'];
|
||||
if (!empty($activeDevices[$id_name])) {
|
||||
// Device is in db and is connected
|
||||
$dev_id['description'] = $activeDevices[$id_name]['descr'];
|
||||
|
|
|
@ -20,13 +20,13 @@ if (!empty($this->sccpvalues['system_rouminguser'])) {
|
|||
<div id="toolbar-sccp-extension">
|
||||
<a class="btn btn-default" href="config.php?display=extensions&tech_hardware=sccp_custom"><i class="fa fa-plus"> </i><?php echo _("Add Extension") ?></a>
|
||||
</div>
|
||||
<table data-cookie="true" data-cookie-id-table="sccp-extension-table" data-url="ajax.php?module=sccp_manager&command=getExtensionGrid&type=sccp" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-extension" data-id="name">
|
||||
<table data-cookie="true" data-cookie-id-table="sccp-extension-table" data-url="ajax.php?module=sccp_manager&command=getExtensionGrid&type=extGrid" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-extension" data-id="name">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th data-checkbox="true"></th> -->
|
||||
<th data-sortable="true" data-field="name"><?php echo _('Extension') ?></th>
|
||||
<th data-sortable="true" data-field="label"><?php echo _('Display Name') ?></th>
|
||||
<th data-sortable="true" data-field="line_status"><?php echo _('Status | Active') ?></th>
|
||||
<th data-sortable="true" data-field="line_status" class="text-center"><?php echo _('Status | Active') ?></th>
|
||||
<th data-field="actions" data-formatter="DispayPhoneActionsKeyFormatter"><?php echo _('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
Loading…
Reference in a new issue