Database Transactions: List view updates. Misc Action Bar adjustments. Include missing class for Conferences (Doh).
This commit is contained in:
parent
5a1cb4f8c6
commit
c6d5516467
|
|
@ -135,7 +135,7 @@
|
|||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'access_controls.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo " <span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
echo " </form>\n";
|
||||
echo " </div>\n";
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@
|
|||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'bridges.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo " <span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
echo " </form>\n";
|
||||
echo " </div>\n";
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@
|
|||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_block.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo " <span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
echo " </form>\n";
|
||||
echo " </div>\n";
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@
|
|||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_broadcast.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo " <span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
echo " </form>\n";
|
||||
echo " </div>\n";
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_center_queue.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo " <span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
echo " </form>\n";
|
||||
echo " </div>\n";
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@
|
|||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_center_agents.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo " <span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
echo button::create(['type'=>'button','label'=>$text['button-status'],'icon'=>'user-clock','style'=>'margin-left: 15px;','link'=>'call_center_agent_status.php']);
|
||||
echo " </form>\n";
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@
|
|||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_center_queues.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo " <span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
if (permission_exists('call_center_agent_view')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-agents'],'icon'=>'users','style'=>'margin-left: 15px;','link'=>'call_center_agents.php']);
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@
|
|||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_flows.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo " <span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
echo " </form>\n";
|
||||
echo " </div>\n";
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@
|
|||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'calls.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo " <span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
echo " </form>\n";
|
||||
echo " </div>\n";
|
||||
|
|
|
|||
|
|
@ -120,7 +120,6 @@
|
|||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title']." (".$num_rows.")</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
// echo " <span id='refresh_state'><img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 2px; margin-right: 20px; cursor: pointer;' onclick='refresh_stop();' alt=\"".$text['label-refresh_pause']."\" title=\"".$text['label-refresh_pause']."\"></span>";
|
||||
echo " <span id='refresh_state'>".button::create(['type'=>'button','title'=>$text['label-refresh_pause'],'icon'=>'sync-alt fa-spin','onclick'=>'refresh_stop()'])."</span>";
|
||||
if (permission_exists('call_active_hangup') && $rows) {
|
||||
echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','onclick'=>"if (confirm('".$text['confirm-hangups']."')) { list_action_set('hangup'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@
|
|||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'conference_centers.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo " <span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
echo "<span style='margin-left: 15px;'>";
|
||||
if (permission_exists('conference_active_advanced_view')) {
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@
|
|||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'conferences.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo " <span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
if (permission_exists('conference_active_view')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-view_active'],'icon'=>'comments','style'=>'margin-left: 15px;','link'=>PROJECT_PATH.'/app/conferences_active/conferences_active.php']);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,385 @@
|
|||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2019
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//define the conferences class
|
||||
if (!class_exists('conferences')) {
|
||||
class conferences {
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
private $app_name;
|
||||
private $app_uuid;
|
||||
private $permission_prefix;
|
||||
private $list_page;
|
||||
private $table;
|
||||
private $uuid_prefix;
|
||||
private $toggle_field;
|
||||
private $toggle_values;
|
||||
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
//assign private variables
|
||||
$this->app_name = 'conferences';
|
||||
$this->app_uuid = 'b81412e8-7253-91f4-e48e-42fc2c9a38d9';
|
||||
$this->permission_prefix = 'conference_';
|
||||
$this->list_page = 'conferences.php';
|
||||
$this->table = 'conferences';
|
||||
$this->uuid_prefix = 'conference_';
|
||||
$this->toggle_field = 'conference_enabled';
|
||||
$this->toggle_values = ['true','false'];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* called when there are no references to a particular object
|
||||
* unset the variables used in the class
|
||||
*/
|
||||
public function __destruct() {
|
||||
foreach ($this as $key => $value) {
|
||||
unset($this->$key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* delete records
|
||||
*/
|
||||
public function delete($records) {
|
||||
if (permission_exists($this->permission_prefix.'delete')) {
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: '.$this->list_page);
|
||||
exit;
|
||||
}
|
||||
|
||||
//delete multiple records
|
||||
if (is_array($records) && @sizeof($records) != 0) {
|
||||
|
||||
//build the delete array
|
||||
foreach ($records as $x => $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
|
||||
//get the dialplan uuid
|
||||
$sql = "select dialplan_uuid from v_conferences ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and conference_uuid = :conference_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['conference_uuid'] = $record['uuid'];
|
||||
$database = new database;
|
||||
$dialplan_uuid = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//build array
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['conference_users'][$x]['conference_uuid'] = $record['uuid'];
|
||||
$array['conference_users'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['dialplan_details'][$x]['dialplan_uuid'] = $dialplan_uuid;
|
||||
$array['dialplan_details'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['dialplans'][$x]['dialplan_uuid'] = $dialplan_uuid;
|
||||
$array['dialplans'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//delete the checked rows
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p->add('conference_user_delete', 'temp');
|
||||
$p->add('dialplan_detail_delete', 'temp');
|
||||
$p->add('dialplan_delete', 'temp');
|
||||
|
||||
//execute delete
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->delete($array);
|
||||
unset($array);
|
||||
|
||||
//revoke temporary permissions
|
||||
$p->delete('conference_user_delete', 'temp');
|
||||
$p->delete('dialplan_detail_delete', 'temp');
|
||||
$p->delete('dialplan_delete', 'temp');
|
||||
|
||||
//syncrhonize configuration
|
||||
save_dialplan_xml();
|
||||
|
||||
//apply settings reminder
|
||||
$_SESSION["reload_xml"] = true;
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["context"]);
|
||||
|
||||
//set message
|
||||
message::add($text['message-delete']);
|
||||
|
||||
}
|
||||
unset($records);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* toggle records
|
||||
*/
|
||||
public function toggle($records) {
|
||||
if (permission_exists($this->permission_prefix.'edit')) {
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: '.$this->list_page);
|
||||
exit;
|
||||
}
|
||||
|
||||
//toggle the checked records
|
||||
if (is_array($records) && @sizeof($records) != 0) {
|
||||
|
||||
//get current toggle state
|
||||
foreach($records as $x => $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'";
|
||||
}
|
||||
}
|
||||
if (is_array($record_uuids) && @sizeof($record_uuids) != 0) {
|
||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, dialplan_uuid from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ( ".implode(' or ', $record_uuids)." ) ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$rows = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
$conferences[$row['uuid']]['state'] = $row['toggle'];
|
||||
$conferences[$row['uuid']]['dialplan_uuid'] = $row['dialplan_uuid'];
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $rows, $row);
|
||||
}
|
||||
|
||||
//build update array
|
||||
$x = 0;
|
||||
foreach($conferences as $uuid => $conference) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid;
|
||||
$array[$this->table][$x][$this->toggle_field] = $conference['state'] == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0];
|
||||
$array['dialplans'][$x]['dialplan_uuid'] = $conference['dialplan_uuid'];
|
||||
$array['dialplans'][$x]['dialplan_enabled'] = $conference['state'] == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0];
|
||||
$x++;
|
||||
}
|
||||
|
||||
//save the changes
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
|
||||
//save the array
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->save($array);
|
||||
unset($array);
|
||||
|
||||
//revoke temporary permissions
|
||||
$p->delete('dialplan_edit', 'temp');
|
||||
|
||||
//syncrhonize configuration
|
||||
save_dialplan_xml();
|
||||
|
||||
//apply settings reminder
|
||||
$_SESSION["reload_xml"] = true;
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["context"]);
|
||||
|
||||
//set message
|
||||
message::add($text['message-toggle']);
|
||||
}
|
||||
unset($records, $states);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* copy records
|
||||
*/
|
||||
public function copy($records) {
|
||||
if (permission_exists($this->permission_prefix.'add')) {
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: '.$this->list_page);
|
||||
exit;
|
||||
}
|
||||
|
||||
//copy the checked records
|
||||
if (is_array($records) && @sizeof($records) != 0) {
|
||||
|
||||
//get checked records
|
||||
foreach($records as $x => $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'";
|
||||
}
|
||||
}
|
||||
|
||||
//create insert array from existing data
|
||||
if (is_array($record_uuids) && @sizeof($record_uuids) != 0) {
|
||||
$sql = "select * from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ( ".implode(' or ', $record_uuids)." ) ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$rows = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
$y = 0;
|
||||
foreach ($rows as $x => $row) {
|
||||
|
||||
//copy data
|
||||
$array[$this->table][$x] = $row;
|
||||
|
||||
//overwrite
|
||||
$conference_uuid = uuid();
|
||||
$dialplan_uuid = uuid();
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $conference_uuid;
|
||||
$array[$this->table][$x]['dialplan_uuid'] = $dialplan_uuid;
|
||||
$array[$this->table][$x]['conference_description'] = trim($row['conference_description'].' ('.$text['label-copy'].')');
|
||||
|
||||
//get conference conference users
|
||||
$sql = "select * from v_conference_users ";
|
||||
$sql .= "where conference_uuid = :conference_uuid ";
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$parameters['conference_uuid'] = $row['conference_uuid'];
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$conference_users = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//insert the conference users in array
|
||||
if (is_array($conference_users) && @sizeof($conference_users) != 0) {
|
||||
foreach ($conference_users as $user) {
|
||||
$array['conference_users'][$y]['conference_user_uuid'] = uuid();
|
||||
$array['conference_users'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['conference_users'][$y]['conference_uuid'] = $conference_uuid;
|
||||
$array['conference_users'][$y]['user_uuid'] = $user['user_uuid'];
|
||||
$y++;
|
||||
}
|
||||
}
|
||||
|
||||
//build the dialplan xml
|
||||
$dialplan_xml = "<extension name=\"".$row['conference_name']."\" continue=\"\" uuid=\"".$dialplan_uuid."\">\n";
|
||||
$dialplan_xml .= " <condition field=\"destination_number\" expression=\"^".$row['conference_extension']."\">\n";
|
||||
$dialplan_xml .= " <action application=\"answer\" data=\"\"/>\n";
|
||||
$dialplan_xml .= " <action application=\"conference\" data=\"".$conference_uuid."@".$_SESSION['domain_name']."@default+flags{'".$row['conference_flags']."}\"/>\n";
|
||||
$dialplan_xml .= " </condition>\n";
|
||||
$dialplan_xml .= "</extension>\n";
|
||||
|
||||
//insert the conference dialplan in array
|
||||
$array['dialplans'][$x]['dialplan_uuid'] = $dialplan_uuid;
|
||||
$array['dialplans'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['dialplans'][$x]['dialplan_name'] = $row['conference_name'];
|
||||
$array['dialplans'][$x]['dialplan_number'] = $row['conference_extension'];
|
||||
$array['dialplans'][$x]['app_uuid'] = 'b81412e8-7253-91f4-e48e-42fc2c9a38d9';
|
||||
$array['dialplans'][$x]['dialplan_xml'] = $dialplan_xml;
|
||||
$array['dialplans'][$x]['dialplan_order'] = '333';
|
||||
$array['dialplans'][$x]['dialplan_context'] = $_SESSION['context'];
|
||||
$array['dialplans'][$x]['dialplan_enabled'] = $row['conference_enabled'];
|
||||
$array['dialplans'][$x]['dialplan_description'] = $row['conference_description'].' ('.$text['label-copy'].')';
|
||||
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $rows, $row);
|
||||
}
|
||||
|
||||
//save the changes and set the message
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p->add('conference_user_add', 'temp');
|
||||
$p->add('dialplan_add', 'temp');
|
||||
|
||||
//save the array
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->save($array);
|
||||
unset($array);
|
||||
|
||||
//revoke temporary permissions
|
||||
$p->delete('conference_user_add', 'temp');
|
||||
$p->delete('dialplan_add', 'temp');
|
||||
|
||||
//syncrhonize configuration
|
||||
save_dialplan_xml();
|
||||
|
||||
//apply settings reminder
|
||||
$_SESSION["reload_xml"] = true;
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["context"]);
|
||||
|
||||
//set message
|
||||
message::add($text['message-copy']);
|
||||
|
||||
}
|
||||
unset($records);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -260,7 +260,7 @@
|
|||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'contacts.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo " <span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
if (permission_exists('contact_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-import'],'icon'=>'file-import','link'=>'contact_import.php','style'=>'margin-left: 15px;']);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2016
|
||||
Portions created by the Initial Developer are Copyright (C) 2016 - 2019
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -27,10 +27,10 @@
|
|||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//check permissions
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('database_transaction_view')) {
|
||||
//access granted
|
||||
}
|
||||
|
|
@ -43,26 +43,34 @@
|
|||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get posted data
|
||||
if (is_array($_POST['bridges'])) {
|
||||
$action = $_POST['action'];
|
||||
$search = $_POST['search'];
|
||||
}
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"] != '' ? $_GET['order_by'] : 'transaction_date';
|
||||
$order = $_GET["order"] != '' ? $_GET['order'] : 'desc';
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//add the search term
|
||||
$search = strtolower($_GET["search"]);
|
||||
if ($search != '') {
|
||||
$sql_search = "and (";
|
||||
$sql_search .= " lower(app_name) like :search ";
|
||||
$sql_search .= " or lower(transaction_code) like :search ";
|
||||
$sql_search .= " or lower(transaction_address) like :search ";
|
||||
$sql_search .= " or lower(transaction_type) like :search ";
|
||||
$sql_search .= " or cast(transaction_date as text) like :search ";
|
||||
$sql_search .= " lower(t.app_name) like :search ";
|
||||
$sql_search .= " or lower(t.transaction_code) like :search ";
|
||||
$sql_search .= " or lower(t.transaction_address) like :search ";
|
||||
$sql_search .= " or lower(t.transaction_type) like :search ";
|
||||
$sql_search .= " or cast(t.transaction_date as text) like :search ";
|
||||
$sql_search .= ") ";
|
||||
$parameters['search'] = '%'.$search.'%';
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(database_transaction_uuid) from v_database_transactions ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql = "select count(*) from v_database_transactions as t ";
|
||||
$sql .= "left outer join v_domains as d using (domain_uuid) ";
|
||||
$sql .= "left outer join v_users as u using (user_uuid) ";
|
||||
$sql .= "where t.domain_uuid = :domain_uuid ";
|
||||
$sql .= $sql_search;
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
|
|
@ -73,46 +81,42 @@
|
|||
$param = "search=".$search;
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
|
||||
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select ";
|
||||
$sql .= "t.database_transaction_uuid, d.domain_name, u.username, t.user_uuid, t.app_name, t.app_uuid, ";
|
||||
$sql .= "t.transaction_code, t.transaction_address, t.transaction_type, t.transaction_date ";
|
||||
$sql .= "from v_database_transactions as t ";
|
||||
$sql .= "left outer join v_domains as d using (domain_uuid) ";
|
||||
$sql .= "left outer join v_users as u using (user_uuid) ";
|
||||
$sql .= "where t.domain_uuid = :domain_uuid ";
|
||||
$sql .= $sql_search;
|
||||
$sql .= order_by($order_by, $order);
|
||||
$sql = str_replace('count(*)','t.database_transaction_uuid, d.domain_name, u.username, t.user_uuid, t.app_name, t.app_uuid, t.transaction_code, t.transaction_address, t.transaction_type, t.transaction_date', $sql);
|
||||
$sql .= order_by($order_by, $order, 't.transaction_date', 'desc');
|
||||
$sql .= limit_offset($rows_per_page, $offset);
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
|
||||
//alternate the row style
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
unset($sql);
|
||||
|
||||
//additional includes
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-database_transactions']."</b></td>\n";
|
||||
echo " <form method='get' action=''>\n";
|
||||
echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
|
||||
echo " <input type='text' class='txt' style='width: 150px' name='search' id='search' value='".escape($search)."'>\n";
|
||||
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-database_transactions']." (".$num_rows.")</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo "<form id='form_search' class='inline' method='get'>\n";
|
||||
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
|
||||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'bridges.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
echo " </form>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo $text['description-database_transactions']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<table class='list'>\n";
|
||||
echo "<tr class='list-header'>\n";
|
||||
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
|
||||
echo th_order_by('username', $text['label-user_uuid'], $order_by, $order);
|
||||
echo th_order_by('app_name', $text['label-app_name'], $order_by, $order);
|
||||
|
|
@ -123,58 +127,44 @@
|
|||
//echo th_order_by('transaction_old', $text['label-transaction_old'], $order_by, $order);
|
||||
//echo th_order_by('transaction_new', $text['label-transaction_new'], $order_by, $order);
|
||||
//echo th_order_by('transaction_result', $text['label-transaction_result'], $order_by, $order);
|
||||
echo "<td class='list_control_icon'>";
|
||||
echo " \n";
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
if (permission_exists('database_transaction_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($result)) {
|
||||
$x = 0;
|
||||
foreach($result as $row) {
|
||||
if (permission_exists('database_transaction_edit')) {
|
||||
$tr_link = "href='database_transaction_edit.php?id=".urlencode($row['database_transaction_uuid']).($page != '' ? "&page=".urlencode($page) : null).($search != '' ? "&search=".urlencode($search) : null)."'";
|
||||
$list_row_url = "database_transaction_edit.php?id=".urlencode($row['database_transaction_uuid']).($page != '' ? "&page=".urlencode($page) : null).($search != '' ? "&search=".urlencode($search) : null);
|
||||
}
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['domain_name'])." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['username'])." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['app_name'])." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['transaction_code'])." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['transaction_address'])." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['transaction_type'])." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['transaction_date'])." </td>\n";
|
||||
//echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['transaction_old']." </td>\n";
|
||||
//echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['transaction_new']." </td>\n";
|
||||
//echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['transaction_result']." </td>\n";
|
||||
echo " <td class='list_control_icon'>";
|
||||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
echo " <td>".escape($row['domain_name'])." </td>\n";
|
||||
echo " <td>".escape($row['username'])." </td>\n";
|
||||
echo " <td><a href='".$list_row_url."'>".escape($row['app_name'])."</a> </td>\n";
|
||||
echo " <td>".escape($row['transaction_code'])." </td>\n";
|
||||
echo " <td>".escape($row['transaction_address'])." </td>\n";
|
||||
echo " <td>".escape($row['transaction_type'])." </td>\n";
|
||||
echo " <td>".escape($row['transaction_date'])." </td>\n";
|
||||
//echo " <td>".escape($row['transaction_old']." </td>\n";
|
||||
//echo " <td>".escape($row['transaction_new']." </td>\n";
|
||||
//echo " <td>".escape($row['transaction_result']." </td>\n";
|
||||
if (permission_exists('database_transaction_edit')) {
|
||||
echo "<a href='database_transaction_edit.php?id=".urlencode($row['database_transaction_uuid']).($page != '' ? "&page=".urlencode($page) : null).($search != '' ? "&search=".urlencode($search) : null)."' alt='".$text['button-view']."'>$v_link_label_view</a>";
|
||||
echo " <td class='action-button'>";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
}
|
||||
//if (permission_exists('database_transaction_delete')) {
|
||||
// echo "<a href='database_transaction_delete.php?id=".escape($row['database_transaction_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||
//}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
$x++;
|
||||
}
|
||||
unset($result);
|
||||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='11' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap='nowrap'> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
echo " ";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>";
|
||||
echo "<br /><br />";
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
echo "<div align='center'>".$paging_controls."</div>\n";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
Loading…
Reference in New Issue