diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index e6b0735..7367162 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -429,6 +429,12 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { break; case 'monitor': + $hint = $this->aminterface->core_list_hints(); + foreach ($hint as $key => $value) { + if ($this->hint_context['default'] != $value) { + $this->hint_context[$key] = $value; + } + } $btn_t = 'speeddial'; $btn_opt = (string) $get_settings["button${it}_line"]; $db_res = $this->dbinterface->getSccpDeviceTableData('SccpExtension', array('name' => $btn_opt)); @@ -711,13 +717,14 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { } } } - + /* $hint = $this->aminterface->core_list_hints(); foreach ($hint as $key => $value) { if ($this->hint_context['default'] != $value) { $this->hint_context[$key] = $value; } } + */ } /* @@ -1055,34 +1062,35 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { return $modelList; } - function getHintInformation($sort = true, $filter = array()) { + function getHintInformation($filter = array()) { $res = array(); $default_hint = '@ext-local'; - if (empty($res)) { + //if (empty($res)) { // Old Req get all hints - $tmp_data = $this->aminterface->core_list_all_hints(); - foreach ($tmp_data as $value) { - $res[$value] = array('key' => $value, 'exten' => $this->before('@', $value), 'label' => $value); - } - } + // Avoid post processing - return dat in required format. + $res = $this->aminterface->core_list_all_hints(); + //foreach ($tmp_data as $value) { + //$res[$value] = array('key' => $value, 'exten' => $this->before('@', $value), 'label' => $value); + //} + //dbug($res); + //} // Update info from sccp_db - $tmp_data = $this->dbinterface->getSccpDeviceTableData('SccpExtension'); - foreach ($tmp_data as $value) { - $name_l = $value['name']; - if (!empty($res[$name_l . $default_hint])) { - $res[$name_l . $default_hint]['exten'] = $name_l; - $res[$name_l . $default_hint]['label'] = $value['label']; + foreach ($this->dbinterface->getSccpDeviceTableData('sccpHints') as $key => $value) { + if (!empty($res[$key . $default_hint])) { + $res[$key . $default_hint]['exten'] = $key; + $res[$key . $default_hint]['label'] = $value['label']; } else { // if not exist in system hints ..... ??????? - $res[$name_l . $default_hint] = array('key' => $name_l . $default_hint, 'exten' => $name_l, 'label' => $value['label']); + $res[$key . $default_hint] = array('key' => $key . $default_hint, 'exten' => $key, 'label' => $value['label']); } } - if (!$sort) { - return $res; - } - + // Hints returned from db are already sorted by name + //if (!$sort) { + return $res; + //} + /* foreach ($res as $key => $value) { $data_sort[$value['exten']] = $key; } @@ -1090,10 +1098,11 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { foreach ($data_sort as $key => $value) { $res_sort[$value] = $res[$value]; } - + */ // Update info from sip DB /* !TODO!: Update Hint info from sip DB ??? */ - return $res_sort; + //return $res_sort; + } } ?> diff --git a/sccpManClasses/amInterfaceClasses/Event.class.php b/sccpManClasses/amInterfaceClasses/Event.class.php index d222189..6eefdbd 100644 --- a/sccpManClasses/amInterfaceClasses/Event.class.php +++ b/sccpManClasses/amInterfaceClasses/Event.class.php @@ -1,13 +1,5 @@ setKey('Segment', 'general'); - $this->setKey('ResultFormat', 'command'); + //$this->setKey('Segment', 'general'); + //$this->setKey('ResultFormat', 'command'); $this->setResponseHandler("ExtensionStateList"); } } @@ -379,8 +378,8 @@ class SCCPShowSoftkeySetsAction extends ActionMessage public function __construct() { parent::__construct('SCCPShowSoftkeySets'); - $this->setKey('Segment', 'general'); - $this->setKey('ResultFormat', 'command'); + //$this->setKey('Segment', 'general'); + //$this->setKey('ResultFormat', 'command'); $this->setResponseHandler("SCCPShowSoftkeySets"); } } @@ -391,8 +390,8 @@ class SCCPShowDeviceAction extends ActionMessage public function __construct($devicename) { parent::__construct('SCCPShowDevice'); - $this->setKey('Segment', 'general'); - $this->setKey('ResultFormat', 'command'); + //$this->setKey('Segment', 'general'); + //$this->setKey('ResultFormat', 'command'); $this->setKey('DeviceName', $devicename); $this->setResponseHandler("SCCPShowDevice"); } @@ -404,8 +403,8 @@ class SCCPShowDevicesAction extends ActionMessage public function __construct() { parent::__construct('SCCPShowDevices'); - $this->setKey('Segment', 'general'); - $this->setKey('ResultFormat', 'command'); + //$this->setKey('Segment', 'general'); + //$this->setKey('ResultFormat', 'command'); $this->setResponseHandler("SCCPShowDevices"); } } diff --git a/sccpManClasses/aminterface.class.php b/sccpManClasses/aminterface.class.php index e58ccb9..5cd3d49 100644 --- a/sccpManClasses/aminterface.class.php +++ b/sccpManClasses/aminterface.class.php @@ -348,7 +348,8 @@ class aminterface $_res = $this->send($_action)->getResult(); foreach ($_res as $key => $value) { foreach ($value as $key2 => $value2) { - $result[$key.'@'.$key2] = $key.'@'.$key2; + //$result[$key.'@'.$key2] = $key.'@'.$key2; + $result[$key.'@'.$key2] = ['key' => $key.'@'.$key2, 'exten' => $key, 'label' => $key.'@'.$key2]; } } } diff --git a/sccpManClasses/dbinterface.class.php b/sccpManClasses/dbinterface.class.php index dd3e043..597eedc 100644 --- a/sccpManClasses/dbinterface.class.php +++ b/sccpManClasses/dbinterface.class.php @@ -66,6 +66,9 @@ class dbinterface $stmts->bindParam(':name', $data['name'],\PDO::PARAM_STR); } break; + case 'sccpHints': + $stmtU = $this->db->prepare('SELECT name, name, label FROM sccpline ORDER BY name'); + break; case 'phoneGrid': switch ($data['type']) { case "cisco-sip": diff --git a/views/form.buttons.php b/views/form.buttons.php index e359883..3ca9a97 100644 --- a/views/form.buttons.php +++ b/views/form.buttons.php @@ -19,8 +19,8 @@ if ($_REQUEST['tech_hardware'] === 'cisco') { } else { $lines_list = $this->dbinterface->getSipTableData('extensionList'); } - -$hint_list = $this->getHintInformation(true, array('context'=>'park-hints')); +// TODO: actually returning all hints - the filter is currently ignored. +$hint_list = $this->getHintInformation(array('context'=>'park-hints')); $line_id =0; $max_buttons =56; //Don't know hardware type so set a maximum. On save, this is set to actual max buttons