diff --git a/sccpManClasses/dbinterface.class.php b/sccpManClasses/dbinterface.class.php index 482edd9..f259558 100644 --- a/sccpManClasses/dbinterface.class.php +++ b/sccpManClasses/dbinterface.class.php @@ -47,12 +47,19 @@ class dbinterface public function getSccpDeviceTableData($dataid, $data = array()) { // $stmt is a single row fetch, $stmts is a fetchAll. + dbug($dataid); + dbug($data); $stmt = ''; $stmts = ''; if ($dataid == '') { return false; } switch ($dataid) { + case 'sccp': + // 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'); + break; case 'SccpExtension': if (empty($data['name'])) { $stmts = $this->db->prepare('SELECT * FROM sccpline ORDER BY name'); diff --git a/sccpManTraits/ajaxHelper.php b/sccpManTraits/ajaxHelper.php index a2dbd30..7db3732 100644 --- a/sccpManTraits/ajaxHelper.php +++ b/sccpManTraits/ajaxHelper.php @@ -290,11 +290,28 @@ trait ajaxHelper { return $result; break; case 'getExtensionGrid': - $result = $this->dbinterface->getSccpDeviceTableData('SccpExtension'); - if (empty($result)) { + $lineList = $this->dbinterface->getSccpDeviceTableData($request['type']); + if (empty($lineList)) { return array(); } - return $result; + dbug($lineList); + $activeDevices = $this->aminterface->sccp_get_active_device(); + dbug($activeDevices); + if (!empty($activeDevices)) { + foreach ($lineList as $key => $lineArr) { + if (isset($activeDevices[$lineArr['mac']])) { + $tpm_info = $activeDevices[$lineArr['mac']]; + if (!empty($tpm_info)) { + $lineList[$key]['line_status'] = $tpm_info['status']; + $lineList[$key]['line_status'] .= " | {$tpm_info['act']}"; + } else { + $lineList[$key]['line_status'] = ''; + $lineList[$key]['line_status'] .= '|'; + } + } + } + } + return $lineList; break; case 'getPhoneGrid': $dbDevices = array(); diff --git a/views/hardware.extension.php b/views/hardware.extension.php index d6cde2a..d72b473 100644 --- a/views/hardware.extension.php +++ b/views/hardware.extension.php @@ -26,7 +26,7 @@ if (!empty($this->sccpvalues['system_rouminguser'])) { - +