ソースを参照

Add a new dashboard

markjcrane 3 年 前
コミット
b8bf4c1d9f

+ 118 - 0
core/dashboard/app_config.php

@@ -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 - 0
core/dashboard/app_defaults.php

@@ -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 - 0
core/dashboard/app_languages.php

@@ -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 - 0
core/dashboard/app_menu.php

@@ -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 - 0
core/dashboard/dashboard.php

@@ -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 <[email protected]>
+	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'>&nbsp;</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 - 0
core/dashboard/dashboard_edit.php

@@ -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 <[email protected]>
+	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 - 0
core/dashboard/index.php

@@ -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 <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2021
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+
+//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>&nbsp; &nbsp;";
+	}
+	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>&nbsp;&nbsp;".$_SESSION['login']['message']['text']."&nbsp;&nbsp;(<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 - 0
core/dashboard/resources/classes/dashboard.php

@@ -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 <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2019 - 2021
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+
+/**
+ * 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 - 0
core/dashboard/root.php

@@ -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 <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2018
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+
+// 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"]);
+	}
+
+?>