Feature Codes (#7704)

* Add a report to show all feature codes
This commit is contained in:
frytimo
2026-01-20 21:00:58 -04:00
committed by GitHub
parent 180046824f
commit 239ef2665a
5 changed files with 603 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
<?php
//application details
$apps[$x]['name'] = "Feature Codes";
$apps[$x]['uuid'] = "f364d207-51cc-4d2c-9881-a9eeedb9b0dc";
$apps[$x]['category'] = "Switch";
$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'] = "View configured feature codes for the system.";
$apps[$x]['description']['en-gb'] = "View configured feature codes for the system.";
$apps[$x]['description']['ar-eg'] = "";
$apps[$x]['description']['de-at'] = "Zeigt die konfigurierten Funktionscodes für das System an.";
$apps[$x]['description']['de-ch'] = "";
$apps[$x]['description']['de-de'] = "Zeigt die konfigurierten Funktionscodes für das System an.";
$apps[$x]['description']['es-cl'] = "";
$apps[$x]['description']['es-mx'] = "";
$apps[$x]['description']['fr-ca'] = "";
$apps[$x]['description']['fr-fr'] = "Afficher les codes de fonctionnalités configurés pour le système.";
$apps[$x]['description']['he-il'] = "";
$apps[$x]['description']['it-it'] = "";
$apps[$x]['description']['nl-nl'] = "Bekijk geconfigureerde functiecodes voor het systeem.";
$apps[$x]['description']['pl-pl'] = "";
$apps[$x]['description']['pt-br'] = "";
$apps[$x]['description']['pt-pt'] = "";
$apps[$x]['description']['ro-ro'] = "";
$apps[$x]['description']['ru-ru'] = "";
$apps[$x]['description']['sv-se'] = "";
$apps[$x]['description']['uk-ua'] = "";
//permission details
$y = 0;
$apps[$x]['permissions'][$y]['name'] = "feature_codes_view";
$apps[$x]['permissions'][$y]['menu']['uuid'] = "2847398b-9e62-49bf-b965-a91c11c085e0";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "user";
$y++;
$apps[$x]['permissions'][$y]['name'] = "feature_codes_export";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "feature_codes_raw";
?>

View File

@@ -0,0 +1,237 @@
<?php
$text['title-feature_codes']['en-us'] = "Feature Codes";
$text['title-feature_codes']['en-gb'] = "Feature Codes";
$text['title-feature_codes']['ar-eg'] = "تقرير رموز الميزات";
$text['title-feature_codes']['de-at'] = "Funktionscodes Bericht";
$text['title-feature_codes']['de-ch'] = "Funktionscodes Bericht";
$text['title-feature_codes']['de-de'] = "Funktionscodes Bericht";
$text['title-feature_codes']['el-gr'] = "Αναφορά Κωδικών Λειτουργιών";
$text['title-feature_codes']['es-cl'] = "Informe de Códigos de Funciones";
$text['title-feature_codes']['es-mx'] = "Informe de Códigos de Funciones";
$text['title-feature_codes']['fr-ca'] = "Rapport des Codes de Fonctionnalités";
$text['title-feature_codes']['fr-fr'] = "Rapport des Codes de Fonctionnalités";
$text['title-feature_codes']['he-il'] = "דוח קודי תכונות";
$text['title-feature_codes']['it-it'] = "Rapporto Codici Funzione";
$text['title-feature_codes']['nl-nl'] = "Functiecodes Rapport";
$text['title-feature_codes']['pl-pl'] = "Raport Kodów Funkcji";
$text['title-feature_codes']['pt-br'] = "Relatório de Códigos de Recursos";
$text['title-feature_codes']['pt-pt'] = "Relatório de Códigos de Funcionalidades";
$text['title-feature_codes']['ro-ro'] = "Raport Coduri de Funcții";
$text['title-feature_codes']['ru-ru'] = "Отчет о кодах функций";
$text['title-feature_codes']['sv-se'] = "Funktionskoder Rapport";
$text['title-feature_codes']['uk-ua'] = "Звіт про коди функцій";
$text['title-feature_codes']['tr-tr'] = "Özellik Kodları Raporu";
$text['title-feature_codes']['zh-cn'] = "功能代码报告";
$text['title-feature_codes']['ja-jp'] = "機能コードレポート";
$text['title-feature_codes']['ko-kr'] = "기능 코드 보고서";
$text['description-feature_codes']['en-us'] = "List of feature codes (star codes) available for dialing.";
$text['description-feature_codes']['en-gb'] = "List of feature codes (star codes) available for dialing.";
$text['description-feature_codes']['ar-eg'] = "قائمة رموز الميزات (رموز النجمة) المتاحة للاتصال.";
$text['description-feature_codes']['de-at'] = "Liste der verfügbaren Funktionscodes (Sterncodes) zum Wählen.";
$text['description-feature_codes']['de-ch'] = "Liste der verfügbaren Funktionscodes (Sterncodes) zum Wählen.";
$text['description-feature_codes']['de-de'] = "Liste der verfügbaren Funktionscodes (Sterncodes) zum Wählen.";
$text['description-feature_codes']['el-gr'] = "Λίστα κωδικών λειτουργιών (κωδικοί αστεριού) διαθέσιμων για κλήση.";
$text['description-feature_codes']['es-cl'] = "Lista de códigos de funciones (códigos de asterisco) disponibles para marcar.";
$text['description-feature_codes']['es-mx'] = "Lista de códigos de funciones (códigos de asterisco) disponibles para marcar.";
$text['description-feature_codes']['fr-ca'] = "Liste des codes de fonctionnalités (codes étoile) disponibles pour la numérotation.";
$text['description-feature_codes']['fr-fr'] = "Liste des codes de fonctionnalités (codes étoile) disponibles pour la numérotation.";
$text['description-feature_codes']['he-il'] = "רשימת קודי תכונות (קודי כוכבית) זמינים לחיוג.";
$text['description-feature_codes']['it-it'] = "Elenco dei codici funzione (codici asterisco) disponibili per la composizione.";
$text['description-feature_codes']['nl-nl'] = "Lijst met beschikbare functiecodes (stercodes) om te bellen.";
$text['description-feature_codes']['pl-pl'] = "Lista kodów funkcji (kodów gwiazdkowych) dostępnych do wybierania.";
$text['description-feature_codes']['pt-br'] = "Lista de códigos de recursos (códigos de estrela) disponíveis para discagem.";
$text['description-feature_codes']['pt-pt'] = "Lista de códigos de funcionalidades (códigos de estrela) disponíveis para marcação.";
$text['description-feature_codes']['ro-ro'] = "Lista codurilor de funcții (coduri stea) disponibile pentru apelare.";
$text['description-feature_codes']['ru-ru'] = "Список кодов функций (звездочных кодов), доступных для набора.";
$text['description-feature_codes']['sv-se'] = "Lista över funktionskoder (stjärnkoder) tillgängliga för uppringning.";
$text['description-feature_codes']['uk-ua'] = "Список кодів функцій (зіркові коди), доступних для набору.";
$text['description-feature_codes']['tr-tr'] = "Arama için mevcut özellik kodlarının (yıldız kodları) listesi.";
$text['description-feature_codes']['zh-cn'] = "可供拨打的功能代码(星号代码)列表。";
$text['description-feature_codes']['ja-jp'] = "ダイヤル可能な機能コード(スターコード)のリスト。";
$text['description-feature_codes']['ko-kr'] = "전화 걸기에 사용할 수 있는 기능 코드(별표 코드) 목록.";
$text['label-feature_code']['en-us'] = "Feature Code";
$text['label-feature_code']['en-gb'] = "Feature Code";
$text['label-feature_code']['ar-eg'] = "رمز الميزة";
$text['label-feature_code']['de-at'] = "Funktionscode";
$text['label-feature_code']['de-ch'] = "Funktionscode";
$text['label-feature_code']['de-de'] = "Funktionscode";
$text['label-feature_code']['el-gr'] = "Κωδικός Λειτουργίας";
$text['label-feature_code']['es-cl'] = "Código de Función";
$text['label-feature_code']['es-mx'] = "Código de Función";
$text['label-feature_code']['fr-ca'] = "Code de Fonctionnalité";
$text['label-feature_code']['fr-fr'] = "Code de Fonctionnalité";
$text['label-feature_code']['he-il'] = "קוד תכונה";
$text['label-feature_code']['it-it'] = "Codice Funzione";
$text['label-feature_code']['nl-nl'] = "Functiecode";
$text['label-feature_code']['pl-pl'] = "Kod funkcji";
$text['label-feature_code']['pt-br'] = "Código de Recurso";
$text['label-feature_code']['pt-pt'] = "Código de Funcionalidade";
$text['label-feature_code']['ro-ro'] = "Cod de Funcție";
$text['label-feature_code']['ru-ru'] = "Код функции";
$text['label-feature_code']['sv-se'] = "Funktionskod";
$text['label-feature_code']['uk-ua'] = "Код функції";
$text['label-feature_code']['tr-tr'] = "Özellik Kodu";
$text['label-feature_code']['zh-cn'] = "功能代码";
$text['label-feature_code']['ja-jp'] = "機能コード";
$text['label-feature_code']['ko-kr'] = "기능 코드";
$text['label-feature_name']['en-us'] = "Name";
$text['label-feature_name']['en-gb'] = "Name";
$text['label-feature_name']['ar-eg'] = "الاسم";
$text['label-feature_name']['de-at'] = "Name";
$text['label-feature_name']['de-ch'] = "Name";
$text['label-feature_name']['de-de'] = "Name";
$text['label-feature_name']['el-gr'] = "Όνομα";
$text['label-feature_name']['es-cl'] = "Nombre";
$text['label-feature_name']['es-mx'] = "Nombre";
$text['label-feature_name']['fr-ca'] = "Nom";
$text['label-feature_name']['fr-fr'] = "Nom";
$text['label-feature_name']['he-il'] = "שם";
$text['label-feature_name']['it-it'] = "Nome";
$text['label-feature_name']['nl-nl'] = "Naam";
$text['label-feature_name']['pl-pl'] = "Nazwa";
$text['label-feature_name']['pt-br'] = "Nome";
$text['label-feature_name']['pt-pt'] = "Nome";
$text['label-feature_name']['ro-ro'] = "Nume";
$text['label-feature_name']['ru-ru'] = "Название";
$text['label-feature_name']['sv-se'] = "Namn";
$text['label-feature_name']['uk-ua'] = "Назва";
$text['label-feature_name']['tr-tr'] = "Ad";
$text['label-feature_name']['zh-cn'] = "名称";
$text['label-feature_name']['ja-jp'] = "名前";
$text['label-feature_name']['ko-kr'] = "이름";
$text['label-description']['en-us'] = "Description";
$text['label-description']['en-gb'] = "Description";
$text['label-description']['ar-eg'] = "الوصف";
$text['label-description']['de-at'] = "Beschreibung";
$text['label-description']['de-ch'] = "Beschreibung";
$text['label-description']['de-de'] = "Beschreibung";
$text['label-description']['el-gr'] = "Περιγραφή";
$text['label-description']['es-cl'] = "Descripción";
$text['label-description']['es-mx'] = "Descripción";
$text['label-description']['fr-ca'] = "Description";
$text['label-description']['fr-fr'] = "Description";
$text['label-description']['he-il'] = "תיאור";
$text['label-description']['it-it'] = "Descrizione";
$text['label-description']['nl-nl'] = "Beschrijving";
$text['label-description']['pl-pl'] = "Opis";
$text['label-description']['pt-br'] = "Descrição";
$text['label-description']['pt-pt'] = "Descrição";
$text['label-description']['ro-ro'] = "Descriere";
$text['label-description']['ru-ru'] = "Описание";
$text['label-description']['sv-se'] = "Beskrivning";
$text['label-description']['uk-ua'] = "Опис";
$text['label-description']['tr-tr'] = "ıklama";
$text['label-description']['zh-cn'] = "描述";
$text['label-description']['ja-jp'] = "説明";
$text['label-description']['ko-kr'] = "설명";
$text['label-raw_dialplan']['en-us'] = "Raw Dialplan";
$text['label-raw_dialplan']['en-gb'] = "Raw Dialplan";
$text['label-raw_dialplan']['ar-eg'] = "خطة الاتصال الخام";
$text['label-raw_dialplan']['de-at'] = "Roher Wählplan";
$text['label-raw_dialplan']['de-ch'] = "Roher Wählplan";
$text['label-raw_dialplan']['de-de'] = "Roher Wählplan";
$text['label-raw_dialplan']['el-gr'] = "Ακατέργαστο Dialplan";
$text['label-raw_dialplan']['es-cl'] = "Plan de Marcado Sin Procesar";
$text['label-raw_dialplan']['es-mx'] = "Plan de Marcado Sin Procesar";
$text['label-raw_dialplan']['fr-ca'] = "Plan de Numérotation Brut";
$text['label-raw_dialplan']['fr-fr'] = "Plan de Numérotation Brut";
$text['label-raw_dialplan']['he-il'] = "תוכנית חיוג גולמית";
$text['label-raw_dialplan']['it-it'] = "Dialplan Grezzo";
$text['label-raw_dialplan']['nl-nl'] = "Onbewerkt Dialplan";
$text['label-raw_dialplan']['pl-pl'] = "Surowy Plan Wybierania";
$text['label-raw_dialplan']['pt-br'] = "Plano de Discagem Bruto";
$text['label-raw_dialplan']['pt-pt'] = "Plano de Marcação em Bruto";
$text['label-raw_dialplan']['ro-ro'] = "Dialplan Brut";
$text['label-raw_dialplan']['ru-ru'] = "Сырой диалплан";
$text['label-raw_dialplan']['sv-se'] = "Rå Nummerplan";
$text['label-raw_dialplan']['uk-ua'] = "Сирий діалплан";
$text['label-raw_dialplan']['tr-tr'] = "Ham Arama Planı";
$text['label-raw_dialplan']['zh-cn'] = "原始拨号计划";
$text['label-raw_dialplan']['ja-jp'] = "生のダイヤルプラン";
$text['label-raw_dialplan']['ko-kr'] = "원시 다이얼플랜";
$text['label-format']['en-us'] = "Format";
$text['label-format']['en-gb'] = "Format";
$text['label-format']['ar-eg'] = "الصيغة";
$text['label-format']['de-at'] = "Format";
$text['label-format']['de-ch'] = "Format";
$text['label-format']['de-de'] = "Format";
$text['label-format']['el-gr'] = "Μορφή";
$text['label-format']['es-cl'] = "Formato";
$text['label-format']['es-mx'] = "Formato";
$text['label-format']['fr-ca'] = "Format";
$text['label-format']['fr-fr'] = "Format";
$text['label-format']['he-il'] = "פורמט";
$text['label-format']['it-it'] = "Formato";
$text['label-format']['nl-nl'] = "Formaat";
$text['label-format']['pl-pl'] = "Format";
$text['label-format']['pt-br'] = "Formato";
$text['label-format']['pt-pt'] = "Formato";
$text['label-format']['ro-ro'] = "Format";
$text['label-format']['ru-ru'] = "Формат";
$text['label-format']['sv-se'] = "Format";
$text['label-format']['uk-ua'] = "Формат";
$text['label-format']['tr-tr'] = "Biçim";
$text['label-format']['zh-cn'] = "格式";
$text['label-format']['ja-jp'] = "フォーマット";
$text['label-format']['ko-kr'] = "형식";
$text['button-export']['en-us'] = "Export";
$text['button-export']['en-gb'] = "Export";
$text['button-export']['ar-eg'] = "تصدير";
$text['button-export']['de-at'] = "Exportieren";
$text['button-export']['de-ch'] = "Exportieren";
$text['button-export']['de-de'] = "Exportieren";
$text['button-export']['el-gr'] = "Εξαγωγή";
$text['button-export']['es-cl'] = "Exportar";
$text['button-export']['es-mx'] = "Exportar";
$text['button-export']['fr-ca'] = "Exporter";
$text['button-export']['fr-fr'] = "Exporter";
$text['button-export']['he-il'] = "ייצוא";
$text['button-export']['it-it'] = "Esporta";
$text['button-export']['nl-nl'] = "Exporteren";
$text['button-export']['pl-pl'] = "Eksportuj";
$text['button-export']['pt-br'] = "Exportar";
$text['button-export']['pt-pt'] = "Exportar";
$text['button-export']['ro-ro'] = "Exportă";
$text['button-export']['ru-ru'] = "Экспорт";
$text['button-export']['sv-se'] = "Exportera";
$text['button-export']['uk-ua'] = "Експорт";
$text['button-export']['tr-tr'] = "Dışa Aktar";
$text['button-export']['zh-cn'] = "导出";
$text['button-export']['ja-jp'] = "エクスポート";
$text['button-export']['ko-kr'] = "내보내기";
$text['label-no_features']['en-us'] = "No feature codes found.";
$text['label-no_features']['en-gb'] = "No feature codes found.";
$text['label-no_features']['ar-eg'] = "لم يتم العثور على رموز الميزات.";
$text['label-no_features']['de-at'] = "Keine Funktionscodes gefunden.";
$text['label-no_features']['de-ch'] = "Keine Funktionscodes gefunden.";
$text['label-no_features']['de-de'] = "Keine Funktionscodes gefunden.";
$text['label-no_features']['el-gr'] = "Δεν βρέθηκαν κωδικοί λειτουργιών.";
$text['label-no_features']['es-cl'] = "No se encontraron códigos de funciones.";
$text['label-no_features']['es-mx'] = "No se encontraron códigos de funciones.";
$text['label-no_features']['fr-ca'] = "Aucun code de fonctionnalité trouvé.";
$text['label-no_features']['fr-fr'] = "Aucun code de fonctionnalité trouvé.";
$text['label-no_features']['he-il'] = "לא נמצאו קודי תכונות.";
$text['label-no_features']['it-it'] = "Nessun codice funzione trovato.";
$text['label-no_features']['nl-nl'] = "Geen functiecodes gevonden.";
$text['label-no_features']['pl-pl'] = "Nie znaleziono kodów funkcji.";
$text['label-no_features']['pt-br'] = "Nenhum código de recurso encontrado.";
$text['label-no_features']['pt-pt'] = "Nenhum código de funcionalidade encontrado.";
$text['label-no_features']['ro-ro'] = "Nu au fost găsite coduri de funcții.";
$text['label-no_features']['ru-ru'] = "Коды функций не найдены.";
$text['label-no_features']['sv-se'] = "Inga funktionskoder hittades.";
$text['label-no_features']['uk-ua'] = "Коди функцій не знайдено.";
$text['label-no_features']['tr-tr'] = "Özellik kodu bulunamadı.";
$text['label-no_features']['zh-cn'] = "未找到功能代码。";
$text['label-no_features']['ja-jp'] = "機能コードが見つかりません。";
$text['label-no_features']['ko-kr'] = "기능 코드를 찾을 수 없습니다.";
?>

View File

@@ -0,0 +1,39 @@
<?php
$y=0;
$apps[$x]['menu'][$y]['title']['en-us'] = "Feature Codes";
$apps[$x]['menu'][$y]['title']['en-gb'] = "Feature Codes";
$apps[$x]['menu'][$y]['title']['ar-eg'] = "تقرير رموز الميزات";
$apps[$x]['menu'][$y]['title']['de-at'] = "Funktionscodes Bericht";
$apps[$x]['menu'][$y]['title']['de-ch'] = "Funktionscodes Bericht";
$apps[$x]['menu'][$y]['title']['de-de'] = "Funktionscodes Bericht";
$apps[$x]['menu'][$y]['title']['el-gr'] = "Αναφορά Κωδικών Λειτουργιών";
$apps[$x]['menu'][$y]['title']['es-cl'] = "Informe de Códigos de Funciones";
$apps[$x]['menu'][$y]['title']['es-mx'] = "Informe de Códigos de Funciones";
$apps[$x]['menu'][$y]['title']['fr-ca'] = "Rapport des Codes de Fonctionnalités";
$apps[$x]['menu'][$y]['title']['fr-fr'] = "Rapport des Codes de Fonctionnalités";
$apps[$x]['menu'][$y]['title']['he-il'] = "דוח קודי תכונות";
$apps[$x]['menu'][$y]['title']['it-it'] = "Rapporto Codici Funzione";
$apps[$x]['menu'][$y]['title']['ka-ge'] = "ფუნქციების კოდების ანგარიში";
$apps[$x]['menu'][$y]['title']['nl-nl'] = "Functiecodes Rapport";
$apps[$x]['menu'][$y]['title']['pl-pl'] = "Raport Kodów Funkcji";
$apps[$x]['menu'][$y]['title']['pt-br'] = "Relatório de Códigos de Recursos";
$apps[$x]['menu'][$y]['title']['pt-pt'] = "Relatório de Códigos de Funcionalidades";
$apps[$x]['menu'][$y]['title']['ro-ro'] = "Raport Coduri de Funcții";
$apps[$x]['menu'][$y]['title']['ru-ru'] = "Отчет о кодах функций";
$apps[$x]['menu'][$y]['title']['sv-se'] = "Funktionskoder Rapport";
$apps[$x]['menu'][$y]['title']['uk-ua'] = "Звіт про коди функцій";
$apps[$x]['menu'][$y]['title']['tr-tr'] = "Özellik Kodları Raporu";
$apps[$x]['menu'][$y]['title']['zh-cn'] = "功能代码报告";
$apps[$x]['menu'][$y]['title']['ja-jp'] = "機能コードレポート";
$apps[$x]['menu'][$y]['title']['ko-kr'] = "기능 코드 보고서";
$apps[$x]['menu'][$y]['uuid'] = "249d45a0-d414-4fe7-b652-d3f8834024b1";
$apps[$x]['menu'][$y]['parent_uuid'] = "0438b504-8613-7887-c420-c837ffb20cb1";
$apps[$x]['menu'][$y]['category'] = "internal";
$apps[$x]['menu'][$y]['icon'] = "";
$apps[$x]['menu'][$y]['path'] = "/app/feature_codes/feature_codes.php";
$apps[$x]['menu'][$y]['order'] = "";
$apps[$x]['menu'][$y]['groups'][] = "admin";
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
$apps[$x]['menu'][$y]['groups'][] = "manager";
$apps[$x]['menu'][$y]['groups'][] = "user";

View File

@@ -0,0 +1,218 @@
<?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-2026
the Initial Developer. All Rights Reserved.
*/
//includes files
require_once dirname(__DIR__, 2) . "/resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (!permission_exists('feature_codes_view')) {
echo "access denied";
exit;
}
//function to format feature name for display
function format_feature_name($name) {
//replace underscores and hyphens with spaces
$name = str_replace(array('_', '-'), ' ', $name);
//capitalize each word
$name = ucwords($name);
return $name;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get globals
global $database, $settings;
//backwards compatibility
if (!isset($database) || !($database instanceof database)) {
$database = database::new();
}
if (!isset($settings) || !($settings instanceof settings)) {
$settings = new settings(['database' => $database, 'domain_uuid' => $domain_uuid ?? $_SESSION['domain_uuid'] ?? '', 'user_uuid' => $user_uuid ?? $_SESSION['user_uuid'] ?? '']);
}
//get order and order by
$order_by = $_GET["order_by"] ?? '';
$order = $_GET["order"] ?? '';
//get feature codes from dialplans
$sql = "SELECT dialplan_uuid, dialplan_name, dialplan_number, dialplan_description ";
if (permission_exists('feature_codes_raw')) {
$sql .= ", dialplan_xml ";
}
$sql .= "FROM v_dialplans ";
$sql .= "WHERE dialplan_enabled = 'true' ";
$sql .= "AND dialplan_number LIKE '*%' ";
$sql .= "AND (domain_uuid = :domain_uuid OR domain_uuid IS NULL) ";
$sql .= order_by($order_by, $order, 'dialplan_number', 'asc');
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$features = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//handle PDF export
if (isset($_GET['export']) && $_GET['export'] == 'pdf' && permission_exists('feature_codes_export')) {
//include fpdf
require_once "resources/fpdf/fpdf.php";
//create pdf
$pdf = new FPDF('P', 'mm', 'A4');
$pdf->SetAutoPageBreak(true, 15);
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 16);
//title
$pdf->Cell(0, 10, $text['title-feature_codes'], 0, 1, 'C');
$pdf->Ln(5);
//table header
$pdf->SetFont('Arial', 'B', 10);
$pdf->SetFillColor(240, 240, 240);
if (permission_exists('feature_codes_raw')) {
$pdf->Cell(30, 8, $text['label-feature_code'], 1, 0, 'L', true);
$pdf->Cell(50, 8, $text['label-feature_name'], 1, 0, 'L', true);
$pdf->Cell(50, 8, $text['label-description'], 1, 0, 'L', true);
$pdf->Cell(60, 8, $text['label-raw_dialplan'], 1, 1, 'L', true);
}
else {
$pdf->Cell(40, 8, $text['label-feature_code'], 1, 0, 'L', true);
$pdf->Cell(60, 8, $text['label-feature_name'], 1, 0, 'L', true);
$pdf->Cell(90, 8, $text['label-description'], 1, 1, 'L', true);
}
//table rows
$pdf->SetFont('Arial', '', 9);
if (is_array($features) && count($features) > 0) {
foreach ($features as $row) {
$feature_code = $row['dialplan_number'];
$feature_name = format_feature_name($row['dialplan_name']);
$feature_description = $row['dialplan_description'];
if (permission_exists('feature_codes_raw')) {
$raw_value = isset($row['dialplan_xml']) ? substr($row['dialplan_xml'], 0, 50) : '';
if (strlen($row['dialplan_xml']) > 50) {
$raw_value .= '...';
}
$pdf->Cell(30, 7, $feature_code, 1, 0, 'L');
$pdf->Cell(50, 7, substr($feature_name, 0, 30), 1, 0, 'L');
$pdf->Cell(50, 7, substr($feature_description, 0, 30), 1, 0, 'L');
$pdf->Cell(60, 7, $raw_value, 1, 1, 'L');
}
else {
$pdf->Cell(40, 7, $feature_code, 1, 0, 'L');
$pdf->Cell(60, 7, substr($feature_name, 0, 35), 1, 0, 'L');
$pdf->Cell(90, 7, substr($feature_description, 0, 55), 1, 1, 'L');
}
}
}
else {
$col_span = permission_exists('feature_codes_raw') ? 190 : 190;
$pdf->Cell($col_span, 7, $text['label-no_features'], 1, 1, 'C');
}
//output pdf
$pdf->Output('feature_codes_' . date('Y-m-d') . '.pdf', 'D');
exit;
}
//include header
$document['title'] = $text['title-feature_codes'];
require_once "resources/header.php";
//javascript to toggle export select box
echo "<script language='javascript' type='text/javascript'>";
echo " var fade_speed = 400;";
echo " function toggle_select(select_id) {";
echo " $('#'+select_id).fadeToggle(fade_speed, function() {";
echo " document.getElementById(select_id).selectedIndex = 0;";
echo " document.getElementById(select_id).focus();";
echo " });";
echo " }";
echo "</script>";
//content
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title-feature_codes']."</b></div>\n";
echo " <div class='actions'>\n";
if (permission_exists('feature_codes_export')) {
echo button::create(array('type'=>'button','label'=>$text['button-export'],'icon'=>$settings->get('theme', 'button_icon_export'),'onclick'=>"toggle_select('export_format'); this.blur();"));
echo " <select class='formfld' style='display: none; width: auto;' name='export_format' id='export_format' onchange=\"toggle_select('export_format'); window.location.href='feature_codes.php?export=' + this.value;\">\n";
echo " <option value='' disabled='disabled' selected='selected'>".$text['label-format']."</option>\n";
echo " <option value='pdf'>PDF</option>\n";
echo " </select>\n";
}
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo $text['description-feature_codes']."\n";
echo "<br /><br />\n";
echo "<div class='card'>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
echo th_order_by('dialplan_number', $text['label-feature_code'], $order_by, $order);
echo th_order_by('dialplan_name', $text['label-feature_name'], $order_by, $order);
echo " <th class='hide-sm-dn'>".$text['label-description']."</th>\n";
if (permission_exists('feature_codes_raw')) {
echo " <th class='hide-sm-dn'>".$text['label-raw_dialplan']."</th>\n";
}
echo "</tr>\n";
if (is_array($features) && count($features) > 0) {
foreach ($features as $row) {
echo "<tr class='list-row'>\n";
echo " <td>".escape($row['dialplan_number'])."</td>\n";
echo " <td>".escape(format_feature_name($row['dialplan_name']))."</td>\n";
echo " <td class='description hide-sm-dn'>".escape($row['dialplan_description'])."</td>\n";
if (permission_exists('feature_codes_raw')) {
$raw_display = isset($row['dialplan_xml']) ? htmlspecialchars(substr($row['dialplan_xml'], 0, 100)) : '';
if (isset($row['dialplan_xml']) && strlen($row['dialplan_xml']) > 100) {
$raw_display .= '...';
}
echo " <td class='description hide-sm-dn'><code>".$raw_display."</code></td>\n";
}
echo "</tr>\n";
}
}
else {
$colspan = permission_exists('feature_codes_raw') ? 4 : 3;
echo "<tr class='list-row'>\n";
echo " <td colspan='".$colspan."' style='text-align: center;'>".$text['label-no_features']."</td>\n";
echo "</tr>\n";
}
echo "</table>\n";
echo "</div>\n";
//include footer
require_once "resources/footer.php";
?>

View File

@@ -0,0 +1,63 @@
<?php
class feature_codes {
const app_name = 'feature_codes';
const app_uuid = '7a39c83a-f3f2-4774-8732-8d839758aa47';
const app_category = 'reports';
const app_subcategory = '';
const app_version = '1.0.0';
const app_description = 'This application provides a report of all features and their status.';
/**
* Set in the constructor. Must be a database object and cannot be null.
* @var database Database Object
*/
private $database;
/**
* Settings object set in the constructor. Must be a settings object and cannot be null.
* @var settings Settings Object
*/
private $settings;
/**
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
* @var string
*/
private $user_uuid;
/**
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
* @var string
*/
private $domain_uuid;
/**
* Initializes the object with settings and default values.
*
* @param array $setting_array Associative array of setting keys to their respective values (optional)
*/
public function __construct(array $setting_array = []) {
//set domain and user UUIDs
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
//set objects
$config = $setting_array['config'] ?? config::load();
$this->database = $setting_array['database'] ?? database::new(['config' => $config]);
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
}
public function get_name() {
return 'Features Report';
}
public function display(): void {
echo $this->render();
return;
}
public function render(): string {
return "Features Report";
}
}