Extensions: Database class integration.
This commit is contained in:
@@ -118,8 +118,8 @@
|
||||
header("Location: /core/user_settings/user_dashboard.php");
|
||||
exit;
|
||||
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0)
|
||||
}
|
||||
}
|
||||
|
||||
//set the sub array index
|
||||
$x = "999";
|
||||
@@ -132,13 +132,13 @@
|
||||
|
||||
//get the destinations
|
||||
$sql = "select destination_caller_id_name, destination_caller_id_number from v_destinations ";
|
||||
$sql .= "where domain_uuid = '".check_str($_SESSION['domain_uuid'])."' ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and destination_type = 'inbound' ";
|
||||
$sql .= "order by destination_caller_id_name asc, destination_caller_id_number asc";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$destinations = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
unset ($sql, $prep_statement);
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$destinations = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show the content
|
||||
echo "<form name='caller_id_form' id='caller_id_form' method='post' action='/app/extensions/extension_dashboard.php'>\n";
|
||||
@@ -156,99 +156,99 @@
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
$x = 0;
|
||||
foreach($extensions as $row) {
|
||||
//set the variables
|
||||
$extension_uuid = $row['extension_uuid'];
|
||||
$user = $row['user'];
|
||||
$number_alias = $row['number_alias'];
|
||||
$destination = $row['destination'];
|
||||
$outbound_caller_id_name = $row['outbound_caller_id_name'];
|
||||
$outbound_caller_id_number = $row['outbound_caller_id_number'];
|
||||
$description = $row['description'];
|
||||
if (is_array($extensions) && @sizeof($extensions) != 0) {
|
||||
foreach($extensions as $row) {
|
||||
//set the variables
|
||||
$extension_uuid = $row['extension_uuid'];
|
||||
$user = $row['user'];
|
||||
$number_alias = $row['number_alias'];
|
||||
$destination = $row['destination'];
|
||||
$outbound_caller_id_name = $row['outbound_caller_id_name'];
|
||||
$outbound_caller_id_number = $row['outbound_caller_id_number'];
|
||||
$description = $row['description'];
|
||||
|
||||
//set the column names
|
||||
if ($x === 0 && $previous_extension_uuid != $row['extension_uuid']) {
|
||||
//set the column names
|
||||
if ($x === 0 && $previous_extension_uuid != $row['extension_uuid']) {
|
||||
echo " <tr>\n";
|
||||
echo " <th>".$text['label-extension']."</th>\n";
|
||||
echo " <th>".$text['label-caller_id']."</th>\n";
|
||||
echo " <th>".$text['label-description']."</th>\n";
|
||||
echo " </tr>\n";
|
||||
}
|
||||
|
||||
//determine whether to hide the element
|
||||
if (strlen($device_key_uuid) == 0) {
|
||||
$element['hidden'] = false;
|
||||
$element['visibility'] = "visibility:visible;";
|
||||
}
|
||||
else {
|
||||
$element['hidden'] = true;
|
||||
$element['visibility'] = "visibility:hidden;";
|
||||
}
|
||||
|
||||
//start the row
|
||||
echo " <tr>\n";
|
||||
echo " <th>".$text['label-extension']."</th>\n";
|
||||
echo " <th>".$text['label-caller_id']."</th>\n";
|
||||
echo " <th>".$text['label-description']."</th>\n";
|
||||
echo " </tr>\n";
|
||||
}
|
||||
|
||||
//determine whether to hide the element
|
||||
if (strlen($device_key_uuid) == 0) {
|
||||
$element['hidden'] = false;
|
||||
$element['visibility'] = "visibility:visible;";
|
||||
}
|
||||
else {
|
||||
$element['hidden'] = true;
|
||||
$element['visibility'] = "visibility:hidden;";
|
||||
}
|
||||
//add the primary key uuid
|
||||
if (strlen($row['extension_uuid']) > 0) {
|
||||
echo " <input name='extensions[".$x."][extension_uuid]' type='hidden' value=\"".escape($row['extension_uuid'])."\">\n";
|
||||
}
|
||||
|
||||
//start the row
|
||||
echo " <tr>\n";
|
||||
|
||||
//add the primary key uuid
|
||||
if (strlen($row['extension_uuid']) > 0) {
|
||||
echo " <input name='extensions[".$x."][extension_uuid]' type='hidden' value=\"".escape($row['extension_uuid'])."\">\n";
|
||||
}
|
||||
|
||||
//show the destination
|
||||
echo " <td class='row_style".$c." row_style_slim'>\n";
|
||||
echo " ".$row['destination'];
|
||||
echo " </td>\n";
|
||||
|
||||
//caller id form input
|
||||
if (permission_exists('outbound_caller_id_select')) {
|
||||
//caller id select
|
||||
//show the destination
|
||||
echo " <td class='row_style".$c." row_style_slim'>\n";
|
||||
if (count($destinations) > 0) {
|
||||
echo " <select name='extensions[".$x."][outbound_caller_id]' id='outbound_caller_id_number' class='formfld'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach ($destinations as &$field) {
|
||||
if(strlen($field['destination_caller_id_number']) > 0) {
|
||||
if ($outbound_caller_id_number == $field['destination_caller_id_number']) {
|
||||
echo " <option value='".escape($field['destination_caller_id_name'])."@".escape($field['destination_caller_id_number'])."' selected='selected'>".escape($field['destination_caller_id_name'])." ".escape($field['destination_caller_id_number'])."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".escape($field['destination_caller_id_name'])."@".escape($field['destination_caller_id_number'])."'>".escape($field['destination_caller_id_name'])." ".escape($field['destination_caller_id_number'])."</option>\n";
|
||||
echo " ".$row['destination'];
|
||||
echo " </td>\n";
|
||||
|
||||
//caller id form input
|
||||
if (permission_exists('outbound_caller_id_select')) {
|
||||
//caller id select
|
||||
echo " <td class='row_style".$c." row_style_slim'>\n";
|
||||
if (count($destinations) > 0) {
|
||||
echo " <select name='extensions[".$x."][outbound_caller_id]' id='outbound_caller_id_number' class='formfld'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach ($destinations as &$field) {
|
||||
if(strlen($field['destination_caller_id_number']) > 0) {
|
||||
if ($outbound_caller_id_number == $field['destination_caller_id_number']) {
|
||||
echo " <option value='".escape($field['destination_caller_id_name'])."@".escape($field['destination_caller_id_number'])."' selected='selected'>".escape($field['destination_caller_id_name'])." ".escape($field['destination_caller_id_number'])."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".escape($field['destination_caller_id_name'])."@".escape($field['destination_caller_id_number'])."'>".escape($field['destination_caller_id_name'])." ".escape($field['destination_caller_id_number'])."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo " </select>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
else {
|
||||
//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=\"".escape($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";
|
||||
}
|
||||
echo " </td>\n";
|
||||
}
|
||||
else {
|
||||
//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=\"".escape($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";
|
||||
//show the description
|
||||
echo " <td class='row_style".$c." row_style_slim'>\n";
|
||||
echo " ".$row['description'];
|
||||
echo " </td>\n";
|
||||
|
||||
//end the row
|
||||
echo " </tr>\n";
|
||||
//set the previous extension_uuid
|
||||
$previous_extension_uuid = $extension_uuid;
|
||||
//increment the array key
|
||||
$x++;
|
||||
//alternate the value
|
||||
$c = ($c) ? 0 : 1;
|
||||
//end the row
|
||||
echo " </tr>\n";
|
||||
//set the previous extension_uuid
|
||||
$previous_extension_uuid = $extension_uuid;
|
||||
//increment the array key
|
||||
$x++;
|
||||
//alternate the value
|
||||
$c = $c ? 0 : 1;
|
||||
}
|
||||
}
|
||||
unset($extensions, $row);
|
||||
echo "</table>\n";
|
||||
|
||||
|
||||
echo "</form>";
|
||||
|
||||
//show the footer
|
||||
//require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user