mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-04 18:53:49 +00:00
Add a new dashboard
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('call_center_queue_view')) {
|
||||
14
app/call_centers/resources/dashboard/config.php
Normal file
14
app/call_centers/resources/dashboard/config.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
$array['dashboard'][$x]['dashboard_uuid'] = '9083305a-ebb4-4b67-bb9b-8c09cf030261';
|
||||
$array['dashboard'][$x]['dashboard_name'] = 'Call Center Agents';
|
||||
$array['dashboard'][$x]['dashboard_path'] = 'app/call_centers/resources/dashboard/call_center_agents.php';
|
||||
$array['dashboard'][$x]['dashboard_order'] = '160';
|
||||
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
|
||||
$array['dashboard'][$x]['dashboard_description'] = 'Status for agent in a call center.';
|
||||
$y = 0;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '22d8937c-a9b3-4458-b34c-0ebeda15ffad';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '9083305a-ebb4-4b67-bb9b-8c09cf030261';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'agent';
|
||||
|
||||
?>
|
||||
@@ -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) 2008-2019
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2021
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get($_SESSION['domain']['language']['code'], 'app/calls');
|
||||
$text = $language->get($_SESSION['domain']['language']['code'], 'app/call_forward');
|
||||
|
||||
//get posted data
|
||||
if (is_array($_POST['extensions'])) {
|
||||
@@ -73,7 +73,7 @@
|
||||
break;
|
||||
}
|
||||
|
||||
header('Location: calls.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
header('Location: call_forward.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
echo " <div class='heading'><b>".$text['header-call_forward']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
if ($num_rows > 10) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-view_all'],'icon'=>'project-diagram','collapse'=>false,'link'=>PROJECT_PATH.'/app/calls/calls.php']);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-view_all'],'icon'=>'project-diagram','collapse'=>false,'link'=>PROJECT_PATH.'/app/call_forward/call_forward.php']);
|
||||
}
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
@@ -231,7 +231,7 @@
|
||||
}
|
||||
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'=>'calls.php','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_forward.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
@@ -284,7 +284,7 @@
|
||||
if (is_array($extensions)) {
|
||||
$x = 0;
|
||||
foreach($extensions as $row) {
|
||||
$list_row_url = PROJECT_PATH."/app/calls/call_edit.php?id=".$row['extension_uuid']."&return_url=".urlencode($_SERVER['REQUEST_URI']);
|
||||
$list_row_url = PROJECT_PATH."/app/call_forward/call_forward_edit.php?id=".$row['extension_uuid']."&return_url=".urlencode($_SERVER['REQUEST_URI']);
|
||||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (!$is_included && $extensions) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
|
||||
@@ -495,7 +495,7 @@
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-call_forward']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'calls.php']);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'call_forward.php']);
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','style'=>'margin-left: 15px;']);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
|
||||
51
app/call_forward/resources/dashboard/call_forward.php
Normal file
51
app/call_forward/resources/dashboard/call_forward.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?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) 2021
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//includes
|
||||
//require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('follow_me') || permission_exists('call_forward') || permission_exists('do_not_disturb')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get($_SESSION['domain']['language']['code'], 'app/call_forward');
|
||||
|
||||
//set a variable for the included code to know its included
|
||||
$is_included = true;
|
||||
|
||||
//include the call forward
|
||||
require_once "app/call_forward/call_forward.php";
|
||||
|
||||
?>
|
||||
22
app/call_forward/resources/dashboard/config.php
Normal file
22
app/call_forward/resources/dashboard/config.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
$array['dashboard'][$x]['dashboard_uuid'] = 'ba60799a-1c40-44a8-80ef-c2be4f4692fb';
|
||||
$array['dashboard'][$x]['dashboard_name'] = 'Call Forward';
|
||||
$array['dashboard'][$x]['dashboard_path'] = 'app/call_forward/resources/dashboard/call_forward.php';
|
||||
$array['dashboard'][$x]['dashboard_order'] = '0';
|
||||
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
|
||||
$array['dashboard'][$x]['dashboard_description'] = 'Call routing for extension using Call forward, Follow Me and Do Not Disturb.';
|
||||
$y = 0;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '5de9537d-4098-405f-9922-caf5f85fade3';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'ba60799a-1c40-44a8-80ef-c2be4f4692fb';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
|
||||
$y++;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'b550e850-36d5-4cde-9936-85180f401df4';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'ba60799a-1c40-44a8-80ef-c2be4f4692fb';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
|
||||
$y++;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '6d04646f-54cf-49f4-a3ce-a16e7adda2b9';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'ba60799a-1c40-44a8-80ef-c2be4f4692fb';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
|
||||
|
||||
?>
|
||||
14
app/devices/resources/dashboard/config.php
Normal file
14
app/devices/resources/dashboard/config.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
$array['dashboard'][$x]['dashboard_uuid'] = 'f1c722d5-b714-4fa2-9664-5f6d24d44661';
|
||||
$array['dashboard'][$x]['dashboard_name'] = 'Device Keys';
|
||||
$array['dashboard'][$x]['dashboard_path'] = 'app/devices/resources/dashboard/device_keys.php';
|
||||
$array['dashboard'][$x]['dashboard_order'] = '160';
|
||||
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
|
||||
$array['dashboard'][$x]['dashboard_description'] = '';
|
||||
$y = 0;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '0d04d50e-aa49-40d2-9e98-ed21f9070f6f';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'f1c722d5-b714-4fa2-9664-5f6d24d44661';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
|
||||
|
||||
?>
|
||||
22
app/domain_limits/resources/dashboard/config.php
Normal file
22
app/domain_limits/resources/dashboard/config.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
$array['dashboard'][$x]['dashboard_uuid'] = '2f7a90cc-8d60-4df4-98ee-2ef4000afac7';
|
||||
$array['dashboard'][$x]['dashboard_name'] = 'Domain Limits';
|
||||
$array['dashboard'][$x]['dashboard_path'] = 'app/domain_limits/resources/dashboard/domain_limits.php';
|
||||
$array['dashboard'][$x]['dashboard_order'] = '180';
|
||||
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
|
||||
$array['dashboard'][$x]['dashboard_description'] = '';
|
||||
$y = 0;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'e99eb62e-4150-42a8-8c0c-4a264245f12a';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '2f7a90cc-8d60-4df4-98ee-2ef4000afac7';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
|
||||
$y++;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'db7c3c71-9761-4bd9-a166-ea5a0de2cd0e';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '2f7a90cc-8d60-4df4-98ee-2ef4000afac7';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
|
||||
$y++;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'b8772e85-bcbd-4e8c-afba-e9c04a700bfa';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '2f7a90cc-8d60-4df4-98ee-2ef4000afac7';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
|
||||
|
||||
?>
|
||||
117
app/domain_limits/resources/dashboard/domain_limits.php
Normal file
117
app/domain_limits/resources/dashboard/domain_limits.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
|
||||
//check permisions
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('xml_cdr_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get($_SESSION['domain']['language']['code'], 'core/user_settings');
|
||||
|
||||
//domain limits
|
||||
if (is_array($_SESSION['limit']) && sizeof($_SESSION['limit']) > 0) {
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
$show_stat = true;
|
||||
if (permission_exists('extension_view')) {
|
||||
$sql = "select count(extension_uuid) from v_extensions ";
|
||||
$database = new database;
|
||||
$extension_total = $database->select($sql, null, 'column');
|
||||
|
||||
$onclick = "onclick=\"document.location.href='".PROJECT_PATH."/app/extensions/extensions.php'\"";
|
||||
$hud_stat = $extension_total;
|
||||
$hud_stat_title = $text['label-total_extensions'];
|
||||
}
|
||||
else if (permission_exists('destination_view')) {
|
||||
$sql = "select count(destination_uuid) from v_destinations ";
|
||||
$database = new database;
|
||||
$destination_total = $database->select($sql, null, 'column');
|
||||
|
||||
$onclick = "onclick=\"document.location.href='".PROJECT_PATH."/app/destinations/destinations.php'\"";
|
||||
$hud_stat = $destination_total;
|
||||
$hud_stat_title = $text['label-total_destinations'];
|
||||
}
|
||||
else {
|
||||
$show_stat = false;
|
||||
}
|
||||
|
||||
echo "<span class='hud_title' ".$onclick.">".$text['label-domain_limits']."</span>";
|
||||
|
||||
if ($show_stat) {
|
||||
echo "<span class='hud_stat' onclick=\"$('#hud_domain_limits_details').slideToggle('fast');\">".$hud_stat."</span>";
|
||||
echo "<span class='hud_stat_title' onclick=\"$('#hud_domain_limits_details').slideToggle('fast');\">".$hud_stat_title."</span>\n";
|
||||
}
|
||||
|
||||
echo "<div class='hud_details hud_box' id='hud_domain_limits_details'>";
|
||||
echo "<table class='tr_hover' width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<th class='hud_heading' width='50%'>".$text['label-feature']."</th>\n";
|
||||
echo "<th class='hud_heading' width='50%' style='text-align: center;'>".$text['label-used']."</th>\n";
|
||||
echo "<th class='hud_heading' style='text-align: center;'>".$text['label-total']."</th>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
foreach ($_SESSION['limit'] as $category => $value) {
|
||||
$limit = $value['numeric'];
|
||||
switch ($category) {
|
||||
case 'users':
|
||||
if (!permission_exists('user_view')) { continue 2; }
|
||||
$url = '/core/users/users.php';
|
||||
break;
|
||||
case 'call_center_queues':
|
||||
if (!permission_exists('call_center_active_view')) { continue 2; }
|
||||
$url = '/app/call_centers/call_center_queues.php';
|
||||
break;
|
||||
case 'destinations':
|
||||
if (!permission_exists('destination_view')) { continue 2; }
|
||||
$url = '/app/destinations/destinations.php';
|
||||
break;
|
||||
case 'devices':
|
||||
if (!permission_exists('device_view')) { continue 2; }
|
||||
$url = '/app/devices/devices.php';
|
||||
break;
|
||||
case 'extensions':
|
||||
if (!permission_exists('extension_view')) { continue 2; }
|
||||
$url = '/app/extensions/extensions.php';
|
||||
break;
|
||||
case 'gateways':
|
||||
if (!permission_exists('gateway_view')) { continue 2; }
|
||||
$url = '/app/gateways/gateways.php';
|
||||
break;
|
||||
case 'ivr_menus':
|
||||
if (!permission_exists('ivr_menu_view')) { continue 2; }
|
||||
$url = '/app/ivr_menus/ivr_menus.php';
|
||||
break;
|
||||
case 'ring_groups':
|
||||
if (!permission_exists('ring_group_view')) { continue 2; }
|
||||
$url = '/app/ring_groups/ring_groups.php';
|
||||
break;
|
||||
}
|
||||
$tr_link = "href='".PROJECT_PATH.$url."'";
|
||||
echo "<tr ".$tr_link." style='cursor: pointer;'>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-'.$category]."</a></td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats['domain'][$category]['total']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$limit."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</div>";
|
||||
$n++;
|
||||
|
||||
echo " <span class='hud_expander' onclick=\"$('#hud_domain_limits_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -101,14 +101,14 @@
|
||||
|
||||
//update the session array
|
||||
foreach ($array['extensions'] as $row) {
|
||||
$x=0;
|
||||
foreach ($_SESSION['user']['extension'] as $field) {
|
||||
if ($field['extension_uuid'] == $row['extension_uuid']) {
|
||||
$_SESSION['user']['extension'][$x]['outbound_caller_id_name'] = $row['outbound_caller_id_name'];
|
||||
$_SESSION['user']['extension'][$x]['outbound_caller_id_number'] = $row['outbound_caller_id_number'];
|
||||
}
|
||||
$x++;
|
||||
$x=0;
|
||||
foreach ($_SESSION['user']['extension'] as $field) {
|
||||
if ($field['extension_uuid'] == $row['extension_uuid']) {
|
||||
$_SESSION['user']['extension'][$x]['outbound_caller_id_name'] = $row['outbound_caller_id_name'];
|
||||
$_SESSION['user']['extension'][$x]['outbound_caller_id_number'] = $row['outbound_caller_id_number'];
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
|
||||
//remove the temporary permission
|
||||
@@ -232,4 +232,4 @@
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
?>
|
||||
?>
|
||||
22
app/extensions/resources/dashboard/config.php
Normal file
22
app/extensions/resources/dashboard/config.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
$array['dashboard'][$x]['dashboard_uuid'] = '3bac3209-2f51-47db-b5fe-a1a804f49da9';
|
||||
$array['dashboard'][$x]['dashboard_name'] = 'Caller ID';
|
||||
$array['dashboard'][$x]['dashboard_path'] = 'app/extensions/resources/dashboard/caller_id.php';
|
||||
$array['dashboard'][$x]['dashboard_order'] = '160';
|
||||
$array['dashboard'][$x]['dashboard_enabled'] = 'false';
|
||||
$array['dashboard'][$x]['dashboard_description'] = '';
|
||||
$y = 0;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '931f7a2f-43fb-4d3d-8e39-e546a82206fa';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '3bac3209-2f51-47db-b5fe-a1a804f49da9';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
|
||||
$y++;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '47f4f687-d346-4614-b61f-fcf730f56d53';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '3bac3209-2f51-47db-b5fe-a1a804f49da9';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
|
||||
$y++;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'ab2dd268-057d-419d-bf5a-1d3730d60daa';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '3bac3209-2f51-47db-b5fe-a1a804f49da9';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
|
||||
|
||||
?>
|
||||
@@ -24,7 +24,7 @@
|
||||
$apps[$x]['menu'][$y]['uuid'] = "a1144e12-873e-4722-9818-02da1adb6ba3";
|
||||
$apps[$x]['menu'][$y]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
|
||||
$apps[$x]['menu'][$y]['category'] = "internal";
|
||||
$apps[$x]['menu'][$y]['path'] = "/app/calls/calls.php";
|
||||
$apps[$x]['menu'][$y]['path'] = "/app/call_forward/call_forward.php";
|
||||
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
|
||||
$apps[$x]['menu'][$y]['groups'][] = "admin";
|
||||
$apps[$x]['menu'][$y]['groups'][] = "user";
|
||||
|
||||
22
app/ring_groups/resources/dashboard/config.php
Normal file
22
app/ring_groups/resources/dashboard/config.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
$array['dashboard'][$x]['dashboard_uuid'] = 'b5da1d72-2cc7-422e-b05c-f07659aed419';
|
||||
$array['dashboard'][$x]['dashboard_name'] = 'Ring Group Forward';
|
||||
$array['dashboard'][$x]['dashboard_path'] = 'app/ring_groups/resources/dashboard/ring_group_forward.php';
|
||||
$array['dashboard'][$x]['dashboard_order'] = '140';
|
||||
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
|
||||
$array['dashboard'][$x]['dashboard_description'] = 'Used for updating ring group call forward.';
|
||||
$y = 0;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '7aa0fdf0-100a-4ee3-ae37-67cb9a021493';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'b5da1d72-2cc7-422e-b05c-f07659aed419';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
|
||||
$y++;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '10ec859b-2325-4d66-92ce-410da9e1ee62';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'b5da1d72-2cc7-422e-b05c-f07659aed419';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
|
||||
$y++;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'f7ef37b1-8134-48d1-b25a-d1a50bf0e339';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'b5da1d72-2cc7-422e-b05c-f07659aed419';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
|
||||
|
||||
?>
|
||||
@@ -59,14 +59,14 @@
|
||||
|
||||
//find the path
|
||||
switch ($_SERVER['REQUEST_URI']) {
|
||||
case PROJECT_PATH."/core/user_settings/user_dashboard.php":
|
||||
$validated_path = PROJECT_PATH."/core/user_settings/user_dashboard.php";
|
||||
case PROJECT_PATH."/app/dashboard/index.php":
|
||||
$validated_path = PROJECT_PATH."/app/dashboard/index.php";
|
||||
break;
|
||||
case PROJECT_PATH."/app/ring_groups/ring_group_forward.php":
|
||||
$validated_path = PROJECT_PATH."/app/ring_groups/ring_group_forward.php";
|
||||
break;
|
||||
default:
|
||||
$validated_path = PROJECT_PATH."/app/ring_groups/ring_group_forward.php";
|
||||
$validated_path = PROJECT_PATH."/app/ring_groups/resources/dashboard/ring_group_forward.php";
|
||||
}
|
||||
|
||||
//update ring group forwarding
|
||||
@@ -107,6 +107,7 @@
|
||||
|
||||
//set message
|
||||
message::add($text['message-update']);
|
||||
$validated_path = PROJECT_PATH."/app/dashboard/index.php";
|
||||
|
||||
//redirect the user
|
||||
header("Location: ".$validated_path);
|
||||
90
app/ring_groups/resources/dashboard/root.php
Normal file
90
app/ring_groups/resources/dashboard/root.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
umask(2);
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if (strpos($_ENV["OS"], "Win") !== false) {
|
||||
define("PATH_SEPARATOR", ";");
|
||||
} else {
|
||||
define("PATH_SEPARATOR", ":");
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
|
||||
if(PHP_SAPI == 'cli'){
|
||||
chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
|
||||
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
|
||||
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
|
||||
if (file_exists('/project_root.php')) {
|
||||
$path = '/';
|
||||
} else {
|
||||
$i = 1;
|
||||
$path = '';
|
||||
while ($i < count($dirs)) {
|
||||
$path .= '/' . $dirs[$i];
|
||||
if (file_exists($path. '/project_root.php')) {
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$_SERVER["DOCUMENT_ROOT"] = $path;
|
||||
}else{
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
}
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
// try to detect if a project path is being used
|
||||
if (!defined('PROJECT_PATH')) {
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
|
||||
define('PROJECT_PATH', '/fusionpbx');
|
||||
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
|
||||
define('PROJECT_PATH', '');
|
||||
} else {
|
||||
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
|
||||
$i = 1;
|
||||
$path = $_SERVER["DOCUMENT_ROOT"];
|
||||
while ($i < count($dirs)) {
|
||||
$path .= '/' . $dirs[$i];
|
||||
if (file_exists($path. '/project_root.php')) {
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if(!file_exists($path. '/project_root.php')){
|
||||
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
|
||||
}
|
||||
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
|
||||
define('PROJECT_PATH', $project_path);
|
||||
}
|
||||
$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
|
||||
}
|
||||
|
||||
?>
|
||||
30
app/system/resources/dashboard/config.php
Normal file
30
app/system/resources/dashboard/config.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
$array['dashboard'][$x]['dashboard_uuid'] = 'bb76f7fc-669f-41dd-a636-6ddaee5deae1';
|
||||
$array['dashboard'][$x]['dashboard_name'] = 'System Counts';
|
||||
$array['dashboard'][$x]['dashboard_path'] = 'app/system/resources/dashboard/system_counts.php';
|
||||
$array['dashboard'][$x]['dashboard_order'] = '80';
|
||||
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
|
||||
$array['dashboard'][$x]['dashboard_description'] = 'A list of showing the count of active and inactive domains, devices, extensions, gateways, users, desttinations, ring groups and more';
|
||||
$y = 0;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'a772d2a8-7c1f-4453-b77b-2e15b510a78d';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'bb76f7fc-669f-41dd-a636-6ddaee5deae1';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
|
||||
$y++;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '127382ae-0dd1-45eb-869c-56a708220de5';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'bb76f7fc-669f-41dd-a636-6ddaee5deae1';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
|
||||
|
||||
$x++;
|
||||
$array['dashboard'][$x]['dashboard_uuid'] = 'c9b1f67a-d78a-4299-a16e-594a4b7cd246';
|
||||
$array['dashboard'][$x]['dashboard_name'] = 'System Status';
|
||||
$array['dashboard'][$x]['dashboard_path'] = 'app/system/resources/dashboard/system_status.php';
|
||||
$array['dashboard'][$x]['dashboard_order'] = '100';
|
||||
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
|
||||
$array['dashboard'][$x]['dashboard_description'] = 'System information like CPU and DIsk usage.';
|
||||
$y = 0;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '625971b9-4892-4948-97e6-8bb8d409f4e1';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'c9b1f67a-d78a-4299-a16e-594a4b7cd246';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
|
||||
|
||||
?>
|
||||
197
app/system/resources/dashboard/system_counts.php
Normal file
197
app/system/resources/dashboard/system_counts.php
Normal file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
|
||||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
|
||||
//check permisions
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('xml_cdr_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get($_SESSION['domain']['language']['code'], 'core/user_settings');
|
||||
|
||||
//system counts
|
||||
//if (is_array($selected_blocks) && in_array('counts', $selected_blocks)) {
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
$scope = (permission_exists('dialplan_add')) ? 'system' : 'domain';
|
||||
|
||||
$show_stat = true;
|
||||
if (permission_exists('domain_view')) {
|
||||
$onclick = "onclick=\"document.location.href='".PROJECT_PATH."/core/domains/domains.php'\"";
|
||||
$hud_stat = $stats[$scope]['domains']['total'] - $stats[$scope]['domains']['disabled'];
|
||||
$hud_stat_title = $text['label-active_domains'];
|
||||
}
|
||||
else if (permission_exists('extension_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/extensions/")) {
|
||||
$onclick = "onclick=\"document.location.href='".PROJECT_PATH."/app/extensions/extensions.php'\"";
|
||||
$hud_stat = $stats[$scope]['extensions']['total'] - $stats[$scope]['extensions']['disabled'];
|
||||
$hud_stat_title = $text['label-active_extensions'];
|
||||
}
|
||||
else if ((permission_exists('user_view') || if_group("superadmin")) && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/core/users/")) {
|
||||
$onclick = "onclick=\"document.location.href='".PROJECT_PATH."/core/users/users.php'\"";
|
||||
$hud_stat = $stats[$scope]['users']['total'] - $stats[$scope]['users']['disabled'];
|
||||
$hud_stat_title = $text['label-active_users'];
|
||||
}
|
||||
else {
|
||||
$show_stat = false;
|
||||
}
|
||||
|
||||
echo "<span class='hud_title' ".$onclick.">".$text['label-system_counts']."</span>";
|
||||
|
||||
if ($show_stat) {
|
||||
echo "<span class='hud_stat' onclick=\"$('#hud_system_counts_details').slideToggle('fast');\">".$hud_stat."</span>";
|
||||
echo "<span class='hud_stat_title' onclick=\"$('#hud_system_counts_details').slideToggle('fast');\">".$hud_stat_title."</span>\n";
|
||||
}
|
||||
|
||||
echo "<div class='hud_details hud_box' id='hud_system_counts_details'>";
|
||||
echo "<table class='tr_hover' width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<th class='hud_heading' width='50%'>".$text['label-item']."</th>\n";
|
||||
echo "<th class='hud_heading' width='50%' style='text-align: center; padding-left: 0; padding-right: 0;'>".$text['label-disabled']."</th>\n";
|
||||
echo "<th class='hud_heading' style='text-align: center;'>".$text['label-total']."</th>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
//domains
|
||||
if (permission_exists('domain_view')) {
|
||||
$tr_link = "href='".PROJECT_PATH."/core/domains/domains.php'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-domains']."</a></td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['domains']['disabled']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['domains']['total']."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
|
||||
//devices
|
||||
if (permission_exists('device_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/devices/")) {
|
||||
$tr_link = "href='".PROJECT_PATH."/app/devices/devices.php'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-devices']."</a></td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['devices']['disabled']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['devices']['total']."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
|
||||
//extensions
|
||||
if (permission_exists('extension_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/extensions/")) {
|
||||
$tr_link = "href='".PROJECT_PATH."/app/extensions/extensions.php'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-extensions']."</a></td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['extensions']['disabled']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['extensions']['total']."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
|
||||
//gateways
|
||||
if (permission_exists('gateway_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/gateways/")) {
|
||||
$tr_link = "href='".PROJECT_PATH."/app/gateways/gateways.php'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-gateways']."</a></td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['gateways']['disabled']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['gateways']['total']."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
|
||||
//users
|
||||
if ((permission_exists('user_view') || if_group("superadmin")) && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/core/users/")) {
|
||||
$tr_link = "href='".PROJECT_PATH."/core/users/users.php'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-users']."</a></td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['users']['disabled']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['users']['total']."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
|
||||
//destinations
|
||||
if (permission_exists('destination_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/destinations/")) {
|
||||
$tr_link = "href='".PROJECT_PATH."/app/destinations/destinations.php'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-destinations']."</a></td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['destinations']['disabled']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['destinations']['total']."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
|
||||
//call center queues
|
||||
if (permission_exists('call_center_active_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/call_centers/")) {
|
||||
$tr_link = "href='".PROJECT_PATH."/app/call_centers/call_center_queues.php'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-call_center_queues']."</a></td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['call_center_queues']['disabled']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['call_center_queues']['total']."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
|
||||
//ivr menus
|
||||
if (permission_exists('ivr_menu_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/ivr_menus/")) {
|
||||
$tr_link = "href='".PROJECT_PATH."/app/ivr_menus/ivr_menus.php'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-ivr_menus']."</a></td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['ivr_menus']['disabled']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['ivr_menus']['total']."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
|
||||
//ring groups
|
||||
if (permission_exists('ring_group_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/ring_groups/")) {
|
||||
$tr_link = "href='".PROJECT_PATH."/app/ring_groups/ring_groups.php'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-ring_groups']."</a></td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['ring_groups']['disabled']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['ring_groups']['total']."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
|
||||
//voicemails
|
||||
if (permission_exists('voicemail_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/voicemails/")) {
|
||||
$tr_link = "href='".PROJECT_PATH."/app/voicemails/voicemails.php'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-voicemail']."</a></td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['voicemails']['disabled']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['voicemails']['total']."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
|
||||
//messages
|
||||
if (permission_exists('voicemail_message_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/voicemails/")) {
|
||||
echo "<tr>\n";
|
||||
echo "<th class='hud_heading' width='50%'>".$text['label-item']."</th>\n";
|
||||
echo "<th class='hud_heading' width='50%' style='text-align: center; padding-left: 0; padding-right: 0;'>".$text['label-new']."</th>\n";
|
||||
echo "<th class='hud_heading' style='text-align: center;'>".$text['label-total']."</th>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
$tr_link = "href='".PROJECT_PATH."/app/voicemails/voicemails.php'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-messages']."</a></td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['messages']['new']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['messages']['total']."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</div>";
|
||||
$n++;
|
||||
//}
|
||||
echo " <span class='hud_expander' onclick=\"$('#hud_system_counts_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
|
||||
|
||||
?>
|
||||
204
app/system/resources/dashboard/system_status.php
Normal file
204
app/system/resources/dashboard/system_status.php
Normal file
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
|
||||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
|
||||
//check permisions
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('xml_cdr_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get($_SESSION['domain']['language']['code'], 'core/user_settings');
|
||||
|
||||
//system status
|
||||
//if (is_array($selected_blocks) && in_array('system', $selected_blocks)) {
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<span class='hud_title' style='cursor: default;'>".$text['label-system_status']."</span>";
|
||||
|
||||
//disk usage
|
||||
if (PHP_OS == 'FreeBSD' || PHP_OS == 'Linux') {
|
||||
$tmp = shell_exec("df /home 2>&1");
|
||||
$tmp = explode("\n", $tmp);
|
||||
$tmp = preg_replace('!\s+!', ' ', $tmp[1]); // multiple > single space
|
||||
$tmp = explode(' ', $tmp);
|
||||
foreach ($tmp as $stat) {
|
||||
if (substr_count($stat, '%') > 0) { $percent_disk_usage = rtrim($stat,'%'); break; }
|
||||
}
|
||||
|
||||
if ($percent_disk_usage != '') {
|
||||
echo "<span class='hud_stat' onclick=\"$('#hud_system_status_details').slideToggle('fast');\">".$percent_disk_usage."</span>";
|
||||
echo "<span class='hud_stat_title' onclick=\"$('#hud_system_status_details').slideToggle('fast');\" style='cursor: default;'>".$text['label-disk_usage']." (%)</span>\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "<span class='hud_stat' onclick=\"$('#hud_system_status_details').slideToggle('fast');\">".$num_rows."</span>";
|
||||
|
||||
echo "<div class='hud_details hud_box' id='hud_system_status_details'>";
|
||||
echo "<table class='tr_hover' width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<th class='hud_heading' width='50%'>".$text['label-item']."</th>\n";
|
||||
echo "<th class='hud_heading' style='text-align: right;'>".$text['label-value']."</th>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
//pbx version
|
||||
echo "<tr class='tr_link_void'>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'>".(isset($_SESSION['theme']['title']['text'])?$_SESSION['theme']['title']['text']:'FusionPBX')."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".software::version()."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
|
||||
//os uptime
|
||||
if (stristr(PHP_OS, 'Linux')) {
|
||||
unset($tmp);
|
||||
$cut = shell_exec("/usr/bin/which cut");
|
||||
$uptime = trim(shell_exec(escapeshellcmd($cut." -d. -f1 /proc/uptime")));
|
||||
$tmp['y'] = floor($uptime/60/60/24/365);
|
||||
$tmp['d'] = $uptime/60/60/24%365;
|
||||
$tmp['h'] = $uptime/60/60%24;
|
||||
$tmp['m'] = $uptime/60%60;
|
||||
$tmp['s'] = $uptime%60;
|
||||
$uptime = (($tmp['y'] != 0 && $tmp['y'] != '') ? $tmp['y'].'y ' : null);
|
||||
$uptime .= (($tmp['d'] != 0 && $tmp['d'] != '') ? $tmp['d'].'d ' : null);
|
||||
$uptime .= (($tmp['h'] != 0 && $tmp['h'] != '') ? $tmp['h'].'h ' : null);
|
||||
$uptime .= (($tmp['m'] != 0 && $tmp['m'] != '') ? $tmp['m'].'m ' : null);
|
||||
$uptime .= (($tmp['s'] != 0 && $tmp['s'] != '') ? $tmp['s'].'s' : null);
|
||||
if ($uptime != '') {
|
||||
echo "<tr class='tr_link_void'>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-system_uptime']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$uptime."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
//memory usage (for available memory, use "free | awk 'FNR == 3 {print $4/($3+$4)*100}'" instead)
|
||||
if (stristr(PHP_OS, 'Linux')) {
|
||||
$free = shell_exec("/usr/bin/which free");
|
||||
$awk = shell_exec("/usr/bin/which awk");
|
||||
$percent_memory = round(shell_exec(escapeshellcmd($free." | ".$awk." 'FNR == 3 {print $3/($3+$4)*100}'")), 1);
|
||||
if ($percent_memory != '') {
|
||||
echo "<tr class='tr_link_void'>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-memory_usage']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$percent_memory."%</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
//memory available
|
||||
if (stristr(PHP_OS, 'Linux')) {
|
||||
$result = trim(shell_exec('free -hw | grep \'Mem:\' | cut -d\' \' -f 55-64'));
|
||||
if ($result != '') {
|
||||
echo "<tr class='tr_link_void'>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-memory_available']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$result."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
//disk usage
|
||||
if (stristr(PHP_OS, 'Linux')) {
|
||||
//calculated above
|
||||
if ($percent_disk_usage != '') {
|
||||
echo "<tr class='tr_link_void'>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-disk_usage']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$percent_disk_usage."%</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
//cpu usage
|
||||
if (stristr(PHP_OS, 'Linux')) {
|
||||
$result = shell_exec('ps -A -o pcpu');
|
||||
$percent_cpu = 0;
|
||||
foreach (explode("\n", $result) as $value) {
|
||||
if (is_numeric($value)) { $percent_cpu = $percent_cpu + $value; }
|
||||
}
|
||||
$result = trim(shell_exec("grep -P '^processor' /proc/cpuinfo"));
|
||||
$cores = count(explode("\n", $result));
|
||||
if ($percent_cpu > 1) { $percent_cpu = $percent_cpu / $cores; }
|
||||
$percent_cpu = round($percent_cpu, 2);
|
||||
if ($percent_cpu != '') {
|
||||
echo "<tr class='tr_link_void'>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-processor_usage']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$percent_cpu."%</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
//db connections
|
||||
switch ($db_type) {
|
||||
case 'pgsql':
|
||||
$sql = "select count(*) from pg_stat_activity";
|
||||
break;
|
||||
case 'mysql':
|
||||
$sql = "show status where `variable_name` = 'Threads_connected'";
|
||||
break;
|
||||
default:
|
||||
unset($sql);
|
||||
if ($db_path != '' && $dbfilename != '') {
|
||||
$tmp = shell_exec("lsof ".realpath($db_path).'/'.$dbfilename);
|
||||
$tmp = explode("\n", $tmp);
|
||||
$connections = sizeof($tmp) - 1;
|
||||
}
|
||||
}
|
||||
if ($sql != '') {
|
||||
$database = new database;
|
||||
$connections = $database->select($sql, null, 'column');
|
||||
unset($sql);
|
||||
}
|
||||
if ($connections != '') {
|
||||
echo "<tr class='tr_link_void'>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-database_connections']."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$connections."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
|
||||
//channel count
|
||||
if ($fp) {
|
||||
$tmp = event_socket_request($fp, 'api status');
|
||||
$matches = Array();
|
||||
preg_match("/(\d+)\s+session\(s\)\s+\-\speak/", $tmp, $matches);
|
||||
$channels = $matches[1] ? $matches[1] : 0;
|
||||
$tr_link = "href='".PROJECT_PATH."/app/calls_active/calls_active.php'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-channels']."</a></td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$channels."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
|
||||
//registration count
|
||||
if ($fp && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/registrations/")) {
|
||||
$registration = new registrations;
|
||||
$registrations = $registration->count();
|
||||
$tr_link = "href='".PROJECT_PATH."/app/registrations/registrations.php'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-registrations']."</a></td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$registrations."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</div>";
|
||||
$n++;
|
||||
//}
|
||||
echo " <span class='hud_expander' onclick=\"$('#hud_system_status_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
|
||||
|
||||
?>
|
||||
22
app/voicemails/resources/dashboard/config.php
Normal file
22
app/voicemails/resources/dashboard/config.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
$array['dashboard'][$x]['dashboard_uuid'] = 'be2aaa22-d8f1-4d9b-b5f9-14a26da329cb';
|
||||
$array['dashboard'][$x]['dashboard_name'] = 'New Messages';
|
||||
$array['dashboard'][$x]['dashboard_path'] = 'app/voicemails/resources/dashboard/voicemails.php';
|
||||
$array['dashboard'][$x]['dashboard_order'] = '20';
|
||||
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
|
||||
$array['dashboard'][$x]['dashboard_description'] = 'Count the new voicemail messages and list of assigned voicemail boxes.';
|
||||
$y = 0;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '05466c38-88cd-456c-98cd-4cbf323af04f';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'be2aaa22-d8f1-4d9b-b5f9-14a26da329cb';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
|
||||
$y++;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '5320e3a7-255e-49b0-9ff5-172f590dcdf1';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'be2aaa22-d8f1-4d9b-b5f9-14a26da329cb';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
|
||||
$y++;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '9052c80b-802f-4111-baa4-202a41ec7ffc';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'be2aaa22-d8f1-4d9b-b5f9-14a26da329cb';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
|
||||
|
||||
?>
|
||||
94
app/voicemails/resources/dashboard/voicemails.php
Normal file
94
app/voicemails/resources/dashboard/voicemails.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
|
||||
//check permisions
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('voicemail_view') || permission_exists('voicemail_message_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get($_SESSION['domain']['language']['code'], 'core/user_settings');
|
||||
|
||||
//used for missed and recent calls
|
||||
$theme_image_path = $_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/";
|
||||
|
||||
//voicemail
|
||||
//if (is_array($selected_blocks) && in_array('voicemail', $selected_blocks) && permission_exists('voicemail_message_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/voicemails/")) {
|
||||
//required class
|
||||
require_once "app/voicemails/resources/classes/voicemail.php";
|
||||
//get the voicemail
|
||||
$vm = new voicemail;
|
||||
$vm->db = $db;
|
||||
$vm->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$vm->order_by = $order_by;
|
||||
$vm->order = $order;
|
||||
$voicemails = $vm->messages();
|
||||
//sum total and new
|
||||
$messages['total'] = 0;
|
||||
$messages['new'] = 0;
|
||||
if (sizeof($voicemails) > 0) {
|
||||
foreach($voicemails as $field) {
|
||||
$messages[$field['voicemail_uuid']]['ext'] = $field['voicemail_id'];
|
||||
$messages[$field['voicemail_uuid']]['total'] = 0;
|
||||
$messages[$field['voicemail_uuid']]['new'] = 0;
|
||||
foreach($field['messages'] as &$row) {
|
||||
if ($row['message_status'] == '') {
|
||||
$messages[$field['voicemail_uuid']]['new']++;
|
||||
$messages['new']++;
|
||||
}
|
||||
$messages[$field['voicemail_uuid']]['total']++;
|
||||
$messages['total']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "<span class='hud_title' onclick=\"document.location.href='".PROJECT_PATH."/app/voicemails/voicemail_messages.php';\">".$text['label-voicemail']."</span>";
|
||||
|
||||
echo "<span class='hud_stat' onclick=\"$('#hud_voicemail_details').slideToggle('fast');\">".$messages['new']."</span>";
|
||||
echo "<span class='hud_stat_title' onclick=\"$('#hud_voicemail_details').slideToggle('fast');\">".$text['label-new_messages']."</span>\n";
|
||||
|
||||
echo "<div class='hud_details hud_box' id='hud_voicemail_details'>";
|
||||
if (sizeof($voicemails) > 0) {
|
||||
echo "<table class='tr_hover' cellpadding='2' cellspacing='0' border='0' width='100%'>";
|
||||
echo "<tr>";
|
||||
echo " <th class='hud_heading' width='50%'>".$text['label-voicemail']."</th>";
|
||||
echo " <th class='hud_heading' style='text-align: center;' width='50%'>".$text['label-new']."</th>";
|
||||
echo " <th class='hud_heading' style='text-align: center;'>".$text['label-total']."</th>";
|
||||
echo "</tr>";
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
foreach ($messages as $voicemail_uuid => $row) {
|
||||
if (is_uuid($voicemail_uuid)) {
|
||||
$tr_link = "href='".PROJECT_PATH."/app/voicemails/voicemail_messages.php?id=".(permission_exists('voicemail_view') ? $voicemail_uuid : $row['ext'])."'";
|
||||
echo "<tr ".$tr_link." style='cursor: pointer;'>";
|
||||
echo " <td class='".$row_style[$c]." hud_text'><a href='".PROJECT_PATH."/app/voicemails/voicemail_messages.php?id=".(permission_exists('voicemail_view') ? $voicemail_uuid : $row['ext'])."'>".$row['ext']."</a></td>";
|
||||
echo " <td class='".$row_style[$c]." hud_text' style='text-align: center;'>".$row['new']."</td>";
|
||||
echo " <td class='".$row_style[$c]." hud_text' style='text-align: center;'>".$row['total']."</td>";
|
||||
echo "</tr>";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
}
|
||||
else {
|
||||
echo "<br />".$text['label-no_voicemail_assigned'];
|
||||
}
|
||||
echo "</div>";
|
||||
$n++;
|
||||
//}
|
||||
echo " <span class='hud_expander' onclick=\"$('#hud_voicemail_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
|
||||
|
||||
?>
|
||||
43
app/xml_cdr/resources/dashboard/config.php
Normal file
43
app/xml_cdr/resources/dashboard/config.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
$array['dashboard'][$x]['dashboard_uuid'] = '6ad0e056-bf3d-465a-956d-bd77d513ab36';
|
||||
$array['dashboard'][$x]['dashboard_name'] = 'Missed Calls';
|
||||
$array['dashboard'][$x]['dashboard_path'] = 'app/xml_cdr/resources/dashboard/missed_calls.php';
|
||||
$array['dashboard'][$x]['dashboard_order'] = '40';
|
||||
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
|
||||
$array['dashboard'][$x]['dashboard_description'] = 'Show number and list of calls that were missed.';
|
||||
$y = 0;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '85573555-7e18-4449-aa59-a264a7addda9';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '6ad0e056-bf3d-465a-956d-bd77d513ab36';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
|
||||
$y++;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'cde35063-58ca-4cdd-94fa-a1c4ee03e66c';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '6ad0e056-bf3d-465a-956d-bd77d513ab36';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
|
||||
$y++;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'b6e6c697-5351-484c-808d-884589c6d527';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '6ad0e056-bf3d-465a-956d-bd77d513ab36';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
|
||||
|
||||
|
||||
$x++;
|
||||
$array['dashboard'][$x]['dashboard_uuid'] = 'c323e296-b1cf-42ea-9c57-fc00697915b7';
|
||||
$array['dashboard'][$x]['dashboard_name'] = 'Recent Calls';
|
||||
$array['dashboard'][$x]['dashboard_path'] = 'app/xml_cdr/resources/dashboard/recent_calls.php';
|
||||
$array['dashboard'][$x]['dashboard_order'] = '60';
|
||||
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
|
||||
$array['dashboard'][$x]['dashboard_description'] = 'List of recent calls.';
|
||||
$y = 0;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '976018d2-ed21-4ccd-a95c-ef7e36c1134e';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'c323e296-b1cf-42ea-9c57-fc00697915b7';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
|
||||
$y++;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '62e53c42-aa15-4a4a-abf0-fb8cd37bafad';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'c323e296-b1cf-42ea-9c57-fc00697915b7';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
|
||||
$y++;
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'a923b923-f1c9-4244-abfd-132c5a2f5b6e';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'c323e296-b1cf-42ea-9c57-fc00697915b7';
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
|
||||
|
||||
?>
|
||||
144
app/xml_cdr/resources/dashboard/missed_calls.php
Normal file
144
app/xml_cdr/resources/dashboard/missed_calls.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
|
||||
//check permisions
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('xml_cdr_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get($_SESSION['domain']['language']['code'], 'core/user_settings');
|
||||
|
||||
//missed calls
|
||||
//if (is_array($selected_blocks) && in_array('missed', $selected_blocks) && permission_exists('xml_cdr_view') && is_array($_SESSION['user']['extension']) && sizeof($_SESSION['user']['extension']) > 0) {
|
||||
foreach ($_SESSION['user']['extension'] as $assigned_extension) {
|
||||
$assigned_extensions[$assigned_extension['extension_uuid']] = $assigned_extension['user'];
|
||||
}
|
||||
unset($assigned_extension);
|
||||
|
||||
//if also viewing system status, show more recent calls (more room avaialble)
|
||||
$missed_limit = (is_array($selected_blocks) && in_array('counts', $selected_blocks)) ? 10 : 5;
|
||||
|
||||
$sql = "select \n";
|
||||
$sql .= " direction, \n";
|
||||
$sql .= " start_stamp, \n";
|
||||
$sql .= " start_epoch, \n";
|
||||
$sql .= " caller_id_name, \n";
|
||||
$sql .= " caller_id_number, \n";
|
||||
$sql .= " answer_stamp \n";
|
||||
$sql .= "from \n";
|
||||
$sql .= " v_xml_cdr \n";
|
||||
$sql .= "where \n";
|
||||
$sql .= " domain_uuid = :domain_uuid \n";
|
||||
$sql .= " and ( \n";
|
||||
$sql .= " direction = 'inbound' \n";
|
||||
$sql .= " or direction = 'local' \n";
|
||||
$sql .= " ) \n";
|
||||
$sql .= " and (missed_call = true or bridge_uuid is null) ";
|
||||
if (is_array($assigned_extensions) && sizeof($assigned_extensions) != 0) {
|
||||
$x = 0;
|
||||
foreach ($assigned_extensions as $assigned_extension_uuid => $assigned_extension) {
|
||||
$sql_where_array[] = "extension_uuid = :assigned_extension_uuid_".$x;
|
||||
$sql_where_array[] = "destination_number = :destination_number_".$x;
|
||||
$parameters['assigned_extension_uuid_'.$x] = $assigned_extension_uuid;
|
||||
$parameters['destination_number_'.$x] = $assigned_extension;
|
||||
$x++;
|
||||
}
|
||||
if (is_array($sql_where_array) && sizeof($sql_where_array) != 0) {
|
||||
$sql .= "and (".implode(' or ', $sql_where_array).") \n";
|
||||
}
|
||||
unset($sql_where_array);
|
||||
}
|
||||
$sql .= "and start_epoch > ".(time() - 86400)." \n";
|
||||
$sql .= "order by \n";
|
||||
$sql .= "start_epoch desc \n";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
//echo $sql;
|
||||
//view_array($parameters);
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
|
||||
$num_rows = is_array($result) ? sizeof($result) : 0;
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<span class='hud_title' onclick=\"document.location.href='".PROJECT_PATH."/app/xml_cdr/xml_cdr.php?call_result=missed'\">".$text['label-missed_calls']."</span>";
|
||||
|
||||
echo "<span class='hud_stat' onclick=\"$('#hud_missed_calls_details').slideToggle('fast');\">".$num_rows."</span>";
|
||||
echo "<span class='hud_stat_title' onclick=\"$('#hud_missed_calls_details').slideToggle('fast');\">".$text['label-last_24_hours']."</span>\n";
|
||||
|
||||
echo "<div class='hud_details hud_box' id='hud_missed_calls_details'>";
|
||||
echo "<table class='tr_hover' width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($num_rows > 0) {
|
||||
echo "<th class='hud_heading'> </th>\n";
|
||||
}
|
||||
echo "<th class='hud_heading' width='100%'>".$text['label-cid_number']."</th>\n";
|
||||
echo "<th class='hud_heading'>".$text['label-missed']."</th>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($num_rows > 0) {
|
||||
$theme_cdr_images_exist = (
|
||||
file_exists($theme_image_path."icon_cdr_inbound_voicemail.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_inbound_cancelled.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_local_voicemail.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_local_cancelled.png")
|
||||
) ? true : false;
|
||||
|
||||
foreach($result as $index => $row) {
|
||||
if ($index + 1 > $missed_limit) { break; } //only show limit
|
||||
$tmp_year = date("Y", strtotime($row['start_stamp']));
|
||||
$tmp_month = date("M", strtotime($row['start_stamp']));
|
||||
$tmp_day = date("d", strtotime($row['start_stamp']));
|
||||
$tmp_start_epoch = ($_SESSION['domain']['time_format']['text'] == '12h') ? date("n/j g:ia", $row['start_epoch']) : date("n/j H:i", $row['start_epoch']);
|
||||
//set click-to-call variables
|
||||
if (permission_exists('click_to_call_call')) {
|
||||
$tr_link = "onclick=\"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php".
|
||||
"?src_cid_name=".urlencode($row['caller_id_name']).
|
||||
"&src_cid_number=".urlencode($row['caller_id_number']).
|
||||
"&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name']).
|
||||
"&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number']).
|
||||
"&src=".urlencode($_SESSION['user']['extension'][0]['user']).
|
||||
"&dest=".urlencode($row['caller_id_number']).
|
||||
"&rec=".(isset($_SESSION['click_to_call']['record']['boolean'])?$_SESSION['click_to_call']['record']['boolean']:"false").
|
||||
"&ringback=".(isset($_SESSION['click_to_call']['ringback']['text'])?$_SESSION['click_to_call']['ringback']['text']:"us-ring").
|
||||
"&auto_answer=".(isset($_SESSION['click_to_call']['auto_answer']['boolean'])?$_SESSION['click_to_call']['auto_answer']['boolean']:"true").
|
||||
"');\" ".
|
||||
"style='cursor: pointer;'";
|
||||
}
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo "<td valign='middle' class='".$row_style[$c]."' style='cursor: help; padding: 0 0 0 6px;'>\n";
|
||||
if ($theme_cdr_images_exist) {
|
||||
$call_result = ($row['answer_stamp'] != '') ? 'voicemail' : 'cancelled';
|
||||
if (isset($row['direction'])) {
|
||||
echo " <img src='".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_".$row['direction']."_".$call_result.".png' width='16' style='border: none;' title='".$text['label-'.$row['direction']].": ".$text['label-'.$call_result]."'>\n";
|
||||
}
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' nowrap='nowrap'><a href='javascript:void(0);' ".(($row['caller_id_name'] != '') ? "title=\"".$row['caller_id_name']."\"" : null).">".((is_numeric($row['caller_id_number'])) ? format_phone($row['caller_id_number']) : $row['caller_id_number'])."</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' nowrap='nowrap'>".$tmp_start_epoch."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $result, $num_rows, $index, $row);
|
||||
|
||||
echo "</table>\n";
|
||||
echo "<span style='display: block; margin: 6px 0 7px 0;'><a href='".PROJECT_PATH."/app/xml_cdr/xml_cdr.php?call_result=missed'>".$text['label-view_all']."</a></span>\n";
|
||||
echo "</div>";
|
||||
$n++;
|
||||
//}
|
||||
echo " <span class='hud_expander' onclick=\"$('#hud_missed_calls_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
|
||||
|
||||
?>
|
||||
176
app/xml_cdr/resources/dashboard/recent_calls.php
Normal file
176
app/xml_cdr/resources/dashboard/recent_calls.php
Normal file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
|
||||
//check permisions
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('xml_cdr_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get($_SESSION['domain']['language']['code'], 'core/user_settings');
|
||||
|
||||
//recent calls
|
||||
//if (is_array($selected_blocks) && in_array('recent', $selected_blocks) && permission_exists('xml_cdr_view') && is_array($_SESSION['user']['extension']) && sizeof($_SESSION['user']['extension']) > 0) {
|
||||
foreach ($_SESSION['user']['extension'] as $assigned_extension) {
|
||||
$assigned_extensions[$assigned_extension['extension_uuid']] = $assigned_extension['user'];
|
||||
}
|
||||
|
||||
//if also viewing system status, show more recent calls (more room avaialble)
|
||||
$recent_limit = (is_array($selected_blocks) && in_array('counts', $selected_blocks)) ? 10 : 5;
|
||||
|
||||
$sql = "
|
||||
select
|
||||
direction,
|
||||
start_stamp,
|
||||
start_epoch,
|
||||
caller_id_name,
|
||||
caller_id_number,
|
||||
destination_number,
|
||||
answer_stamp,
|
||||
bridge_uuid,
|
||||
sip_hangup_disposition
|
||||
from
|
||||
v_xml_cdr
|
||||
where
|
||||
domain_uuid = :domain_uuid ";
|
||||
if (is_array($assigned_extensions) && sizeof($assigned_extensions) != 0) {
|
||||
$x = 0;
|
||||
foreach ($assigned_extensions as $assigned_extension_uuid => $assigned_extension) {
|
||||
$sql_where_array[] = "extension_uuid = :extension_uuid_".$x;
|
||||
$sql_where_array[] = "caller_id_number = :caller_id_number_".$x;
|
||||
$sql_where_array[] = "destination_number = :destination_number_1_".$x;
|
||||
$sql_where_array[] = "destination_number = :destination_number_2_".$x;
|
||||
$parameters['extension_uuid_'.$x] = $assigned_extension_uuid;
|
||||
$parameters['caller_id_number_'.$x] = $assigned_extension;
|
||||
$parameters['destination_number_1_'.$x] = $assigned_extension;
|
||||
$parameters['destination_number_2_'.$x] = '*99'.$assigned_extension;
|
||||
$x++;
|
||||
}
|
||||
if (is_array($sql_where_array) && sizeof($sql_where_array) != 0) {
|
||||
$sql .= "and (".implode(' or ', $sql_where_array).") ";
|
||||
}
|
||||
unset($sql_where_array);
|
||||
}
|
||||
$sql .= "
|
||||
and start_epoch > ".(time() - 86400)."
|
||||
order by
|
||||
start_epoch desc";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
$num_rows = is_array($result) ? sizeof($result) : 0;
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<span class='hud_title' onclick=\"document.location.href='".PROJECT_PATH."/app/xml_cdr/xml_cdr.php';\">".$text['label-recent_calls']."</span>";
|
||||
|
||||
echo "<span class='hud_stat' onclick=\"$('#hud_recent_calls_details').slideToggle('fast');\">".$num_rows."</span>";
|
||||
echo "<span class='hud_stat_title' onclick=\"$('#hud_recent_calls_details').slideToggle('fast');\">".$text['label-last_24_hours']."</span>\n";
|
||||
|
||||
echo "<div class='hud_details hud_box' id='hud_recent_calls_details'>";
|
||||
echo "<table class='tr_hover' width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($num_rows > 0) {
|
||||
echo "<th class='hud_heading'> </th>\n";
|
||||
}
|
||||
echo "<th class='hud_heading' width='100%'>".$text['label-cid_number']."</th>\n";
|
||||
echo "<th class='hud_heading'>".$text['label-date_time']."</th>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($num_rows > 0) {
|
||||
$theme_cdr_images_exist = (
|
||||
file_exists($theme_image_path."icon_cdr_inbound_answered.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_inbound_voicemail.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_inbound_cancelled.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_inbound_failed.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_outbound_answered.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_outbound_cancelled.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_outbound_failed.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_local_answered.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_local_voicemail.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_local_cancelled.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_local_failed.png")
|
||||
) ? true : false;
|
||||
|
||||
foreach($result as $index => $row) {
|
||||
if ($index + 1 > $recent_limit) { break; } //only show limit
|
||||
$tmp_year = date("Y", strtotime($row['start_stamp']));
|
||||
$tmp_month = date("M", strtotime($row['start_stamp']));
|
||||
$tmp_day = date("d", strtotime($row['start_stamp']));
|
||||
$tmp_start_epoch = ($_SESSION['domain']['time_format']['text'] == '12h') ? date("n/j g:ia", $row['start_epoch']) : date("n/j H:i", $row['start_epoch']);
|
||||
|
||||
//determine name
|
||||
$cdr_name = ($row['direction'] == 'inbound' || ($row['direction'] == 'local' && is_array($assigned_extensions) && in_array($row['destination_number'], $assigned_extensions))) ? $row['caller_id_name'] : $row['destination_number'];
|
||||
//determine number to display
|
||||
if ($row['direction'] == 'inbound' || ($row['direction'] == 'local' && is_array($assigned_extensions) && in_array($row['destination_number'], $assigned_extensions))) {
|
||||
$cdr_number = (is_numeric($row['caller_id_number'])) ? format_phone($row['caller_id_number']) : $row['caller_id_number'];
|
||||
$dest = $row['caller_id_number'];
|
||||
}
|
||||
else if ($row['direction'] == 'outbound' || ($row['direction'] == 'local' && is_array($assigned_extensions) && in_array($row['caller_id_number'], $assigned_extensions))) {
|
||||
$cdr_number = (is_numeric($row['destination_number'])) ? format_phone($row['destination_number']) : $row['destination_number'];
|
||||
$dest = $row['destination_number'];
|
||||
}
|
||||
//set click-to-call variables
|
||||
if (permission_exists('click_to_call_call')) {
|
||||
$tr_link = "onclick=\"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php".
|
||||
"?src_cid_name=".urlencode($cdr_name).
|
||||
"&src_cid_number=".urlencode($cdr_number).
|
||||
"&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name']).
|
||||
"&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number']).
|
||||
"&src=".urlencode($_SESSION['user']['extension'][0]['user']).
|
||||
"&dest=".urlencode($dest).
|
||||
"&rec=".(isset($_SESSION['click_to_call']['record']['boolean'])?$_SESSION['click_to_call']['record']['boolean']:"false").
|
||||
"&ringback=".(isset($_SESSION['click_to_call']['ringback']['text'])?$_SESSION['click_to_call']['ringback']['text']:"us-ring").
|
||||
"&auto_answer=".(isset($_SESSION['click_to_call']['auto_answer']['boolean'])?$_SESSION['click_to_call']['auto_answer']['boolean']:"true").
|
||||
"');\" ".
|
||||
"style='cursor: pointer;'";
|
||||
}
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
//determine call result and appropriate icon
|
||||
echo "<td valign='middle' class='".$row_style[$c]."' style='cursor: help; padding: 0 0 0 6px;'>\n";
|
||||
if ($theme_cdr_images_exist) {
|
||||
if ($row['direction'] == 'inbound' || $row['direction'] == 'local') {
|
||||
if ($row['answer_stamp'] != '' && $row['bridge_uuid'] != '') { $call_result = 'answered'; }
|
||||
else if ($row['answer_stamp'] != '' && $row['bridge_uuid'] == '') { $call_result = 'voicemail'; }
|
||||
else if ($row['answer_stamp'] == '' && $row['bridge_uuid'] == '' && $row['sip_hangup_disposition'] != 'send_refuse') { $call_result = 'cancelled'; }
|
||||
else { $call_result = 'failed'; }
|
||||
}
|
||||
else if ($row['direction'] == 'outbound') {
|
||||
if ($row['answer_stamp'] != '' && $row['bridge_uuid'] != '') { $call_result = 'answered'; }
|
||||
else if ($row['answer_stamp'] == '' && $row['bridge_uuid'] != '') { $call_result = 'cancelled'; }
|
||||
else { $call_result = 'failed'; }
|
||||
}
|
||||
if (isset($row['direction'])) {
|
||||
echo "<img src='".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_".$row['direction']."_".$call_result.".png' width='16' style='border: none;' title='".$text['label-'.$row['direction']].": ".$text['label-'.$call_result]."'>\n";
|
||||
}
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' nowrap='nowrap'><a href='javascript:void(0);' ".(($cdr_name != '') ? "title=\"".$cdr_name."\"" : null).">".$cdr_number."</a></td>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text' nowrap='nowrap'>".$tmp_start_epoch."</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
unset($cdr_name, $cdr_number);
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $result, $num_rows, $index, $row);
|
||||
|
||||
echo "</table>\n";
|
||||
echo "<span style='display: block; margin: 6px 0 7px 0;'><a href='".PROJECT_PATH."/app/xml_cdr/xml_cdr.php'>".$text['label-view_all']."</a></span>\n";
|
||||
echo "</div>";
|
||||
$n++;
|
||||
//}
|
||||
echo " <span class='hud_expander' onclick=\"$('#hud_recent_calls_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
|
||||
|
||||
?>
|
||||
90
app/xml_cdr/resources/dashboard/root.php
Normal file
90
app/xml_cdr/resources/dashboard/root.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
umask(2);
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if (strpos($_ENV["OS"], "Win") !== false) {
|
||||
define("PATH_SEPARATOR", ";");
|
||||
} else {
|
||||
define("PATH_SEPARATOR", ":");
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
|
||||
if(PHP_SAPI == 'cli'){
|
||||
chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
|
||||
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
|
||||
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
|
||||
if (file_exists('/project_root.php')) {
|
||||
$path = '/';
|
||||
} else {
|
||||
$i = 1;
|
||||
$path = '';
|
||||
while ($i < count($dirs)) {
|
||||
$path .= '/' . $dirs[$i];
|
||||
if (file_exists($path. '/project_root.php')) {
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$_SERVER["DOCUMENT_ROOT"] = $path;
|
||||
}else{
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
}
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
// try to detect if a project path is being used
|
||||
if (!defined('PROJECT_PATH')) {
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
|
||||
define('PROJECT_PATH', '/fusionpbx');
|
||||
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
|
||||
define('PROJECT_PATH', '');
|
||||
} else {
|
||||
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
|
||||
$i = 1;
|
||||
$path = $_SERVER["DOCUMENT_ROOT"];
|
||||
while ($i < count($dirs)) {
|
||||
$path .= '/' . $dirs[$i];
|
||||
if (file_exists($path. '/project_root.php')) {
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if(!file_exists($path. '/project_root.php')){
|
||||
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
|
||||
}
|
||||
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
|
||||
define('PROJECT_PATH', $project_path);
|
||||
}
|
||||
$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
|
||||
}
|
||||
|
||||
?>
|
||||
118
core/dashboard/app_config.php
Normal file
118
core/dashboard/app_config.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
//application details
|
||||
$apps[$x]['name'] = 'Dashboard';
|
||||
$apps[$x]['uuid'] = '55533bef-4f04-434a-92af-999c1e9927f7';
|
||||
$apps[$x]['category'] = 'system';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '1.0';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en-us'] = '';
|
||||
|
||||
//permission details
|
||||
$y = 0;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'dashboard_view';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'dashboard_add';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'dashboard_edit';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'dashboard_delete';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'dashboard_all';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'dashboard_group_view';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'dashboard_group_add';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'dashboard_group_edit';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'dashboard_group_delete';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'dashboard_group_all';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
|
||||
//dashboard
|
||||
$y = 0;
|
||||
$apps[$x]['db'][$y]['table']['name'] = 'v_dashboard';
|
||||
$apps[$x]['db'][$y]['table']['parent'] = '';
|
||||
$z = 0;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the dashboard name.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_path';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the dashboard path.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_order';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the dashboard order.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_enabled';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'boolean';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['toggle'] = ['true','false'];
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the dashboard enabled.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the dashboard description.';
|
||||
$z++;
|
||||
|
||||
//dashboard groups
|
||||
$y = 5;
|
||||
$apps[$x]['db'][$y]['table']['name'] = 'v_dashboard_groups';
|
||||
$apps[$x]['db'][$y]['table']['parent'] = 'v_dashboard';
|
||||
$z = 0;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_group_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_dashboard';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'dashboard_uuid';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = 'no';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the group uuid.';
|
||||
$z++;
|
||||
|
||||
?>
|
||||
64
core/dashboard/app_defaults.php
Normal file
64
core/dashboard/app_defaults.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
if ($domains_processed == 1) {
|
||||
|
||||
//clear the array if it exists
|
||||
if (isset($array)) {
|
||||
unset($array);
|
||||
}
|
||||
|
||||
//get the groups
|
||||
$sql = "select * from v_groups ";
|
||||
$sql .= "where domain_uuid is null ";
|
||||
$database = new database;
|
||||
$groups = $database->select($sql, $parameters, 'all');
|
||||
|
||||
//add the dashboard widgets
|
||||
$config_files = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/*/*/resources/dashboard/config.php');
|
||||
$x = 0;
|
||||
foreach($config_files as $file) {
|
||||
include ($file);
|
||||
$x++;
|
||||
}
|
||||
$widgets = $array;
|
||||
unset($array);
|
||||
|
||||
//build the array
|
||||
$x = 0;
|
||||
foreach($widgets['dashboard'] as $row) {
|
||||
$array['dashboard'][$x]['dashboard_uuid'] = $row['dashboard_uuid'];
|
||||
$array['dashboard'][$x]['dashboard_name'] = $row['dashboard_name'];
|
||||
$array['dashboard'][$x]['dashboard_path'] = $row['dashboard_path'];
|
||||
$array['dashboard'][$x]['dashboard_order'] = $row['dashboard_order'];
|
||||
$array['dashboard'][$x]['dashboard_enabled'] = $row['dashboard_enabled'];
|
||||
$array['dashboard'][$x]['dashboard_description'] = $row['dashboard_description'];
|
||||
$y = 0;
|
||||
if (is_array($row['dashboard_groups'])) {
|
||||
foreach ($row['dashboard_groups'] as $row) {
|
||||
if (isset($row['group_name'])) {
|
||||
foreach($groups as $field) {
|
||||
if ($row['group_name'] == $field['group_name']) {
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = $row['dashboard_group_uuid'];
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = $row['dashboard_uuid'];
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_uuid'] = $field['group_uuid'];
|
||||
}
|
||||
}
|
||||
$y++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
|
||||
//save the data
|
||||
$database = new database;
|
||||
$database->app_name = 'dashboard';
|
||||
$database->app_uuid = '55533bef-4f04-434a-92af-999c1e9927f7';
|
||||
$database->save($array);
|
||||
//$result = $database->message;
|
||||
//view_array($result);
|
||||
//exit;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
349
core/dashboard/app_languages.php
Normal file
349
core/dashboard/app_languages.php
Normal file
@@ -0,0 +1,349 @@
|
||||
<?php
|
||||
|
||||
//Dashboard
|
||||
$text['title-dashboard']['en-us'] = "Dashboard";
|
||||
$text['title-dashboard']['en-gb'] = "Dashboard";
|
||||
$text['title-dashboard']['ar-eg'] = "الصفحه الرئيسيه للمستخدم";
|
||||
$text['title-dashboard']['de-at'] = "Benutzerübersicht"; //copied from de-de
|
||||
$text['title-dashboard']['de-ch'] = "Benutzerübersicht"; //copied from de-de
|
||||
$text['title-dashboard']['de-de'] = "Benutzerübersicht";
|
||||
$text['title-dashboard']['el-gr'] = "Πίνακας ελέγχου";
|
||||
$text['title-dashboard']['es-cl'] = "Dashboard Usuario";
|
||||
$text['title-dashboard']['es-mx'] = "Dashboard Usuario"; //copied from es-cl
|
||||
$text['title-dashboard']['fr-ca'] = "Tableau de bord de l'utilisateur"; //copied from fr-fr
|
||||
$text['title-dashboard']['fr-fr'] = "Tableau de bord de l'utilisateur";
|
||||
$text['title-dashboard']['he-il'] = "ממשק משתמש";
|
||||
$text['title-dashboard']['it-it'] = "Pannello di Controllo";
|
||||
$text['title-dashboard']['nl-nl'] = "";
|
||||
$text['title-dashboard']['pl-pl'] = "Panel użytkowników";
|
||||
$text['title-dashboard']['pt-br'] = "Painel de Controle";
|
||||
$text['title-dashboard']['pt-pt'] = "Painel de Controle do Usuário";
|
||||
$text['title-dashboard']['ro-ro'] = "Panou control utilizator";
|
||||
$text['title-dashboard']['ru-ru'] = "Панель пользователя";
|
||||
$text['title-dashboard']['sv-se'] = "Användarpanel";
|
||||
$text['title-dashboard']['uk-ua'] = "Панель користувача";
|
||||
|
||||
$text['description-dashboard']['en-us'] = "Quickly access information and tools related to your account.";
|
||||
$text['description-dashboard']['en-gb'] = "Quickly access information and tools related to your account.";
|
||||
$text['description-dashboard']['ar-eg'] = "دخول سريع للمعلومات و الادوات الخاصة بحسابك";
|
||||
$text['description-dashboard']['de-at'] = "Schneller Zugriff auf Kontoinformationen und -funktionen"; //copied from de-de
|
||||
$text['description-dashboard']['de-ch'] = "Schneller Zugriff auf Kontoinformationen und -funktionen"; //copied from de-de
|
||||
$text['description-dashboard']['de-de'] = "Schneller Zugriff auf Kontoinformationen und -funktionen";
|
||||
$text['description-dashboard']['el-gr'] = "Γρήγορη πρόσβαση σε πληροφορίρς και εργαλεία σχετικά με το λογαριασμό σας.";
|
||||
$text['description-dashboard']['es-cl'] = "Acceso rápido a la información y herramientas relacionadas con su cuenta.";
|
||||
$text['description-dashboard']['es-mx'] = "Acceso rápido a la información y herramientas relacionadas con su cuenta."; //copied from es-cl
|
||||
$text['description-dashboard']['fr-ca'] = "Accéder rapidement aux informations et outils liés à votre compte."; //copied from fr-fr
|
||||
$text['description-dashboard']['fr-fr'] = "Accéder rapidement aux informations et outils liés à votre compte.";
|
||||
$text['description-dashboard']['he-il'] = "מידע מהיר וגישה לכלים הקשורים לחשבון שלך ";
|
||||
$text['description-dashboard']['it-it'] = "Accedi velocemente alle informazioni e agli strumenti relativi al tuo account.";
|
||||
$text['description-dashboard']['nl-nl'] = "";
|
||||
$text['description-dashboard']['pl-pl'] = "Szybki dostęp do informacji i narzędzi związanych z twoim kontem";
|
||||
$text['description-dashboard']['pt-br'] = "Acesse rapidamente informações e ferramentas relacionadas à sua conta.";
|
||||
$text['description-dashboard']['pt-pt'] = "Acessar rapidamente as informações e ferramentas relacionadas à sua conta.";
|
||||
$text['description-dashboard']['ro-ro'] = "Acces rapid la informații și utilitare pentru contul Dvs.";
|
||||
$text['description-dashboard']['ru-ru'] = "Быстрый доступ к информации и инструментам, связанным с вашей учетной записью.";
|
||||
$text['description-dashboard']['sv-se'] = "Snabb tillgång till kontoinformation och funktioner.";
|
||||
$text['description-dashboard']['uk-ua'] = "Швидкий доступ до інформації та інструментів вашого облікового запису.";
|
||||
|
||||
$text['label-group_uuid']['en-us'] = 'Group UUID';
|
||||
$text['label-group_uuid']['ar-eg'] = '';
|
||||
$text['label-group_uuid']['de-at'] = '';
|
||||
$text['label-group_uuid']['de-ch'] = '';
|
||||
$text['label-group_uuid']['de-de'] = '';
|
||||
$text['label-group_uuid']['es-cl'] = '';
|
||||
$text['label-group_uuid']['es-mx'] = '';
|
||||
$text['label-group_uuid']['fr-ca'] = '';
|
||||
$text['label-group_uuid']['fr-fr'] = '';
|
||||
$text['label-group_uuid']['he-il'] = '';
|
||||
$text['label-group_uuid']['it-it'] = '';
|
||||
$text['label-group_uuid']['nl-nl'] = '';
|
||||
$text['label-group_uuid']['pl-pl'] = '';
|
||||
$text['label-group_uuid']['pt-br'] = '';
|
||||
$text['label-group_uuid']['pt-pt'] = '';
|
||||
$text['label-group_uuid']['ro-ro'] = '';
|
||||
$text['label-group_uuid']['ru-ru'] = '';
|
||||
$text['label-group_uuid']['sv-se'] = '';
|
||||
$text['label-group_uuid']['uk-ua'] = '';
|
||||
|
||||
$text['description-group_uuid']['en-us'] = 'Enter the group uuid.';
|
||||
$text['description-group_uuid']['ar-eg'] = '';
|
||||
$text['description-group_uuid']['de-at'] = '';
|
||||
$text['description-group_uuid']['de-ch'] = '';
|
||||
$text['description-group_uuid']['de-de'] = '';
|
||||
$text['description-group_uuid']['es-cl'] = '';
|
||||
$text['description-group_uuid']['es-mx'] = '';
|
||||
$text['description-group_uuid']['fr-ca'] = '';
|
||||
$text['description-group_uuid']['fr-fr'] = '';
|
||||
$text['description-group_uuid']['he-il'] = '';
|
||||
$text['description-group_uuid']['it-it'] = '';
|
||||
$text['description-group_uuid']['nl-nl'] = '';
|
||||
$text['description-group_uuid']['pl-pl'] = '';
|
||||
$text['description-group_uuid']['pt-br'] = '';
|
||||
$text['description-group_uuid']['pt-pt'] = '';
|
||||
$text['description-group_uuid']['ro-ro'] = '';
|
||||
$text['description-group_uuid']['ru-ru'] = '';
|
||||
$text['description-group_uuid']['sv-se'] = '';
|
||||
$text['description-group_uuid']['uk-ua'] = '';
|
||||
|
||||
$text['label-dashboard_name']['en-us'] = 'Name';
|
||||
$text['label-dashboard_name']['ar-eg'] = '';
|
||||
$text['label-dashboard_name']['de-at'] = '';
|
||||
$text['label-dashboard_name']['de-ch'] = '';
|
||||
$text['label-dashboard_name']['de-de'] = '';
|
||||
$text['label-dashboard_name']['es-cl'] = '';
|
||||
$text['label-dashboard_name']['es-mx'] = '';
|
||||
$text['label-dashboard_name']['fr-ca'] = '';
|
||||
$text['label-dashboard_name']['fr-fr'] = '';
|
||||
$text['label-dashboard_name']['he-il'] = '';
|
||||
$text['label-dashboard_name']['it-it'] = '';
|
||||
$text['label-dashboard_name']['nl-nl'] = '';
|
||||
$text['label-dashboard_name']['pl-pl'] = '';
|
||||
$text['label-dashboard_name']['pt-br'] = '';
|
||||
$text['label-dashboard_name']['pt-pt'] = '';
|
||||
$text['label-dashboard_name']['ro-ro'] = '';
|
||||
$text['label-dashboard_name']['ru-ru'] = '';
|
||||
$text['label-dashboard_name']['sv-se'] = '';
|
||||
$text['label-dashboard_name']['uk-ua'] = '';
|
||||
|
||||
$text['description-dashboard_name']['en-us'] = 'Enter the dashboard widget name.';
|
||||
$text['description-dashboard_name']['ar-eg'] = '';
|
||||
$text['description-dashboard_name']['de-at'] = '';
|
||||
$text['description-dashboard_name']['de-ch'] = '';
|
||||
$text['description-dashboard_name']['de-de'] = '';
|
||||
$text['description-dashboard_name']['es-cl'] = '';
|
||||
$text['description-dashboard_name']['es-mx'] = '';
|
||||
$text['description-dashboard_name']['fr-ca'] = '';
|
||||
$text['description-dashboard_name']['fr-fr'] = '';
|
||||
$text['description-dashboard_name']['he-il'] = '';
|
||||
$text['description-dashboard_name']['it-it'] = '';
|
||||
$text['description-dashboard_name']['nl-nl'] = '';
|
||||
$text['description-dashboard_name']['pl-pl'] = '';
|
||||
$text['description-dashboard_name']['pt-br'] = '';
|
||||
$text['description-dashboard_name']['pt-pt'] = '';
|
||||
$text['description-dashboard_name']['ro-ro'] = '';
|
||||
$text['description-dashboard_name']['ru-ru'] = '';
|
||||
$text['description-dashboard_name']['sv-se'] = '';
|
||||
$text['description-dashboard_name']['uk-ua'] = '';
|
||||
|
||||
$text['label-dashboard_path']['en-us'] = 'Path';
|
||||
$text['label-dashboard_path']['ar-eg'] = '';
|
||||
$text['label-dashboard_path']['de-at'] = '';
|
||||
$text['label-dashboard_path']['de-ch'] = '';
|
||||
$text['label-dashboard_path']['de-de'] = '';
|
||||
$text['label-dashboard_path']['es-cl'] = '';
|
||||
$text['label-dashboard_path']['es-mx'] = '';
|
||||
$text['label-dashboard_path']['fr-ca'] = '';
|
||||
$text['label-dashboard_path']['fr-fr'] = '';
|
||||
$text['label-dashboard_path']['he-il'] = '';
|
||||
$text['label-dashboard_path']['it-it'] = '';
|
||||
$text['label-dashboard_path']['nl-nl'] = '';
|
||||
$text['label-dashboard_path']['pl-pl'] = '';
|
||||
$text['label-dashboard_path']['pt-br'] = '';
|
||||
$text['label-dashboard_path']['pt-pt'] = '';
|
||||
$text['label-dashboard_path']['ro-ro'] = '';
|
||||
$text['label-dashboard_path']['ru-ru'] = '';
|
||||
$text['label-dashboard_path']['sv-se'] = '';
|
||||
$text['label-dashboard_path']['uk-ua'] = '';
|
||||
|
||||
$text['description-dashboard_path']['en-us'] = 'Enter the dashboard widget path.';
|
||||
$text['description-dashboard_path']['ar-eg'] = '';
|
||||
$text['description-dashboard_path']['de-at'] = '';
|
||||
$text['description-dashboard_path']['de-ch'] = '';
|
||||
$text['description-dashboard_path']['de-de'] = '';
|
||||
$text['description-dashboard_path']['es-cl'] = '';
|
||||
$text['description-dashboard_path']['es-mx'] = '';
|
||||
$text['description-dashboard_path']['fr-ca'] = '';
|
||||
$text['description-dashboard_path']['fr-fr'] = '';
|
||||
$text['description-dashboard_path']['he-il'] = '';
|
||||
$text['description-dashboard_path']['it-it'] = '';
|
||||
$text['description-dashboard_path']['nl-nl'] = '';
|
||||
$text['description-dashboard_path']['pl-pl'] = '';
|
||||
$text['description-dashboard_path']['pt-br'] = '';
|
||||
$text['description-dashboard_path']['pt-pt'] = '';
|
||||
$text['description-dashboard_path']['ro-ro'] = '';
|
||||
$text['description-dashboard_path']['ru-ru'] = '';
|
||||
$text['description-dashboard_path']['sv-se'] = '';
|
||||
$text['description-dashboard_path']['uk-ua'] = '';
|
||||
|
||||
$text['label-dashboard_groups']['en-us'] = 'Groups';
|
||||
$text['label-dashboard_groups']['ar-eg'] = '';
|
||||
$text['label-dashboard_groups']['de-at'] = '';
|
||||
$text['label-dashboard_groups']['de-ch'] = '';
|
||||
$text['label-dashboard_groups']['de-de'] = '';
|
||||
$text['label-dashboard_groups']['es-cl'] = '';
|
||||
$text['label-dashboard_groups']['es-mx'] = '';
|
||||
$text['label-dashboard_groups']['fr-ca'] = '';
|
||||
$text['label-dashboard_groups']['fr-fr'] = '';
|
||||
$text['label-dashboard_groups']['he-il'] = '';
|
||||
$text['label-dashboard_groups']['it-it'] = '';
|
||||
$text['label-dashboard_groups']['nl-nl'] = '';
|
||||
$text['label-dashboard_groups']['pl-pl'] = '';
|
||||
$text['label-dashboard_groups']['pt-br'] = '';
|
||||
$text['label-dashboard_groups']['pt-pt'] = '';
|
||||
$text['label-dashboard_groups']['ro-ro'] = '';
|
||||
$text['label-dashboard_groups']['ru-ru'] = '';
|
||||
$text['label-dashboard_groups']['sv-se'] = '';
|
||||
$text['label-dashboard_groups']['uk-ua'] = '';
|
||||
|
||||
$text['description-dashboard_groups']['en-us'] = 'Add the groups that have permission to this widget.';
|
||||
$text['description-dashboard_groups']['ar-eg'] = '';
|
||||
$text['description-dashboard_groups']['de-at'] = '';
|
||||
$text['description-dashboard_groups']['de-ch'] = '';
|
||||
$text['description-dashboard_groups']['de-de'] = '';
|
||||
$text['description-dashboard_groups']['es-cl'] = '';
|
||||
$text['description-dashboard_groups']['es-mx'] = '';
|
||||
$text['description-dashboard_groups']['fr-ca'] = '';
|
||||
$text['description-dashboard_groups']['fr-fr'] = '';
|
||||
$text['description-dashboard_groups']['he-il'] = '';
|
||||
$text['description-dashboard_groups']['it-it'] = '';
|
||||
$text['description-dashboard_groups']['nl-nl'] = '';
|
||||
$text['description-dashboard_groups']['pl-pl'] = '';
|
||||
$text['description-dashboard_groups']['pt-br'] = '';
|
||||
$text['description-dashboard_groups']['pt-pt'] = '';
|
||||
$text['description-dashboard_groups']['ro-ro'] = '';
|
||||
$text['description-dashboard_groups']['ru-ru'] = '';
|
||||
$text['description-dashboard_groups']['sv-se'] = '';
|
||||
$text['description-dashboard_groups']['uk-ua'] = '';
|
||||
|
||||
$text['label-dashboard_order']['en-us'] = 'Order';
|
||||
$text['label-dashboard_order']['ar-eg'] = '';
|
||||
$text['label-dashboard_order']['de-at'] = '';
|
||||
$text['label-dashboard_order']['de-ch'] = '';
|
||||
$text['label-dashboard_order']['de-de'] = '';
|
||||
$text['label-dashboard_order']['es-cl'] = '';
|
||||
$text['label-dashboard_order']['es-mx'] = '';
|
||||
$text['label-dashboard_order']['fr-ca'] = '';
|
||||
$text['label-dashboard_order']['fr-fr'] = '';
|
||||
$text['label-dashboard_order']['he-il'] = '';
|
||||
$text['label-dashboard_order']['it-it'] = '';
|
||||
$text['label-dashboard_order']['nl-nl'] = '';
|
||||
$text['label-dashboard_order']['pl-pl'] = '';
|
||||
$text['label-dashboard_order']['pt-br'] = '';
|
||||
$text['label-dashboard_order']['pt-pt'] = '';
|
||||
$text['label-dashboard_order']['ro-ro'] = '';
|
||||
$text['label-dashboard_order']['ru-ru'] = '';
|
||||
$text['label-dashboard_order']['sv-se'] = '';
|
||||
$text['label-dashboard_order']['uk-ua'] = '';
|
||||
|
||||
$text['description-dashboard_order']['en-us'] = 'Enter the dashboard widget order.';
|
||||
$text['description-dashboard_order']['ar-eg'] = '';
|
||||
$text['description-dashboard_order']['de-at'] = '';
|
||||
$text['description-dashboard_order']['de-ch'] = '';
|
||||
$text['description-dashboard_order']['de-de'] = '';
|
||||
$text['description-dashboard_order']['es-cl'] = '';
|
||||
$text['description-dashboard_order']['es-mx'] = '';
|
||||
$text['description-dashboard_order']['fr-ca'] = '';
|
||||
$text['description-dashboard_order']['fr-fr'] = '';
|
||||
$text['description-dashboard_order']['he-il'] = '';
|
||||
$text['description-dashboard_order']['it-it'] = '';
|
||||
$text['description-dashboard_order']['nl-nl'] = '';
|
||||
$text['description-dashboard_order']['pl-pl'] = '';
|
||||
$text['description-dashboard_order']['pt-br'] = '';
|
||||
$text['description-dashboard_order']['pt-pt'] = '';
|
||||
$text['description-dashboard_order']['ro-ro'] = '';
|
||||
$text['description-dashboard_order']['ru-ru'] = '';
|
||||
$text['description-dashboard_order']['sv-se'] = '';
|
||||
$text['description-dashboard_order']['uk-ua'] = '';
|
||||
|
||||
$text['label-dashboard_enabled']['en-us'] = 'Enabled';
|
||||
$text['label-dashboard_enabled']['ar-eg'] = '';
|
||||
$text['label-dashboard_enabled']['de-at'] = '';
|
||||
$text['label-dashboard_enabled']['de-ch'] = '';
|
||||
$text['label-dashboard_enabled']['de-de'] = '';
|
||||
$text['label-dashboard_enabled']['es-cl'] = '';
|
||||
$text['label-dashboard_enabled']['es-mx'] = '';
|
||||
$text['label-dashboard_enabled']['fr-ca'] = '';
|
||||
$text['label-dashboard_enabled']['fr-fr'] = '';
|
||||
$text['label-dashboard_enabled']['he-il'] = '';
|
||||
$text['label-dashboard_enabled']['it-it'] = '';
|
||||
$text['label-dashboard_enabled']['nl-nl'] = '';
|
||||
$text['label-dashboard_enabled']['pl-pl'] = '';
|
||||
$text['label-dashboard_enabled']['pt-br'] = '';
|
||||
$text['label-dashboard_enabled']['pt-pt'] = '';
|
||||
$text['label-dashboard_enabled']['ro-ro'] = '';
|
||||
$text['label-dashboard_enabled']['ru-ru'] = '';
|
||||
$text['label-dashboard_enabled']['sv-se'] = '';
|
||||
$text['label-dashboard_enabled']['uk-ua'] = '';
|
||||
|
||||
$text['description-dashboard_enabled']['en-us'] = 'Enter the dashboard widget enabled.';
|
||||
$text['description-dashboard_enabled']['ar-eg'] = '';
|
||||
$text['description-dashboard_enabled']['de-at'] = '';
|
||||
$text['description-dashboard_enabled']['de-ch'] = '';
|
||||
$text['description-dashboard_enabled']['de-de'] = '';
|
||||
$text['description-dashboard_enabled']['es-cl'] = '';
|
||||
$text['description-dashboard_enabled']['es-mx'] = '';
|
||||
$text['description-dashboard_enabled']['fr-ca'] = '';
|
||||
$text['description-dashboard_enabled']['fr-fr'] = '';
|
||||
$text['description-dashboard_enabled']['he-il'] = '';
|
||||
$text['description-dashboard_enabled']['it-it'] = '';
|
||||
$text['description-dashboard_enabled']['nl-nl'] = '';
|
||||
$text['description-dashboard_enabled']['pl-pl'] = '';
|
||||
$text['description-dashboard_enabled']['pt-br'] = '';
|
||||
$text['description-dashboard_enabled']['pt-pt'] = '';
|
||||
$text['description-dashboard_enabled']['ro-ro'] = '';
|
||||
$text['description-dashboard_enabled']['ru-ru'] = '';
|
||||
$text['description-dashboard_enabled']['sv-se'] = '';
|
||||
$text['description-dashboard_enabled']['uk-ua'] = '';
|
||||
|
||||
$text['label-dashboard_description']['en-us'] = 'Description';
|
||||
$text['label-dashboard_description']['ar-eg'] = '';
|
||||
$text['label-dashboard_description']['de-at'] = '';
|
||||
$text['label-dashboard_description']['de-ch'] = '';
|
||||
$text['label-dashboard_description']['de-de'] = '';
|
||||
$text['label-dashboard_description']['es-cl'] = '';
|
||||
$text['label-dashboard_description']['es-mx'] = '';
|
||||
$text['label-dashboard_description']['fr-ca'] = '';
|
||||
$text['label-dashboard_description']['fr-fr'] = '';
|
||||
$text['label-dashboard_description']['he-il'] = '';
|
||||
$text['label-dashboard_description']['it-it'] = '';
|
||||
$text['label-dashboard_description']['nl-nl'] = '';
|
||||
$text['label-dashboard_description']['pl-pl'] = '';
|
||||
$text['label-dashboard_description']['pt-br'] = '';
|
||||
$text['label-dashboard_description']['pt-pt'] = '';
|
||||
$text['label-dashboard_description']['ro-ro'] = '';
|
||||
$text['label-dashboard_description']['ru-ru'] = '';
|
||||
$text['label-dashboard_description']['sv-se'] = '';
|
||||
$text['label-dashboard_description']['uk-ua'] = '';
|
||||
|
||||
$text['description-dashboard_description']['en-us'] = 'Enter the dashboard widget description.';
|
||||
$text['description-dashboard_description']['ar-eg'] = '';
|
||||
$text['description-dashboard_description']['de-at'] = '';
|
||||
$text['description-dashboard_description']['de-ch'] = '';
|
||||
$text['description-dashboard_description']['de-de'] = '';
|
||||
$text['description-dashboard_description']['es-cl'] = '';
|
||||
$text['description-dashboard_description']['es-mx'] = '';
|
||||
$text['description-dashboard_description']['fr-ca'] = '';
|
||||
$text['description-dashboard_description']['fr-fr'] = '';
|
||||
$text['description-dashboard_description']['he-il'] = '';
|
||||
$text['description-dashboard_description']['it-it'] = '';
|
||||
$text['description-dashboard_description']['nl-nl'] = '';
|
||||
$text['description-dashboard_description']['pl-pl'] = '';
|
||||
$text['description-dashboard_description']['pt-br'] = '';
|
||||
$text['description-dashboard_description']['pt-pt'] = '';
|
||||
$text['description-dashboard_description']['ro-ro'] = '';
|
||||
$text['description-dashboard_description']['ru-ru'] = '';
|
||||
$text['description-dashboard_description']['sv-se'] = '';
|
||||
$text['description-dashboard_description']['uk-ua'] = '';
|
||||
|
||||
$text['label-welcome']['en-us'] = "Welcome:";
|
||||
$text['label-welcome']['en-gb'] = "Welcome:";
|
||||
$text['label-welcome']['ar-eg'] = "أهلا بك:";
|
||||
$text['label-welcome']['de-at'] = "Herzlich willkommen:"; //copied from de-de
|
||||
$text['label-welcome']['de-ch'] = "Herzlich willkommen:"; //copied from de-de
|
||||
$text['label-welcome']['de-de'] = "Herzlich willkommen:";
|
||||
$text['label-welcome']['el-gr'] = "Καλώς ήλθατε:";
|
||||
$text['label-welcome']['es-cl'] = "Bienvenido:";
|
||||
$text['label-welcome']['es-mx'] = "Bienvenido:"; //copied from es-cl
|
||||
$text['label-welcome']['fr-ca'] = "Bienvenue:"; //copied from fr-fr
|
||||
$text['label-welcome']['fr-fr'] = "Bienvenue:";
|
||||
$text['label-welcome']['he-il'] = "ברוך הבא:";
|
||||
$text['label-welcome']['it-it'] = "Benvenuto:";
|
||||
$text['label-welcome']['nl-nl'] = "";
|
||||
$text['label-welcome']['pl-pl'] = "Witamy:";
|
||||
$text['label-welcome']['pt-br'] = "Bem-vindo:";
|
||||
$text['label-welcome']['pt-pt'] = "Witamy:";
|
||||
$text['label-welcome']['ro-ro'] = "Bine ati venit:";
|
||||
$text['label-welcome']['ru-ru'] = "Добро пожаловать:";
|
||||
$text['label-welcome']['sv-se'] = "Välkommen:";
|
||||
$text['label-welcome']['uk-ua'] = "Ласкаво просимо:";
|
||||
?>
|
||||
17
core/dashboard/app_menu.php
Normal file
17
core/dashboard/app_menu.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
//$apps[$x]['menu'][0]['title']['en-us'] = 'Dashboard';
|
||||
//$apps[$x]['menu'][0]['title']['es-cl'] = '';
|
||||
//$apps[$x]['menu'][0]['title']['fr-fr'] = '';
|
||||
//$apps[$x]['menu'][0]['title']['fr-ca'] = '';
|
||||
//$apps[$x]['menu'][0]['title']['pl'] = '';
|
||||
//$apps[$x]['menu'][0]['title']['sv-se'] = '';
|
||||
//$apps[$x]['menu'][0]['title']['uk'] = '';
|
||||
//$apps[$x]['menu'][0]['title']['de-at'] = '';
|
||||
//$apps[$x]['menu'][0]['uuid'] = '80e1d487-3091-40a1-aefd-ef8e39e79173';
|
||||
//$apps[$x]['menu'][0]['parent_uuid'] = '02194288-6d56-6d3e-0b1a-d53a2bc10788';
|
||||
//$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
//$apps[$x]['menu'][0]['path'] = '/app/dashboard/';
|
||||
//$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
|
||||
?>
|
||||
351
core/dashboard/dashboard.php
Normal file
351
core/dashboard/dashboard.php
Normal file
@@ -0,0 +1,351 @@
|
||||
<?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) 2021
|
||||
the Initial Developer. All Rights Reserved.
|
||||
*/
|
||||
|
||||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('dashboard_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get the http post data
|
||||
if (is_array($_POST['dashboard'])) {
|
||||
$action = $_POST['action'];
|
||||
$search = $_POST['search'];
|
||||
$dashboard = $_POST['dashboard'];
|
||||
}
|
||||
|
||||
//process the http post data by action
|
||||
if ($action != '' && is_array($dashboard) && @sizeof($dashboard) != 0) {
|
||||
|
||||
switch ($action) {
|
||||
case 'copy':
|
||||
if (permission_exists('dashboard_add')) {
|
||||
$obj = new dashboard;
|
||||
$obj->copy($dashboard);
|
||||
}
|
||||
break;
|
||||
case 'toggle':
|
||||
if (permission_exists('dashboard_edit')) {
|
||||
$obj = new dashboard;
|
||||
$obj->toggle($dashboard);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
if (permission_exists('dashboard_delete')) {
|
||||
$obj = new dashboard;
|
||||
$obj->delete($dashboard);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
header('Location: dashboard.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
|
||||
//get order and order by
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//add the search
|
||||
if (isset($_GET["search"])) {
|
||||
$search = strtolower($_GET["search"]);
|
||||
}
|
||||
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["export"])) {
|
||||
$export = $_REQUEST["export"];
|
||||
}
|
||||
|
||||
//expore provider settings
|
||||
if (isset($export) && $export == 'true') {
|
||||
|
||||
//get the dashboard
|
||||
$sql = "select ";
|
||||
$sql .= "dashboard_uuid, ";
|
||||
$sql .= "dashboard_name, ";
|
||||
$sql .= "dashboard_path, ";
|
||||
$sql .= "dashboard_order, ";
|
||||
$sql .= "cast(dashboard_enabled as text), ";
|
||||
$sql .= "dashboard_description ";
|
||||
$sql .= "from v_dashboard ";
|
||||
$database = new database;
|
||||
$dashboard_widgets = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//prepare the array
|
||||
if (is_array($dashboard_widgets)) {
|
||||
$x = 0;
|
||||
$y = 0;
|
||||
foreach ($dashboard_widgets as $row) {
|
||||
//add to the array
|
||||
$array['dashboard'][$x]['dashboard_uuid'] = $row["dashboard_uuid"];
|
||||
$array['dashboard'][$x]['dashboard_name'] = $row["dashboard_name"];
|
||||
$array['dashboard'][$x]['dashboard_path'] = $row["dashboard_path"];
|
||||
$array['dashboard'][$x]['dashboard_order'] = $row["dashboard_order"];
|
||||
$array['dashboard'][$x]['dashboard_enabled'] = $row["dashboard_enabled"];
|
||||
$array['dashboard'][$x]['dashboard_description'] = $row["dashboard_description"];
|
||||
|
||||
//get the dashboard groups
|
||||
$sql = "select ";
|
||||
$sql .= "dashboard_group_uuid, ";
|
||||
$sql .= "dashboard_uuid, ";
|
||||
$sql .= "group_uuid, ";
|
||||
$sql .= "(select group_name from v_groups where v_dashboard_groups.group_uuid = group_uuid) as group_name ";
|
||||
$sql .= "from v_dashboard_groups ";
|
||||
$sql .= "where dashboard_uuid = :dashboard_uuid ";
|
||||
$parameters['dashboard_uuid'] = $row["dashboard_uuid"];
|
||||
$database = new database;
|
||||
$dashboard_groups = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
if (is_array($dashboard_groups)) {
|
||||
$y = 0;
|
||||
foreach ($dashboard_groups as $row) {
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = $row["dashboard_group_uuid"];
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = $row["dashboard_uuid"];
|
||||
//$array['dashboard'][$x]['dashboard_groups'][$y]['group_uuid'] = $row["group_uuid"];
|
||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = $row["group_name"];
|
||||
$y++;
|
||||
}
|
||||
}
|
||||
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
|
||||
//write the code
|
||||
echo "<textarea style=\"width: 100%; max-width: 100%; height: 100%; max-height: 100%;\">\n";
|
||||
if (is_array($array['dashboard'])) {
|
||||
echo "\n\n\n";
|
||||
//echo "\$x = 0;\n";
|
||||
foreach ($array['dashboard'] as $row) {
|
||||
foreach ($row as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
echo "\$y = 0;\n";
|
||||
$count = count($value);
|
||||
$i = 1;
|
||||
foreach ($value as $row) {
|
||||
foreach ($row as $key => $value) {
|
||||
echo "\$array['dashboard'][\$x]['dashboard_groups'][\$y]['{$key}'] = '{$value}';\n";
|
||||
}
|
||||
if ($i < $count) {
|
||||
echo "\$y++;\n";
|
||||
}
|
||||
else {
|
||||
echo "\n\n---------------------------\n\n\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "\$array['dashboard'][\$x]['{$key}'] = '{$value}';\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "</textarea>\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
//get the count
|
||||
$sql = "select count(dashboard_uuid) ";
|
||||
$sql .= "from v_dashboard ";
|
||||
if (isset($search)) {
|
||||
$sql .= "where (\n";
|
||||
$sql .= " dashboard_name = :search \n";
|
||||
$sql .= " or dashboard_description = :search \n";
|
||||
$sql .= ")\n";
|
||||
$parameters['search'] = '%'.$search.'%';
|
||||
}
|
||||
$database = new database;
|
||||
$num_rows = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//get the list
|
||||
$sql = "select \n";
|
||||
$sql .= "dashboard_uuid, \n";
|
||||
$sql .= "dashboard_name,\n";
|
||||
$sql .= "( \n";
|
||||
$sql .= " select \n";
|
||||
$sql .= " string_agg(g.group_name, ', ') \n";
|
||||
$sql .= " from \n";
|
||||
$sql .= " v_dashboard_groups as dg, \n";
|
||||
$sql .= " v_groups as g \n";
|
||||
$sql .= " where \n";
|
||||
$sql .= " dg.group_uuid = g.group_uuid \n";
|
||||
$sql .= " and d.dashboard_uuid = dg.dashboard_uuid \n";
|
||||
$sql .= ") AS dashboard_groups, \n";
|
||||
$sql .= "dashboard_order, \n";
|
||||
$sql .= "cast(dashboard_enabled as text), \n";
|
||||
$sql .= "dashboard_description \n";
|
||||
$sql .= "from v_dashboard as d \n";
|
||||
if (isset($_GET["search"])) {
|
||||
$sql .= "where (\n";
|
||||
$sql .= " lower(dashboard_name) like :search \n";
|
||||
$sql .= " or lower(dashboard_description) like :search \n";
|
||||
$sql .= ")\n";
|
||||
$parameters['search'] = '%'.strtolower($search).'%';
|
||||
}
|
||||
$sql .= order_by($order_by, $order, '', '');
|
||||
$sql .= limit_offset($rows_per_page, $offset);
|
||||
$database = new database;
|
||||
$dashboard = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//additional includes
|
||||
$document['title'] = $text['title-dashboard'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-dashboard']." (".$num_rows.")</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
if (permission_exists('dashboard_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','name'=>'btn_add','link'=>'dashboard_edit.php']);
|
||||
}
|
||||
if (permission_exists('dashboard_add') && $dashboard) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'id'=>'btn_copy','name'=>'btn_copy','style'=>'display:none;','onclick'=>"modal_open('modal-copy','btn_copy');"]);
|
||||
}
|
||||
if (permission_exists('dashboard_edit') && $dashboard) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'id'=>'btn_toggle','name'=>'btn_toggle','style'=>'display:none;','onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
||||
}
|
||||
if (permission_exists('dashboard_delete') && $dashboard) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display:none;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
}
|
||||
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'=>'dashboard.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
|
||||
}
|
||||
echo " </form>\n";
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
if (permission_exists('dashboard_add') && $dashboard) {
|
||||
echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('copy'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
if (permission_exists('dashboard_edit') && $dashboard) {
|
||||
echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('toggle'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
if (permission_exists('dashboard_delete') && $dashboard) {
|
||||
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
|
||||
|
||||
echo "<form id='form_list' method='post'>\n";
|
||||
echo "<input type='hidden' id='action' name='action' value=''>\n";
|
||||
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
|
||||
|
||||
echo "<table class='list'>\n";
|
||||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('dashboard_add') || permission_exists('dashboard_edit') || permission_exists('dashboard_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".($dashboard ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo th_order_by('dashboard_name', $text['label-dashboard_name'], $order_by, $order);
|
||||
echo th_order_by('dashboard_groups', $text['label-dashboard_groups'], $order_by, $order);
|
||||
echo th_order_by('dashboard_order', $text['label-dashboard_order'], $order_by, $order);
|
||||
echo th_order_by('dashboard_enabled', $text['label-dashboard_enabled'], $order_by, $order, null, "class='center'");
|
||||
echo " <th class='hide-sm-dn'>".$text['label-dashboard_description']."</th>\n";
|
||||
if (permission_exists('dashboard_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($dashboard) && @sizeof($dashboard) != 0) {
|
||||
$x = 0;
|
||||
foreach ($dashboard as $row) {
|
||||
if (permission_exists('dashboard_edit')) {
|
||||
$list_row_url = "dashboard_edit.php?id=".urlencode($row['dashboard_uuid']);
|
||||
}
|
||||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('dashboard_add') || permission_exists('dashboard_edit') || permission_exists('dashboard_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='dashboard[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"checkbox_on_change(this); if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
|
||||
echo " <input type='hidden' name='dashboard[$x][dashboard_uuid]' value='".escape($row['dashboard_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " <td>\n";
|
||||
if (permission_exists('dashboard_edit')) {
|
||||
echo " <a href='".$list_row_url."' title=\"".$text['button-edit']."\">".escape($row['dashboard_name'])."</a>\n";
|
||||
}
|
||||
else {
|
||||
echo " ".escape($row['dashboard_name']);
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td>".escape($row['dashboard_groups'])."</td>\n";
|
||||
echo " <td>".escape($row['dashboard_order'])."</td>\n";
|
||||
if (permission_exists('dashboard_edit')) {
|
||||
echo " <td class='no-link center'>\n";
|
||||
echo " <input type='hidden' name='number_translations[$x][dashboard_enabled]' value='".escape($row['dashboard_enabled'])."' />\n";
|
||||
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['dashboard_enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
|
||||
}
|
||||
else {
|
||||
echo " <td class='center'>\n";
|
||||
echo $text['label-'.$row['dashboard_enabled']];
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td class='description overflow hide-sm-dn'>".escape($row['dashboard_description'])."</td>\n";
|
||||
if (permission_exists('dashboard_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
$x++;
|
||||
}
|
||||
unset($dashboard);
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
echo "<div align='center'>".$paging_controls."</div>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
450
core/dashboard/dashboard_edit.php
Normal file
450
core/dashboard/dashboard_edit.php
Normal file
@@ -0,0 +1,450 @@
|
||||
<?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) 2021
|
||||
the Initial Developer. All Rights Reserved.
|
||||
*/
|
||||
|
||||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('dashboard_add') || permission_exists('dashboard_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//action add or update
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$dashboard_uuid = $_REQUEST["id"];
|
||||
$id = $_REQUEST["id"];
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (is_array($_POST)) {
|
||||
$dashboard_name = $_POST["dashboard_name"];
|
||||
$dashboard_path = $_POST["dashboard_path"];
|
||||
$dashboard_groups = $_POST["dashboard_groups"];
|
||||
$dashboard_order = $_POST["dashboard_order"];
|
||||
$dashboard_enabled = $_POST["dashboard_enabled"];
|
||||
$dashboard_description = $_POST["dashboard_description"];
|
||||
}
|
||||
|
||||
//delete the group from the sub table
|
||||
if ($_REQUEST["a"] == "delete" && permission_exists("dashboard_group_delete") && is_uuid($_GET["dashboard_group_uuid"]) && is_uuid($_GET["dashboard_uuid"])) {
|
||||
//get the uuid
|
||||
$dashboard_group_uuid = $_GET["dashboard_group_uuid"];
|
||||
$dashboard_uuid = $_GET["dashboard_uuid"];
|
||||
//delete the group from the users
|
||||
$array['dashboard_groups'][0]['dashboard_group_uuid'] = $dashboard_group_uuid;
|
||||
$database = new database;
|
||||
$database->app_name = 'dashboard';
|
||||
$database->app_uuid = '55533bef-4f04-434a-92af-999c1e9927f7';
|
||||
$database->delete($array);
|
||||
unset($array);
|
||||
//redirect the user
|
||||
message::add($text['message-delete']);
|
||||
header("Location: dashboard_edit.php?id=".urlencode($dashboard_uuid));
|
||||
return;
|
||||
}
|
||||
|
||||
//process the user data and save it to the database
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: dashboard.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
//process the http post data by submitted action
|
||||
if ($_POST['action'] != '' && strlen($_POST['action']) > 0) {
|
||||
|
||||
//prepare the array(s)
|
||||
//send the array to the database class
|
||||
switch ($_POST['action']) {
|
||||
case 'copy':
|
||||
if (permission_exists('dashboard_add')) {
|
||||
$obj = new database;
|
||||
$obj->copy($array);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
if (permission_exists('dashboard_delete')) {
|
||||
$obj = new database;
|
||||
$obj->delete($array);
|
||||
}
|
||||
break;
|
||||
case 'toggle':
|
||||
if (permission_exists('dashboard_update')) {
|
||||
$obj = new database;
|
||||
$obj->toggle($array);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
if (in_array($_POST['action'], array('copy', 'delete', 'toggle'))) {
|
||||
header('Location: dashboard_edit.php?id='.$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
//if (strlen($dashboard_name) == 0) { $msg .= $text['message-required']." ".$text['label-dashboard_name']."<br>\n"; }
|
||||
//if (strlen($dashboard_path) == 0) { $msg .= $text['message-required']." ".$text['label-dashboard_path']."<br>\n"; }
|
||||
//if (strlen($dashboard_groups) == 0) { $msg .= $text['message-required']." ".$text['label-dashboard_groups']."<br>\n"; }
|
||||
//if (strlen($dashboard_order) == 0) { $msg .= $text['message-required']." ".$text['label-dashboard_order']."<br>\n"; }
|
||||
//if (strlen($dashboard_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-dashboard_enabled']."<br>\n"; }
|
||||
//if (strlen($dashboard_description) == 0) { $msg .= $text['message-required']." ".$text['label-dashboard_description']."<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persist_form_var.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add the dashboard_uuid
|
||||
if (!is_uuid($_POST["dashboard_uuid"])) {
|
||||
$dashboard_uuid = uuid();
|
||||
}
|
||||
|
||||
//prepare the array
|
||||
$array['dashboard'][0]['dashboard_uuid'] = $dashboard_uuid;
|
||||
$array['dashboard'][0]['dashboard_name'] = $dashboard_name;
|
||||
$array['dashboard'][0]['dashboard_path'] = $dashboard_path;
|
||||
$array['dashboard'][0]['dashboard_order'] = $dashboard_order;
|
||||
$array['dashboard'][0]['dashboard_enabled'] = $dashboard_enabled;
|
||||
$array['dashboard'][0]['dashboard_description'] = $dashboard_description;
|
||||
$y = 0;
|
||||
if (is_array($dashboard_groups)) {
|
||||
foreach ($dashboard_groups as $row) {
|
||||
if (isset($row['group_uuid'])) {
|
||||
$array['dashboard'][0]['dashboard_groups'][$y]['dashboard_group_uuid'] = uuid();
|
||||
$array['dashboard'][0]['dashboard_groups'][$y]['group_uuid'] = $row["group_uuid"];
|
||||
$y++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//save the data
|
||||
$database = new database;
|
||||
$database->app_name = 'dashboard';
|
||||
$database->app_uuid = '55533bef-4f04-434a-92af-999c1e9927f7';
|
||||
$database->save($array);
|
||||
//$result = $database->message;
|
||||
//view_array($result);
|
||||
//exit;
|
||||
|
||||
//redirect the user
|
||||
if (isset($action)) {
|
||||
if ($action == "add") {
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
}
|
||||
if ($action == "update") {
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
}
|
||||
//header('Location: dashboard.php');
|
||||
header('Location: dashboard_edit.php?id='.urlencode($dashboard_uuid));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (is_array($_GET) && $_POST["persistformvar"] != "true") {
|
||||
$sql = "select ";
|
||||
$sql .= " dashboard_uuid, ";
|
||||
$sql .= " dashboard_name, ";
|
||||
$sql .= " dashboard_path, ";
|
||||
$sql .= " dashboard_groups, ";
|
||||
$sql .= " dashboard_order, ";
|
||||
$sql .= " cast(dashboard_enabled as text), ";
|
||||
$sql .= " dashboard_description ";
|
||||
$sql .= "from v_dashboard ";
|
||||
$sql .= "where dashboard_uuid = :dashboard_uuid ";
|
||||
$parameters['dashboard_uuid'] = $dashboard_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
$dashboard_name = $row["dashboard_name"];
|
||||
$dashboard_path = $row["dashboard_path"];
|
||||
$dashboard_groups = $row["dashboard_groups"];
|
||||
$dashboard_order = $row["dashboard_order"];
|
||||
$dashboard_enabled = $row["dashboard_enabled"];
|
||||
$dashboard_description = $row["dashboard_description"];
|
||||
}
|
||||
unset($sql, $parameters, $row);
|
||||
}
|
||||
|
||||
//get the child data
|
||||
if (is_uuid($dashboard_uuid)) {
|
||||
$sql = "select ";
|
||||
$sql .= " dashboard_group_uuid, ";
|
||||
$sql .= " group_uuid ";
|
||||
$sql .= "from v_dashboard_groups ";
|
||||
$sql .= "where dashboard_uuid = :dashboard_uuid ";
|
||||
$parameters['dashboard_uuid'] = $dashboard_uuid;
|
||||
$database = new database;
|
||||
$dashboard_groups = $database->select($sql, $parameters, 'all');
|
||||
unset ($sql, $parameters);
|
||||
}
|
||||
|
||||
//add the $dashboard_group_uuid
|
||||
if (!is_uuid($dashboard_group_uuid)) {
|
||||
$dashboard_group_uuid = uuid();
|
||||
}
|
||||
|
||||
//add an empty row
|
||||
$x = is_array($dashboard_groups) ? count($dashboard_groups) : 0;
|
||||
$dashboard_groups[$x]['dashboard_uuid'] = $dashboard_uuid;
|
||||
$dashboard_groups[$x]['dashboard_group_uuid'] = uuid();
|
||||
$dashboard_groups[$x]['group_uuid'] = '';
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//show the header
|
||||
$document['title'] = $text['title-dashboard'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//get the child groups
|
||||
$sql = "select * from v_dashboard_groups as x, v_groups as g ";
|
||||
$sql .= "where x.dashboard_uuid = :dashboard_uuid ";
|
||||
$sql .= "and x.group_uuid = g.group_uuid ";
|
||||
$parameters['dashboard_uuid'] = $dashboard_uuid;
|
||||
$database = new database;
|
||||
$dashboard_groups = $database->select($sql, $parameters, 'all');
|
||||
unset ($sql, $parameters);
|
||||
|
||||
//get the groups
|
||||
$sql = "SELECT group_uuid, group_name FROM v_groups ";
|
||||
$sql .= "WHERE (domain_uuid = :domain_uuid or domain_uuid is null)";
|
||||
$sql .= "ORDER by group_name asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$groups = $database->execute($sql, $parameters, 'all');
|
||||
unset ($sql, $parameters);
|
||||
|
||||
//set the assigned_groups array
|
||||
if (is_array($dashboard_groups) && sizeof($dashboard_groups) != 0) {
|
||||
$assigned_groups = array();
|
||||
foreach ($dashboard_groups as $field) {
|
||||
if (strlen($field['group_name']) > 0) {
|
||||
if (is_uuid($field['group_uuid'])) {
|
||||
$assigned_groups[] = $field['group_uuid'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//show the content
|
||||
echo "<form name='frm' id='frm' method='post' action=''>\n";
|
||||
echo "<input class='formfld' type='hidden' name='dashboard_uuid' value='".escape($dashboard_uuid)."'>\n";
|
||||
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-dashboard']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'dashboard.php']);
|
||||
if ($action == 'update') {
|
||||
if (permission_exists('dashboard_group_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'id'=>'btn_copy','name'=>'btn_copy','style'=>'display: none;','onclick'=>"modal_open('modal-copy','btn_copy');"]);
|
||||
}
|
||||
if (permission_exists('dashboard_group_delete')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; margin-right: 15px;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
}
|
||||
}
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','collapse'=>'hide-xs']);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
echo $text['title_description-dashboard']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
if ($action == 'update') {
|
||||
if (permission_exists('dashboard_add')) {
|
||||
echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=>button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','name'=>'action','value'=>'copy','onclick'=>"modal_close();"])]);
|
||||
}
|
||||
if (permission_exists('dashboard_delete')) {
|
||||
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','name'=>'action','value'=>'delete','onclick'=>"modal_close();"])]);
|
||||
}
|
||||
}
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-dashboard_name']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='dashboard_name' maxlength='255' value='".escape($dashboard_name)."'>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-dashboard_name']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-dashboard_path']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='dashboard_path' maxlength='255' value='".escape($dashboard_path)."'>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-dashboard_path']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-dashboard_groups']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
if (is_array($dashboard_groups) && sizeof($dashboard_groups) != 0) {
|
||||
echo "<table cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
foreach($dashboard_groups as $field) {
|
||||
if (strlen($field['group_name']) > 0) {
|
||||
echo "<tr>\n";
|
||||
echo " <td class='vtable' style='white-space: nowrap; padding-right: 30px;' nowrap='nowrap'>\n";
|
||||
echo $field['group_name'].(($field['group_domain_uuid'] != '') ? "@".$_SESSION['domains'][$field['group_domain_uuid']]['domain_name'] : null);
|
||||
echo " </td>\n";
|
||||
if (permission_exists('dashboard_group_delete') || if_group("superadmin")) {
|
||||
echo " <td class='list_control_icons' style='width: 25px;'>\n";
|
||||
echo "<a href='dashboard_edit.php?id=".escape($field['dashboard_group_uuid'])."&dashboard_group_uuid=".escape($field['dashboard_group_uuid'])."&dashboard_uuid=".escape($dashboard_uuid)."&a=delete' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
}
|
||||
}
|
||||
echo "</table>\n";
|
||||
}
|
||||
if (is_array($groups)) {
|
||||
echo "<br />\n";
|
||||
echo "<select name='dashboard_groups[0][group_uuid]' class='formfld' style='width: auto; margin-right: 3px;'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach($groups as $row) {
|
||||
if ($field['group_level'] <= $_SESSION['user']['group_level']) {
|
||||
if (!in_array($row["group_uuid"], $assigned_groups)) {
|
||||
echo " <option value='".$row['group_uuid']."'>".$row['group_name'].(($row['domain_uuid'] != '') ? "@".$_SESSION['domains'][$row['domain_uuid']]['domain_name'] : null)."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</select>\n";
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]);
|
||||
}
|
||||
echo "<br />\n";
|
||||
echo $text['description-dashboard_groups']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-dashboard_order']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <select name='dashboard_order' class='formfld'>\n";
|
||||
$i=0;
|
||||
while ($i<=999) {
|
||||
$selected = ($i == $dashboard_order) ? "selected" : null;
|
||||
if (strlen($i) == 1) {
|
||||
echo " <option value='00$i' ".$selected.">00$i</option>\n";
|
||||
}
|
||||
if (strlen($i) == 2) {
|
||||
echo " <option value='0$i' ".$selected.">0$i</option>\n";
|
||||
}
|
||||
if (strlen($i) == 3) {
|
||||
echo " <option value='$i' ".$selected.">$i</option>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-dashboard_order']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-dashboard_enabled']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <select class='formfld' name='dashboard_enabled'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($dashboard_enabled == "true") {
|
||||
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>".$text['label-true']."</option>\n";
|
||||
}
|
||||
if ($dashboard_enabled == "false") {
|
||||
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>".$text['label-false']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-dashboard_enabled']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-dashboard_description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='dashboard_description' maxlength='255' value='".escape($dashboard_description)."'>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-dashboard_description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "<br /><br />";
|
||||
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
|
||||
echo "</form>";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
155
core/dashboard/index.php
Normal file
155
core/dashboard/index.php
Normal file
@@ -0,0 +1,155 @@
|
||||
<?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) 2021
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//include the root directory
|
||||
include "root.php";
|
||||
|
||||
//if config.php file does not exist then redirect to the install page
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
|
||||
//do nothing
|
||||
} elseif (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
|
||||
//original directory
|
||||
} elseif (file_exists("/etc/fusionpbx/config.php")){
|
||||
//linux
|
||||
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")){
|
||||
//bsd
|
||||
} else {
|
||||
header("Location: ".PROJECT_PATH."/core/install/install.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
//additional includes
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//disable login message
|
||||
if (isset($_GET['msg']) && $_GET['msg'] == 'dismiss') {
|
||||
unset($_SESSION['login']['message']['text']);
|
||||
|
||||
$sql = "update v_default_settings ";
|
||||
$sql .= "set default_setting_enabled = 'false' ";
|
||||
$sql .= "where ";
|
||||
$sql .= "default_setting_category = 'login' ";
|
||||
$sql .= "and default_setting_subcategory = 'message' ";
|
||||
$sql .= "and default_setting_name = 'text' ";
|
||||
$database = new database;
|
||||
$database->execute($sql);
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//build a list of groups the user is a member of to be used in a SQL in
|
||||
foreach($_SESSION['user']['groups'] as $group) {
|
||||
$group_uuids[] = $group['group_uuid'];
|
||||
}
|
||||
$group_uuids_in = "'".implode("','", $group_uuids)."'";
|
||||
|
||||
//get the list
|
||||
$sql = "select \n";
|
||||
$sql .= "dashboard_uuid, \n";
|
||||
$sql .= "dashboard_name, \n";
|
||||
$sql .= "dashboard_path, \n";
|
||||
$sql .= "dashboard_order, \n";
|
||||
$sql .= "cast(dashboard_enabled as text), \n";
|
||||
$sql .= "dashboard_description \n";
|
||||
$sql .= "from v_dashboard as d \n";
|
||||
$sql .= "where dashboard_enabled = 'true' \n";
|
||||
$sql .= "and dashboard_uuid in (\n";
|
||||
$sql .= " select dashboard_uuid from v_dashboard_groups where group_uuid in (\n";
|
||||
$sql .= " ".$group_uuids_in." \n";
|
||||
$sql .= " )\n";
|
||||
$sql .= ")\n";
|
||||
$sql .= "order by dashboard_order asc \n";
|
||||
$database = new database;
|
||||
$dashboard = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//load the header
|
||||
$document['title'] = $text['title-dashboard'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//start the content
|
||||
/*
|
||||
echo "<table cellpadding='0' cellspacing='0' border='0' width='100%'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td valign='top'>";
|
||||
echo " <b>".$text['title-dashboard']."</b><br />";
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' style='text-align: right; white-space: nowrap;'>\n";
|
||||
if ($_SESSION['theme']['menu_style']['text'] != 'side') {
|
||||
echo " ".$text['label-welcome']." <a href='".PROJECT_PATH."/core/users/user_edit.php?id=user'>".$_SESSION["username"]."</a>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' valign='top'>";
|
||||
echo " ".$text['description-dashboard'];
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br />";
|
||||
*/
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-dashboard']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
if ($_SESSION['theme']['menu_style']['text'] != 'side') {
|
||||
echo " ".$text['label-welcome']." <a href='".PROJECT_PATH."/core/users/user_edit.php?id=user'>".$_SESSION["username"]."</a> ";
|
||||
}
|
||||
if (permission_exists('dashboard_edit')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-settings'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','name'=>'btn_add','link'=>'dashboard.php']);
|
||||
}
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both; text-align: left;'>".$text['description-dashboard']."</div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
//display login message
|
||||
//if (if_group("superadmin") && isset($_SESSION['login']['message']['text']) && $_SESSION['login']['message']['text'] != '') {
|
||||
// echo "<div class='login_message' width='100%'><b>".$text['login-message_attention']."</b> ".$_SESSION['login']['message']['text']." (<a href='?msg=dismiss'>".$text['login-message_dismiss']."</a>)</div>";
|
||||
//}
|
||||
|
||||
//include the dashboards
|
||||
echo "<div class='row' style='padding: 0 10px;'>\n";
|
||||
$n = 0;
|
||||
foreach($dashboard as $row) {
|
||||
echo "<div class='col-xs-12 col-sm-6 col-md-4 col-lg-3' style='margin: 15px 0 30px 0;'>\n";
|
||||
echo " <div class='row' style='padding: 0 10px;'>\n";
|
||||
echo " <div class='col-md-12' style='padding: 0;'>\n";
|
||||
include($row['dashboard_path']);
|
||||
echo " </div>\n";
|
||||
echo " </div>\n";
|
||||
echo "</div>\n";
|
||||
$n++;
|
||||
}
|
||||
echo "</div>\n";
|
||||
|
||||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
261
core/dashboard/resources/classes/dashboard.php
Normal file
261
core/dashboard/resources/classes/dashboard.php
Normal file
@@ -0,0 +1,261 @@
|
||||
<?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) 2019 - 2021
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
* dashboard class
|
||||
*
|
||||
* @method null delete
|
||||
* @method null toggle
|
||||
* @method null copy
|
||||
*/
|
||||
if (!class_exists('dashboard')) {
|
||||
class dashboard {
|
||||
|
||||
/**
|
||||
* declare the variables
|
||||
*/
|
||||
private $app_name;
|
||||
private $app_uuid;
|
||||
private $name;
|
||||
private $table;
|
||||
private $toggle_field;
|
||||
private $toggle_values;
|
||||
private $description_field;
|
||||
private $location;
|
||||
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
//assign the variables
|
||||
$this->app_name = 'dashboard';
|
||||
$this->app_uuid = '55533bef-4f04-434a-92af-999c1e9927f7';
|
||||
$this->name = 'dashboard';
|
||||
$this->table = 'dashboard';
|
||||
$this->toggle_field = 'dashboard_enabled';
|
||||
$this->toggle_values = ['true','false'];
|
||||
$this->description_field = 'dashboard_description';
|
||||
$this->location = 'dashboard.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 rows from the database
|
||||
*/
|
||||
public function delete($records) {
|
||||
if (permission_exists($this->name.'_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->location);
|
||||
exit;
|
||||
}
|
||||
|
||||
//delete multiple records
|
||||
if (is_array($records) && @sizeof($records) != 0) {
|
||||
//build the delete array
|
||||
$x = 0;
|
||||
foreach ($records as $record) {
|
||||
//add to the array
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$array[$this->table][$x]['dashboard_uuid'] = $record['dashboard_uuid'];
|
||||
}
|
||||
|
||||
//increment the id
|
||||
$x++;
|
||||
}
|
||||
|
||||
//delete the checked rows
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
//execute delete
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->delete($array);
|
||||
unset($array);
|
||||
|
||||
//set message
|
||||
message::add($text['message-delete']);
|
||||
}
|
||||
unset($records);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* toggle a field between two values
|
||||
*/
|
||||
public function toggle($records) {
|
||||
if (permission_exists($this->name.'_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->location);
|
||||
exit;
|
||||
}
|
||||
|
||||
//toggle the checked records
|
||||
if (is_array($records) && @sizeof($records) != 0) {
|
||||
//get current toggle state
|
||||
foreach($records as $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['dashboard_uuid'])) {
|
||||
$uuids[] = "'".$record['dashboard_uuid']."'";
|
||||
}
|
||||
}
|
||||
if (is_array($uuids) && @sizeof($uuids) != 0) {
|
||||
$sql = "select ".$this->name."_uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
|
||||
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
|
||||
$database = new database;
|
||||
$rows = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
$states[$row['uuid']] = $row['toggle'];
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $rows, $row);
|
||||
}
|
||||
|
||||
//build update array
|
||||
$x = 0;
|
||||
foreach($states as $uuid => $state) {
|
||||
//create the array
|
||||
$array[$this->table][$x][$this->name.'_uuid'] = $uuid;
|
||||
$array[$this->table][$x][$this->toggle_field] = $state == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0];
|
||||
|
||||
//increment the id
|
||||
$x++;
|
||||
}
|
||||
|
||||
//save the changes
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
//save the array
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->save($array);
|
||||
unset($array);
|
||||
|
||||
//set message
|
||||
message::add($text['message-toggle']);
|
||||
}
|
||||
unset($records, $states);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* copy rows from the database
|
||||
*/
|
||||
public function copy($records) {
|
||||
if (permission_exists($this->name.'_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->location);
|
||||
exit;
|
||||
}
|
||||
|
||||
//copy the checked records
|
||||
if (is_array($records) && @sizeof($records) != 0) {
|
||||
|
||||
//get checked records
|
||||
foreach($records as $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['dashboard_uuid'])) {
|
||||
$uuids[] = "'".$record['dashboard_uuid']."'";
|
||||
}
|
||||
}
|
||||
|
||||
//create the array from existing data
|
||||
if (is_array($uuids) && @sizeof($uuids) != 0) {
|
||||
$sql = "select * from v_".$this->table." ";
|
||||
$sql .= "where dashboard_uuid in (".implode(', ', $uuids).") ";
|
||||
$database = new database;
|
||||
$rows = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
$x = 0;
|
||||
foreach ($rows as $row) {
|
||||
//copy data
|
||||
$array[$this->table][$x] = $row;
|
||||
|
||||
//add copy to the description
|
||||
$array[$this->table][$x][dashboard.'_uuid'] = uuid();
|
||||
$array[$this->table][$x][$this->description_field] = trim($row[$this->description_field]).' ('.$text['label-copy'].')';
|
||||
|
||||
//increment the id
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $rows, $row);
|
||||
}
|
||||
|
||||
//save the changes and set the message
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
//save the array
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->save($array);
|
||||
unset($array);
|
||||
|
||||
//set message
|
||||
message::add($text['message-copy']);
|
||||
}
|
||||
unset($records);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
90
core/dashboard/root.php
Normal file
90
core/dashboard/root.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?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) 2018
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
umask(2);
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if (strpos($_ENV["OS"], "Win") !== false) {
|
||||
define("PATH_SEPARATOR", ";");
|
||||
} else {
|
||||
define("PATH_SEPARATOR", ":");
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
|
||||
if(PHP_SAPI == 'cli'){
|
||||
chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
|
||||
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
|
||||
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
|
||||
if (file_exists('/project_root.php')) {
|
||||
$path = '/';
|
||||
} else {
|
||||
$i = 1;
|
||||
$path = '';
|
||||
while ($i < count($dirs)) {
|
||||
$path .= '/' . $dirs[$i];
|
||||
if (file_exists($path. '/project_root.php')) {
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$_SERVER["DOCUMENT_ROOT"] = $path;
|
||||
}else{
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
}
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
// try to detect if a project path is being used
|
||||
if (!defined('PROJECT_PATH')) {
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
|
||||
define('PROJECT_PATH', '/fusionpbx');
|
||||
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
|
||||
define('PROJECT_PATH', '');
|
||||
} else {
|
||||
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
|
||||
$i = 1;
|
||||
$path = $_SERVER["DOCUMENT_ROOT"];
|
||||
while ($i < count($dirs)) {
|
||||
$path .= '/' . $dirs[$i];
|
||||
if (file_exists($path. '/project_root.php')) {
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if(!file_exists($path. '/project_root.php')){
|
||||
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
|
||||
}
|
||||
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
|
||||
define('PROJECT_PATH', $project_path);
|
||||
}
|
||||
$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user