Update extension_dashboard.php

Finish up the Caller ID dashboard.php.
This commit is contained in:
FusionPBX
2017-04-27 18:05:28 -06:00
committed by GitHub
parent e582a57f49
commit 68b6eae7e6
+38 -18
View File
@@ -59,12 +59,17 @@
//build the array on what is allowed. //build the array on what is allowed.
if ($found) { if ($found) {
$caller_id = explode('@', $row['outbound_caller_id']); if (permission_exists('outbound_caller_id_select')) {
$outbound_caller_id_name = $caller_id[0]; $caller_id = explode('@', $row['outbound_caller_id']);
$outbound_caller_id_number = $caller_id[1]; $outbound_caller_id_name = $caller_id[0];
$outbound_caller_id_number = $caller_id[1];
}
else {
$outbound_caller_id_name = $row['outbound_caller_id_name'];
$outbound_caller_id_number = $row['outbound_caller_id_number'];
}
$array['extensions'][$x]['extension_uuid'] = $row['extension_uuid']; $array['extensions'][$x]['extension_uuid'] = $row['extension_uuid'];
$array['extensions'][$x]['outbound_caller_id_name'] = $caller_id[0]; $array['extensions'][$x]['outbound_caller_id_name'] = $outbound_caller_id_name;
if (is_numeric($outbound_caller_id_number)) { if (is_numeric($outbound_caller_id_number)) {
$array['extensions'][$x]['outbound_caller_id_number'] = $outbound_caller_id_number; $array['extensions'][$x]['outbound_caller_id_number'] = $outbound_caller_id_number;
} }
@@ -101,11 +106,10 @@
$p->delete("extension_edit", "temp"); $p->delete("extension_edit", "temp");
//clear the cache //clear the cache
//$cache = new cache; $cache = new cache;
//$cache->delete("directory:".$extension."@".$user_context); foreach($_SESSION['user']['extension'] as $field) {
//if (permission_exists('number_alias') && strlen($number_alias) > 0) { $cache->delete("directory:".$_SESSION['user']['destination']."@".$_SESSION['user']['user_context']);
// $cache->delete("directory:".$number_alias."@".$user_context); }
//}
//set the message //set the message
if (!isset($_SESSION['message'])) { if (!isset($_SESSION['message'])) {
@@ -163,12 +167,14 @@
$destination = $row['destination']; $destination = $row['destination'];
$outbound_caller_id_name = $row['outbound_caller_id_name']; $outbound_caller_id_name = $row['outbound_caller_id_name'];
$outbound_caller_id_number = $row['outbound_caller_id_number']; $outbound_caller_id_number = $row['outbound_caller_id_number'];
$description = $row['description'];
//set the column names //set the column names
if ($x === 0 && $previous_extension_uuid != $row['extension_uuid']) { if ($x === 0 && $previous_extension_uuid != $row['extension_uuid']) {
echo " <tr>\n"; echo " <tr>\n";
echo " <th>".$text['label-extension']."</th>\n"; echo " <th>".$text['label-extension']."</th>\n";
echo " <th>".$text['label-caller_id']."</th>\n"; echo " <th>".$text['label-caller_id']."</th>\n";
echo " <th>".$text['label-description']."</th>\n";
echo " </tr>\n"; echo " </tr>\n";
} }
@@ -190,37 +196,51 @@
echo " <input name='extensions[".$x."][extension_uuid]' type='hidden' value=\"".$row['extension_uuid']."\">\n"; echo " <input name='extensions[".$x."][extension_uuid]' type='hidden' value=\"".$row['extension_uuid']."\">\n";
} }
//show the destination
echo " <td class='row_style".$c." row_style_slim'>\n"; echo " <td class='row_style".$c." row_style_slim'>\n";
echo " ".$row['destination']; echo " ".$row['destination'];
echo " </td>\n"; echo " </td>\n";
echo " <td class='row_style".$c." row_style_slim'>\n"; //caller id form input
if (permission_exists('outbound_caller_id_select')) { if (permission_exists('outbound_caller_id_select')) {
//caller id select
echo " <td class='row_style".$c." row_style_slim'>\n";
if (count($destinations) > 0) { if (count($destinations) > 0) {
echo " <select name='extensions[".$x."][outbound_caller_id]' id='outbound_caller_id_number' class='formfld'>\n"; echo " <select name='extensions[".$x."][outbound_caller_id]' id='outbound_caller_id_number' class='formfld'>\n";
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
foreach ($destinations as &$row) { foreach ($destinations as &$field) {
if(strlen($row['destination_caller_id_number']) > 0) { if(strlen($field['destination_caller_id_number']) > 0) {
if ($outbound_caller_id_number == $row['destination_caller_id_number']) { if ($outbound_caller_id_number == $field['destination_caller_id_number']) {
echo " <option value='".$row['destination_caller_id_name']."@".$row['destination_caller_id_number']."' selected='selected'>".$row['destination_caller_id_name']." ".$row['destination_caller_id_number']."</option>\n"; echo " <option value='".$field['destination_caller_id_name']."@".$field['destination_caller_id_number']."' selected='selected'>".$field['destination_caller_id_name']." ".$field['destination_caller_id_number']."</option>\n";
} }
else { else {
echo " <option value='".$row['destination_caller_id_name']."@".$row['destination_caller_id_number']."'>".$row['destination_caller_id_name']." ".$row['destination_caller_id_number']."</option>\n"; echo " <option value='".$field['destination_caller_id_name']."@".$field['destination_caller_id_number']."'>".$field['destination_caller_id_name']." ".$field['destination_caller_id_number']."</option>\n";
} }
} }
} }
echo " </select>\n"; echo " </select>\n";
} }
echo " </td>\n";
} }
else { else {
echo " <input class='formfld' style='min-width: 50px; max-width: 100px;' type='text' name='extensions[".$x."][outbound_caller_id_number]' maxlength='255' value=\"".$row['outbound_caller_id_number']."\">\n"; //caller id name an number input text
echo " <td class='row_style".$c." row_style_slim'>\n";
echo " <input class='formfld' style='min-width: 50px; max-width: 100px;' type='text' name='extensions[".$x."][outbound_caller_id_name]' maxlength='255' value=\"".$row['outbound_caller_id_name']."\">\n";
echo " </td>\n";
echo " <td class='row_style".$c." row_style_slim'>\n";
echo " <input class='formfld' style='min-width: 50px; max-width: 100px;' type='text' name='extensions[".$x."][outbound_caller_id_number]' maxlength='255' value=\"".$row['outbound_caller_id_number']."\">\n";
echo " </td>\n";
} }
//show the description
echo " <td class='row_style".$c." row_style_slim'>\n";
echo " ".$row['description'];
echo " </td>\n"; echo " </td>\n";
//end the row //end the row
echo " </tr>\n"; echo " </tr>\n";
//set the previous extension_uuid //set the previous extension_uuid
$previous_extension_uuid = $row['extension_uuid']; $previous_extension_uuid = $extension_uuid;
//increment the array key //increment the array key
$x++; $x++;
//alternate the value //alternate the value