Files
fusionpbx/app/registrations/resources/dashboard/registrations.php
Alex e8681737dc Add ability to create multiple dashboards (#7483)
* Add ability to create multiple dashboards

* Create dashboard_widget_list.php

* Create dashboard_widget_edit.php

* Update dashboard_edit.php

* Update dashboard_config_json.php

* Update dashboard.php

* Update app_languages.php

* Update app_defaults.php

* Update app_config.php

* Update dashboard.php

* Create config.php

* Update content.php

* Update icon.php

* Update parent.php

* Update template.php

* Update config.php

* Update config.php

* Update domains.php

* Update config.php

* Update active_calls.php

* Update config.php

* Update config.php

* Update config.php

* Update config.php

* Update call_forward.php

* Update config.php

* Update config.php

* Update config.php

* Update config.php

* Update config.php

* Update domain_limits.php

* Update caller_id.php

* Update config.php

* Update config.php

* Update config.php

* Update config.php

* Update config.php

* Update registrations.php

* Update ring_group_forward.php

* Update config.php

* Update config.php

* Update switch_status.php

* Update config.php

* Update system_counts.php

* Update system_cpu_status.php

* Update system_disk_usage.php

* Update system_services.php

* Update system_status.php

* Update config.php

* Update config.php

* Update voicemails.php

* Update config.php

* Update missed_calls.php

* Update recent_calls.php

* Update dashboard_widget_edit.php

* Update app_languages.php

* Update dashboard_widget_edit.php

* Update index.php

* Update parent.php
2025-09-08 17:33:29 -06:00

68 lines
3.2 KiB
PHP

<?php
//includes files
require_once dirname(__DIR__, 4) . "/resources/require.php";
require_once "resources/check_auth.php";
//convert to a key
$widget_key = str_replace(' ', '_', strtolower($widget_name));
//add multi-lingual support
$language = new text;
$text = $language->get($_SESSION['domain']['language']['code'], dirname($widget_url));
//get the dashboard label
$widget_label = $text['title-'.$widget_key] ?? $widget_name;
//prepare variables
$widget_target = ($widget_target == 'new') ? '_blank' : '_self';
$window_parameters = '';
if (!empty($widget_width) && !empty($widget_height)) {
$window_parameters .= "width=".$widget_width.",height=".$widget_height;
}
//channel count
$esl = event_socket::create();
//registration count
if ($esl->is_connected() && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/registrations/")) {
$registration = new registrations;
if (permission_exists("registration_all")) {
$active_registrations = $registration->show = 'all';
}
$active_registrations = $registration->count();
}
//get the total enabled extensions
$sql = "select count(*) as count from v_extensions ";
$sql .= "where enabled = 'true' ";
$parameters = null;
if (!permission_exists("registration_all")) {
$sql .= "and domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
}
$sql .= "and extension_type = 'default'; ";
$row = $database->select($sql, $parameters, 'row');
$enabled_extensions = $row['count'];
unset($sql, $row);
//calculate the inactive extensions
$inactive_registrations = $enabled_extensions - $active_registrations;
//dashboard icon
echo "<div class='hud_box'>\n";
echo " <div class='hud_content' ".(empty($widget_details_state) || $widget_details_state != "disabled" ? "onclick=\"$('#hud_icon_details').slideToggle('fast');\"" : null).">\n";
echo " <span class='hud_title' onclick=\"window.open('".$widget_url."', '".$widget_target."', '".$window_parameters."')\">".escape($widget_label)."</span>";
echo " <div style='position: relative; display: inline-block;'>\n";
echo " <span class='hud_stat' onclick=\"window.open('".$widget_url."', '".$widget_target."', '".$window_parameters."')\"><i class=\"fas ".$widget_icon."\"></i></span>\n";
echo " <span style=\"background-color: ".(!empty($widget_number_background_color) ? $widget_number_background_color : '#5d5ce3')."; color: ".(!empty($widget_number_text_color) ? $widget_number_text_color : '#ffffff')."; font-size: 12px; font-weight: bold; text-align: center; position: absolute; top: 22px; left: 25px; padding: 2px 7px 1px 7px; border-radius: 10px; white-space: nowrap;\">".$active_registrations." / ".($active_registrations + $inactive_registrations)."</span>\n";
echo " </div>\n";
echo " </div>\n";
if (empty($widget_details_state) || $widget_details_state != "disabled") {
echo " <div class='hud_details hud_box' id='hud_icon_details' style='padding: 20px; 10%; overflow: auto; ".(!empty($row['widget_detail_background_color']) ? "background: ".$row['widget_detail_background_color'].";" : null)."'>".str_replace("\r", '<br>', escape($widget_content_details))."</div>\n";
}
echo " <span class='hud_expander' onclick=\"$('#hud_icon_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
echo "</div>\n";
?>