Selaa lähdekoodia

Added message summary menu option

Anthony Ricci 6 kuukautta sitten
vanhempi
commit
c72cc1b789
5 muutettua tiedostoa jossa 703 lisäystä ja 61 poistoa
  1. 6 0
      app_config.php
  2. 243 23
      app_languages.php
  3. 61 31
      app_menu.php
  4. 228 0
      message_summary.php
  5. 165 7
      resources/classes/messages.php

+ 6 - 0
app_config.php

@@ -45,6 +45,12 @@
 		$apps[$x]['permissions'][$y]['name'] = 'message_key';
 		//$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
 		$y++;
+		$apps[$x]['permissions'][$y]['name'] = 'message_summary_all';
+		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
+		$y++;
+		$apps[$x]['permissions'][$y]['name'] = 'message_search';
+		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
+		$y++;
 
 	//default settings
 		$y=0;

+ 243 - 23
app_languages.php

@@ -167,29 +167,6 @@
 		$text['label-mms']['ja-jp'] = 'MMS';
 		$text['label-mms']['ko-kr'] = 'MMS';
 
-		$text['label-sms']['en-us'] = 'SMS';
-		$text['label-sms']['en-gb'] = 'SMS';
-		$text['label-sms']['ar-eg'] = 'SMS';
-		$text['label-sms']['de-at'] = 'SMS';
-		$text['label-sms']['de-ch'] = 'SMS';
-		$text['label-sms']['de-de'] = 'SMS';
-		$text['label-sms']['es-mx'] = 'SMS';
-		$text['label-sms']['fr-ca'] = 'SMS';
-		$text['label-sms']['fr-fr'] = 'SMS';
-		$text['label-sms']['he-il'] = 'SMS';
-		$text['label-sms']['it-it'] = 'SMS';
-		$text['label-sms']['nl-nl'] = 'SMS';
-		$text['label-sms']['pl-pl'] = 'SMS';
-		$text['label-sms']['pt-br'] = 'SMS';
-		$text['label-sms']['pt-pt'] = 'SMS';
-		$text['label-sms']['ro-ro'] = 'SMS';
-		$text['label-sms']['ru-ru'] = 'SMS';
-		$text['label-sms']['sv-se'] = 'SMS';
-		$text['label-sms']['uk-ua'] = 'SMS';
-		$text['label-sms']['zh-cn'] = 'SMS';
-		$text['label-sms']['ja-jp'] = 'SMS';
-		$text['label-sms']['ko-kr'] = 'SMS';
-
 		$text['label-sip']['en-us'] = 'SIP';
 		$text['label-sip']['en-gb'] = 'SIP';
 		$text['label-sip']['ar-eg'] = 'SIP';
@@ -1021,6 +998,249 @@
 		$text['label-send_email']['ja-jp'] = 'メールを送る';
 		$text['label-send_email']['ko-kr'] = '이메일을 보내';
 
+		$text['title-message_summary']['en-us'] = "Message Summary";
+		$text['title-message_summary']['en-gb'] = "Message Summary";
+		$text['title-message_summary']['ar-eg'] = "ملخص الرسالة";
+		$text['title-message_summary']['de-at'] = "Nachrichtenzusammenfassung";
+		$text['title-message_summary']['de-ch'] = "Nachrichtenzusammenfassung";
+		$text['title-message_summary']['de-de'] = "Nachrichtenzusammenfassung";
+		$text['title-message_summary']['el-gr'] = "Περίληψη μηνύματος";
+		$text['title-message_summary']['es-cl'] = "Resumen del mensaje";
+		$text['title-message_summary']['es-mx'] = "Resumen del mensaje";
+		$text['title-message_summary']['fr-ca'] = "Résumé du message";
+		$text['title-message_summary']['fr-fr'] = "Résumé du message";
+		$text['title-message_summary']['he-il'] = "סיכום הודעה";
+		$text['title-message_summary']['it-it'] = "Riepilogo del messaggio";
+		$text['title-message_summary']['ka-ge'] = "შეტყობინების შეჯამება";
+		$text['title-message_summary']['nl-nl'] = "Berichtsamenvatting";
+		$text['title-message_summary']['pl-pl'] = "Podsumowanie wiadomości";
+		$text['title-message_summary']['pt-br'] = "Resumo da mensagem";
+		$text['title-message_summary']['pt-pt'] = "Resumo da mensagem";
+		$text['title-message_summary']['ro-ro'] = "Sumar mesaj";
+		$text['title-message_summary']['ru-ru'] = "Сводка сообщения";
+		$text['title-message_summary']['sv-se'] = "Meddelandesammanfattning";
+		$text['title-message_summary']['uk-ua'] = "Резюме повідомлення";
+		$text['title-message_summary']['tr-tr'] = "Mesaj Özeti";
+		$text['title-message_summary']['zh-cn'] = "消息摘要";
+		$text['title-message_summary']['ja-jp'] = "メッセージの概要";
+		$text['title-message_summary']['ko-kr'] = "메시지 요약";
+
+		$text['label-message_destination']['en-us'] = "Destination";
+		$text['label-message_destination']['en-gb'] = "Destination";
+		$text['label-message_destination']['ar-eg'] = "الوجهة";
+		$text['label-message_destination']['de-at'] = "Ziel";
+		$text['label-message_destination']['de-ch'] = "Ziel";
+		$text['label-message_destination']['de-de'] = "Ziel";
+		$text['label-message_destination']['el-gr'] = "Προορισμός";
+		$text['label-message_destination']['es-cl'] = "Destino";
+		$text['label-message_destination']['es-mx'] = "Destino";
+		$text['label-message_destination']['fr-ca'] = "Destination";
+		$text['label-message_destination']['fr-fr'] = "Destination";
+		$text['label-message_destination']['he-il'] = "יעד";
+		$text['label-message_destination']['it-it'] = "Destinazione";
+		$text['label-message_destination']['ka-ge'] = "მიზანი";
+		$text['label-message_destination']['nl-nl'] = "Bestemming";
+		$text['label-message_destination']['pl-pl'] = "Cel";
+		$text['label-message_destination']['pt-br'] = "Destino";
+		$text['label-message_destination']['pt-pt'] = "Destino";
+		$text['label-message_destination']['ro-ro'] = "Destinație";
+		$text['label-message_destination']['ru-ru'] = "Назначение";
+		$text['label-message_destination']['sv-se'] = "Destination";
+		$text['label-message_destination']['uk-ua'] = "Призначення";
+		$text['label-message_destination']['tr-tr'] = "Hedef";
+		$text['label-message_destination']['zh-cn'] = "目的地";
+		$text['label-message_destination']['ja-jp'] = "宛先";
+		$text['label-message_destination']['ko-kr'] = "목적지";
+
+		$text['label-message_read']['en-us'] = "Read";
+		$text['label-message_read']['en-gb'] = "Read";
+		$text['label-message_read']['ar-eg'] = "مقروء";
+		$text['label-message_read']['de-at'] = "Gelesen";
+		$text['label-message_read']['de-ch'] = "Gelesen";
+		$text['label-message_read']['de-de'] = "Gelesen";
+		$text['label-message_read']['el-gr'] = "Διαβασμένο";
+		$text['label-message_read']['es-cl'] = "Leído";
+		$text['label-message_read']['es-mx'] = "Leído";
+		$text['label-message_read']['fr-ca'] = "Lu";
+		$text['label-message_read']['fr-fr'] = "Lu";
+		$text['label-message_read']['he-il'] = "נקרא";
+		$text['label-message_read']['it-it'] = "Letto";
+		$text['label-message_read']['ka-ge'] = "წაიკითხა";
+		$text['label-message_read']['nl-nl'] = "Gelezen";
+		$text['label-message_read']['pl-pl'] = "Przeczytane";
+		$text['label-message_read']['pt-br'] = "Lido";
+		$text['label-message_read']['pt-pt'] = "Lido";
+		$text['label-message_read']['ro-ro'] = "Citit";
+		$text['label-message_read']['ru-ru'] = "Прочитано";
+		$text['label-message_read']['sv-se'] = "Läst";
+		$text['label-message_read']['uk-ua'] = "Прочитано";
+		$text['label-message_read']['tr-tr'] = "Okunmuş";
+		$text['label-message_read']['zh-cn'] = "已读";
+		$text['label-message_read']['ja-jp'] = "読了";
+		$text['label-message_read']['ko-kr'] = "읽음";
+		
+		$text['label-message_unread']['en-us'] = "Unread";
+		$text['label-message_unread']['en-gb'] = "Unread";
+		$text['label-message_unread']['ar-eg'] = "غير مقروء";
+		$text['label-message_unread']['de-at'] = "Ungelesen";
+		$text['label-message_unread']['de-ch'] = "Ungelesen";
+		$text['label-message_unread']['de-de'] = "Ungelesen";
+		$text['label-message_unread']['el-gr'] = "Αδιάβαστο";
+		$text['label-message_unread']['es-cl'] = "No leído";
+		$text['label-message_unread']['es-mx'] = "No leído";
+		$text['label-message_unread']['fr-ca'] = "Non lu";
+		$text['label-message_unread']['fr-fr'] = "Non lu";
+		$text['label-message_unread']['he-il'] = "לא נקרא";
+		$text['label-message_unread']['it-it'] = "Non letto";
+		$text['label-message_unread']['ka-ge'] = "უკითხავი";
+		$text['label-message_unread']['nl-nl'] = "Ongelezen";
+		$text['label-message_unread']['pl-pl'] = "Nieprzeczytane";
+		$text['label-message_unread']['pt-br'] = "Não lido";
+		$text['label-message_unread']['pt-pt'] = "Não lido";
+		$text['label-message_unread']['ro-ro'] = "Necitit";
+		$text['label-message_unread']['ru-ru'] = "Не прочитано";
+		$text['label-message_unread']['sv-se'] = "Oläst";
+		$text['label-message_unread']['uk-ua'] = "Непрочитано";
+		$text['label-message_unread']['tr-tr'] = "Okunmamış";
+		$text['label-message_unread']['zh-cn'] = "未读";
+		$text['label-message_unread']['ja-jp'] = "未読";
+		$text['label-message_unread']['ko-kr'] = "읽지 않음";
+		
+		$text['label-message_received']['en-us'] = "Received";
+		$text['label-message_received']['en-gb'] = "Received";
+		$text['label-message_received']['ar-eg'] = "تم الاستلام";
+		$text['label-message_received']['de-at'] = "Empfangen";
+		$text['label-message_received']['de-ch'] = "Empfangen";
+		$text['label-message_received']['de-de'] = "Empfangen";
+		$text['label-message_received']['el-gr'] = "Ληφθέν";
+		$text['label-message_received']['es-cl'] = "Recibido";
+		$text['label-message_received']['es-mx'] = "Recibido";
+		$text['label-message_received']['fr-ca'] = "Reçu";
+		$text['label-message_received']['fr-fr'] = "Reçu";
+		$text['label-message_received']['he-il'] = "התקבל";
+		$text['label-message_received']['it-it'] = "Ricevuto";
+		$text['label-message_received']['ka-ge'] = "მიღებული";
+		$text['label-message_received']['nl-nl'] = "Ontvangen";
+		$text['label-message_received']['pl-pl'] = "Otrzymano";
+		$text['label-message_received']['pt-br'] = "Recebido";
+		$text['label-message_received']['pt-pt'] = "Recebido";
+		$text['label-message_received']['ro-ro'] = "Recepționat";
+		$text['label-message_received']['ru-ru'] = "Получено";
+		$text['label-message_received']['sv-se'] = "Mottagen";
+		$text['label-message_received']['uk-ua'] = "Отримано";
+		$text['label-message_received']['tr-tr'] = "Alındı";
+		$text['label-message_received']['zh-cn'] = "已接收";
+		$text['label-message_received']['ja-jp'] = "受信";
+		$text['label-message_received']['ko-kr'] = "수신됨";
+		
+		$text['label-message_sent']['en-us'] = "Sent";
+		$text['label-message_sent']['en-gb'] = "Sent";
+		$text['label-message_sent']['ar-eg'] = "مرسل";
+		$text['label-message_sent']['de-at'] = "Gesendet";
+		$text['label-message_sent']['de-ch'] = "Gesendet";
+		$text['label-message_sent']['de-de'] = "Gesendet";
+		$text['label-message_sent']['el-gr'] = "Απεσταλμένο";
+		$text['label-message_sent']['es-cl'] = "Enviado";
+		$text['label-message_sent']['es-mx'] = "Enviado";
+		$text['label-message_sent']['fr-ca'] = "Envoyé";
+		$text['label-message_sent']['fr-fr'] = "Envoyé";
+		$text['label-message_sent']['he-il'] = "נשלח";
+		$text['label-message_sent']['it-it'] = "Inviato";
+		$text['label-message_sent']['ka-ge'] = "გაგზავნილია";
+		$text['label-message_sent']['nl-nl'] = "Verzonden";
+		$text['label-message_sent']['pl-pl'] = "Wysłano";
+		$text['label-message_sent']['pt-br'] = "Enviado";
+		$text['label-message_sent']['pt-pt'] = "Enviado";
+		$text['label-message_sent']['ro-ro'] = "Trimis";
+		$text['label-message_sent']['ru-ru'] = "Отправлено";
+		$text['label-message_sent']['sv-se'] = "Skickat";
+		$text['label-message_sent']['uk-ua'] = "Відправлено";
+		$text['label-message_sent']['tr-tr'] = "Gönderildi";
+		$text['label-message_sent']['zh-cn'] = "已发送";
+		$text['label-message_sent']['ja-jp'] = "送信済み";
+		$text['label-message_sent']['ko-kr'] = "보낸";
+		
+		$text['label-message_description']['en-us'] = "Description";
+		$text['label-message_description']['en-gb'] = "Description";
+		$text['label-message_description']['ar-eg'] = "الوصف";
+		$text['label-message_description']['de-at'] = "Beschreibung";
+		$text['label-message_description']['de-ch'] = "Beschreibung";
+		$text['label-message_description']['de-de'] = "Beschreibung";
+		$text['label-message_description']['el-gr'] = "Περιγραφή";
+		$text['label-message_description']['es-cl'] = "Descripción";
+		$text['label-message_description']['es-mx'] = "Descripción";
+		$text['label-message_description']['fr-ca'] = "Description";
+		$text['label-message_description']['fr-fr'] = "Description";
+		$text['label-message_description']['he-il'] = "תיאור";
+		$text['label-message_description']['it-it'] = "Descrizione";
+		$text['label-message_description']['ka-ge'] = "აღწერა";
+		$text['label-message_description']['nl-nl'] = "Beschrijving";
+		$text['label-message_description']['pl-pl'] = "Opis";
+		$text['label-message_description']['pt-br'] = "Descrição";
+		$text['label-message_description']['pt-pt'] = "Descrição";
+		$text['label-message_description']['ro-ro'] = "Descriere";
+		$text['label-message_description']['ru-ru'] = "Описание";
+		$text['label-message_description']['sv-se'] = "Beskrivning";
+		$text['label-message_description']['uk-ua'] = "Опис";
+		$text['label-message_description']['tr-tr'] = "Açıklama";
+		$text['label-message_description']['zh-cn'] = "描述";
+		$text['label-message_description']['ja-jp'] = "説明";
+		$text['label-message_description']['ko-kr'] = "설명";
+
+		$text['title-message_status']['en-us'] = "Message Status";
+		$text['title-message_status']['en-gb'] = "Message Status";
+		$text['title-message_status']['ar-eg'] = "حالة الرسالة";
+		$text['title-message_status']['de-at'] = "Nachrichtenstatus";
+		$text['title-message_status']['de-ch'] = "Nachrichtenstatus";
+		$text['title-message_status']['de-de'] = "Nachrichtenstatus";
+		$text['title-message_status']['el-gr'] = "Κατάσταση μηνύματος";
+		$text['title-message_status']['es-cl'] = "Estado del Mensaje";
+		$text['title-message_status']['es-mx'] = "Estado del Mensaje";
+		$text['title-message_status']['fr-ca'] = "Statut du message";
+		$text['title-message_status']['fr-fr'] = "Statut du message";
+		$text['title-message_status']['he-il'] = "סטטוס הודעה";
+		$text['title-message_status']['it-it'] = "Stato del Messaggio";
+		$text['title-message_status']['ka-ge'] = "შეტყობინების სტატუსი";
+		$text['title-message_status']['nl-nl'] = "Berichtstatus";
+		$text['title-message_status']['pl-pl'] = "Status wiadomości";
+		$text['title-message_status']['pt-br'] = "Status da Mensagem";
+		$text['title-message_status']['pt-pt'] = "Status da Mensagem";
+		$text['title-message_status']['ro-ro'] = "Starea mesajului";
+		$text['title-message_status']['ru-ru'] = "Статус сообщения";
+		$text['title-message_status']['sv-se'] = "Meddelandestatus";
+		$text['title-message_status']['uk-ua'] = "Статус повідомлення";
+		$text['title-message_status']['tr-tr'] = "Mesaj Durumu";
+		$text['title-message_status']['zh-cn'] = "消息状态";
+		$text['title-message_status']['ja-jp'] = "メッセージの状態";
+		$text['title-message_status']['ko-kr'] = "메시지 상태";
+
+		$text['label-message_status']['en-us'] = "Status";
+		$text['label-message_status']['en-gb'] = "Status";
+		$text['label-message_status']['ar-eg'] = "الحالة";
+		$text['label-message_status']['de-at'] = "Status";
+		$text['label-message_status']['de-ch'] = "Status";
+		$text['label-message_status']['de-de'] = "Status";
+		$text['label-message_status']['el-gr'] = "Κατάσταση";
+		$text['label-message_status']['es-cl'] = "Estado";
+		$text['label-message_status']['es-mx'] = "Estado";
+		$text['label-message_status']['fr-ca'] = "Statut";
+		$text['label-message_status']['fr-fr'] = "Statut";
+		$text['label-message_status']['he-il'] = "סטטוס";
+		$text['label-message_status']['it-it'] = "Stato";
+		$text['label-message_status']['ka-ge'] = "სტატუსი";
+		$text['label-message_status']['nl-nl'] = "Status";
+		$text['label-message_status']['pl-pl'] = "Status";
+		$text['label-message_status']['pt-br'] = "Status";
+		$text['label-message_status']['pt-pt'] = "Status";
+		$text['label-message_status']['ro-ro'] = "Stare";
+		$text['label-message_status']['ru-ru'] = "Статус";
+		$text['label-message_status']['sv-se'] = "Status";
+		$text['label-message_status']['uk-ua'] = "Статус";
+		$text['label-message_status']['tr-tr'] = "Durum";
+		$text['label-message_status']['zh-cn'] = "状态";
+		$text['label-message_status']['ja-jp'] = "ステータス";
+		$text['label-message_status']['ko-kr'] = "상태";
+
 // 		foreach ($text as $name => $langs) { echo $name.' - '.sizeof($langs).'<br>'; }
 
 ?>

+ 61 - 31
app_menu.php

@@ -1,34 +1,64 @@
 <?php
 
-$apps[$x]['menu'][0]['title']['en-us'] = 'Messages';
-$apps[$x]['menu'][0]['title']['en-gb'] = 'Messages';
-$apps[$x]['menu'][0]['title']['ar-eg'] = 'رسائل';
-$apps[$x]['menu'][0]['title']['de-at'] = 'Mitteilungen';
-$apps[$x]['menu'][0]['title']['de-ch'] = 'Mitteilungen';
-$apps[$x]['menu'][0]['title']['de-de'] = 'Mitteilungen';
-$apps[$x]['menu'][0]['title']['es-cl'] = 'Mensajes';
-$apps[$x]['menu'][0]['title']['es-mx'] = 'Mensajes';
-$apps[$x]['menu'][0]['title']['fr-ca'] = 'messages';
-$apps[$x]['menu'][0]['title']['fr-fr'] = 'messages';
-$apps[$x]['menu'][0]['title']['he-il'] = 'הודעות';
-$apps[$x]['menu'][0]['title']['it-it'] = 'Messaggi';
-$apps[$x]['menu'][0]['title']['nl-nl'] = 'Berichten';
-$apps[$x]['menu'][0]['title']['pl-pl'] = 'Wiadomości';
-$apps[$x]['menu'][0]['title']['pt-br'] = 'Mensagens';
-$apps[$x]['menu'][0]['title']['pt-pt'] = 'Mensagens';
-$apps[$x]['menu'][0]['title']['ro-ro'] = 'Mesaje';
-$apps[$x]['menu'][0]['title']['ru-ru'] = 'Сообщения';
-$apps[$x]['menu'][0]['title']['uk-ua'] = 'Повідомлення';
-$apps[$x]['menu'][0]['title']['sv-se'] = 'Meddelanden';
-$apps[$x]['menu'][0]['title']['zh-cn'] = '留言';
-$apps[$x]['menu'][0]['title']['ja-jp'] = 'メッセージ';
-$apps[$x]['menu'][0]['title']['ko-kr'] = '메시지';
-$apps[$x]['menu'][0]['uuid'] = 'b2f6a2e0-cf25-4bd5-8079-6385f6871047';
-$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
-$apps[$x]['menu'][0]['category'] = 'internal';
-$apps[$x]['menu'][0]['path'] = '/app/messages/messages.php';
-$apps[$x]['menu'][0]['groups'][] = 'superadmin';
-//$apps[$x]['menu'][0]['groups'][] = 'admin';
-//$apps[$x]['menu'][0]['groups'][] = 'user';
+$y=0;
+$apps[$x]['menu'][$y]['title']['en-us'] = 'Messages';
+$apps[$x]['menu'][$y]['title']['en-gb'] = 'Messages';
+$apps[$x]['menu'][$y]['title']['ar-eg'] = 'رسائل';
+$apps[$x]['menu'][$y]['title']['de-at'] = 'Mitteilungen';
+$apps[$x]['menu'][$y]['title']['de-ch'] = 'Mitteilungen';
+$apps[$x]['menu'][$y]['title']['de-de'] = 'Mitteilungen';
+$apps[$x]['menu'][$y]['title']['es-cl'] = 'Mensajes';
+$apps[$x]['menu'][$y]['title']['es-mx'] = 'Mensajes';
+$apps[$x]['menu'][$y]['title']['fr-ca'] = 'messages';
+$apps[$x]['menu'][$y]['title']['fr-fr'] = 'messages';
+$apps[$x]['menu'][$y]['title']['he-il'] = 'הודעות';
+$apps[$x]['menu'][$y]['title']['it-it'] = 'Messaggi';
+$apps[$x]['menu'][$y]['title']['nl-nl'] = 'Berichten';
+$apps[$x]['menu'][$y]['title']['pl-pl'] = 'Wiadomości';
+$apps[$x]['menu'][$y]['title']['pt-br'] = 'Mensagens';
+$apps[$x]['menu'][$y]['title']['pt-pt'] = 'Mensagens';
+$apps[$x]['menu'][$y]['title']['ro-ro'] = 'Mesaje';
+$apps[$x]['menu'][$y]['title']['ru-ru'] = 'Сообщения';
+$apps[$x]['menu'][$y]['title']['uk-ua'] = 'Повідомлення';
+$apps[$x]['menu'][$y]['title']['sv-se'] = 'Meddelanden';
+$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'] = 'b2f6a2e0-cf25-4bd5-8079-6385f6871047';
+$apps[$x]['menu'][$y]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
+$apps[$x]['menu'][$y]['category'] = 'internal';
+$apps[$x]['menu'][$y]['path'] = '/app/messages/messages.php';
+$apps[$x]['menu'][$y]['groups'][] = 'superadmin';
+$y++;
+$apps[$x]['menu'][$y]['title']['en-us'] = 'Message Summary';
+$apps[$x]['menu'][$y]['title']['en-gb'] = 'Message Summary'; 
+$apps[$x]['menu'][$y]['title']['ar-eg'] = 'ملخص الرسائل'; 
+$apps[$x]['menu'][$y]['title']['de-at'] = 'Nachrichtenübersicht'; 
+$apps[$x]['menu'][$y]['title']['de-ch'] = 'Nachrichtenübersicht'; 
+$apps[$x]['menu'][$y]['title']['de-de'] = 'Nachrichtenübersicht'; 
+$apps[$x]['menu'][$y]['title']['es-cl'] = 'Resumen de Mensajes'; 
+$apps[$x]['menu'][$y]['title']['es-mx'] = 'Resumen de Mensajes'; 
+$apps[$x]['menu'][$y]['title']['fr-ca'] = 'Résumé des messages'; 
+$apps[$x]['menu'][$y]['title']['fr-fr'] = 'Résumé des messages'; 
+$apps[$x]['menu'][$y]['title']['he-il'] = 'סיכום הודעות'; 
+$apps[$x]['menu'][$y]['title']['it-it'] = 'Riepilogo Messaggi'; 
+$apps[$x]['menu'][$y]['title']['nl-nl'] = 'Berichten Samenvatting'; 
+$apps[$x]['menu'][$y]['title']['pl-pl'] = 'Podsumowanie Wiadomości'; 
+$apps[$x]['menu'][$y]['title']['pt-br'] = 'Resumo das Mensagens'; 
+$apps[$x]['menu'][$y]['title']['pt-pt'] = 'Resumo das Mensagens'; 
+$apps[$x]['menu'][$y]['title']['ro-ro'] = 'Sumar Mesaje'; 
+$apps[$x]['menu'][$y]['title']['ru-ru'] = 'Сводка сообщений'; 
+$apps[$x]['menu'][$y]['title']['uk-ua'] = 'Резюме повідомлень'; 
+$apps[$x]['menu'][$y]['title']['sv-se'] = 'Sammanfattning av meddelanden'; 
+$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'] = '01d05576-739c-495f-84bb-662c5f755120';
+$apps[$x]['menu'][$y]['parent_uuid'] = '0438b504-8613-7887-c420-c837ffb20cb1';
+$apps[$x]['menu'][$y]['category'] = 'internal';
+$apps[$x]['menu'][$y]['path'] = '/app/messages/message_summary.php';
+$apps[$x]['menu'][$y]['groups'][] = 'superadmin';
+$apps[$x]['menu'][$y]['groups'][] = 'admin';
+$y++;
 
-?>
+?>

+ 228 - 0
message_summary.php

@@ -0,0 +1,228 @@
+<?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) 2023-2024
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+
+//includes files
+	require_once dirname(__DIR__, 2) . "/resources/require.php";
+	require_once "resources/check_auth.php";
+	//require_once "resources/paging.php";
+
+//check permissions
+	if (permission_exists('message_view')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
+
+	//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//retrieve submitted data
+	if (!empty($_REQUEST)) {
+		$quick_select = $_REQUEST['quick_select'];
+		$message_date_begin = $_REQUEST['message_date_begin'];
+		$message_date_end = $_REQUEST['message_date_end'];
+	}
+	else {
+		$quick_select = 3; //set default
+	}
+
+//get the summary
+	$message = new messages;
+	
+	if (!empty($quick_select)) {
+		$message->quick_select = $quick_select;
+	}
+	else {
+		$message->message_date_begin = $message_date_begin ?? '';
+		$message->message_date_end = $message_date_end ?? '';
+	}
+
+	$summary = $message->message_summary();
+	// view_array($summary); exit;
+
+//set the http header
+	if (!empty($_REQUEST['type']) && $_REQUEST['type'] == "csv") {
+
+		//set the headers
+			header('Content-type: application/octet-binary');
+			header('Content-Disposition: attachment; filename=message-summary.csv');
+
+		//show the column names on the first line
+			$z = 0;
+			if (!empty($summary) && is_array($summary)) {
+				foreach ($summary[0] as $key => $val) {
+					if ($z == 0) {
+						echo '"'.$key.'"';
+					}
+					else {
+						echo ',"'.$key.'"';
+					}
+					$z++;
+				}
+				echo "\n";
+			}
+
+		//add the values to the csv
+			$x = 0;
+			if (!empty($summary) && is_array($summary)) {
+				foreach ($summary as $users) {
+					$z = 0;
+					foreach ($users as $key => $val) {
+						if ($z == 0) {
+							echo '"'.$summary[$x][$key].'"';
+						}
+						else {
+							echo ',"'.$summary[$x][$key].'"';
+						}
+						$z++;
+					}
+					echo "\n";
+					$x++;
+				}
+			}
+			exit;
+	}
+
+//include the header
+	$document['title'] = $text['title-message_summary'];
+	require_once "resources/header.php";
+	
+//css grid adjustment
+	echo "<style>\n";
+	echo "	div.form_grid {\n";
+	echo "		grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));\n";
+	echo "		}\n";
+	echo "</style>\n";
+
+//show the content
+	echo "<div class='action_bar' id='action_bar'>\n";
+	echo "	<div class='heading'><b>".$text['title-message_summary']."</b></div>\n";
+	echo "	<div class='actions'>\n";
+	if (permission_exists('message_summary_all') && $_GET['show'] != 'all') {
+		echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'collapse'=>'hide-sm-dn','link'=>'message_summary.php?show=all']);
+	}
+	echo button::create(['type'=>'button','label'=>$text['button-download_csv'],'icon'=>$_SESSION['theme']['button_icon_download'],'collapse'=>'hide-sm-dn','link'=>'message_summary.php?'.(!empty($_SERVER["QUERY_STRING"]) ? $_SERVER["QUERY_STRING"].'&' : null).'type=csv']);
+	echo button::create(['type'=>'button','label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'collapse'=>'hide-xs','style'=>'margin-left: 15px;','link'=>'message_summary.php']);
+	echo button::create(['type'=>'button','label'=>$text['button-update'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','collapse'=>'hide-xs','onclick'=>"document.getElementById('frm').submit();"]);
+	echo "	</div>\n";
+	echo "	<div style='clear: both;'></div>\n";
+	echo "</div>\n";
+
+	if (permission_exists('message_search')) {
+		echo "<form name='frm' id='frm' method='get' autocomplete='off'>\n";
+
+		echo "<div class='card' style='margin-bottom: 30px;'>\n";
+		echo "<div class='form_grid'>\n";
+
+		echo "	<div class='form_set'>\n";
+		echo "		<div class='label'>\n";
+		echo "			".$text['label-preset']."\n";
+		echo "		</div>\n";
+		echo "		<div class='field'>\n";
+		echo "			<select class='formfld' name='quick_select' id='quick_select' onchange=\"if (this.selectedIndex != 0) { document.getElementById('message_date_begin').value = ''; document.getElementById('message_date_end').value = ''; document.getElementById('frm').submit(); }\">\n";
+		echo "				<option value=''></option>\n";
+		echo "				<option value='1' ".($quick_select == 1 ? "selected='selected'" : null).">".$text['option-last_seven_days']."</option>\n";
+		echo "				<option value='2' ".($quick_select == 2 ? "selected='selected'" : null).">".$text['option-last_hour']."</option>\n";
+		echo "				<option value='3' ".($quick_select == 3 ? "selected='selected'" : null).">".$text['option-today']."</option>\n";
+		echo "				<option value='4' ".($quick_select == 4 ? "selected='selected'" : null).">".$text['option-yesterday']."</option>\n";
+		echo "				<option value='5' ".($quick_select == 5 ? "selected='selected'" : null).">".$text['option-this_week']."</option>\n";
+		echo "				<option value='6' ".($quick_select == 6 ? "selected='selected'" : null).">".$text['option-this_month']."</option>\n";
+		echo "				<option value='7' ".($quick_select == 7 ? "selected='selected'" : null).">".$text['option-this_year']."</option>\n";
+		echo "			</select>\n";
+		echo "		</div>\n";
+		echo "	</div>\n";
+
+		echo "	<div class='form_set'>\n";
+		echo "		<div class='label'>\n";
+		echo "			".$text['label-start_date_time']."\n";
+		echo "		</div>\n";
+		echo "		<div class='field'>\n";
+		echo "			<input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#message_date_begin' onblur=\"$(this).datetimepicker('hide');$('#quick_select option').removeAttr('selected');\" style='min-width: 115px; width: 115px; max-width: 115px;' name='message_date_begin' id='message_date_begin' placeholder='".$text['label-from']."' value='".escape($message_date_begin ?? '')."'>\n";
+		echo "		</div>\n";
+		echo "	</div>\n";
+
+		echo "	<div class='form_set'>\n";
+		echo "		<div class='label'>\n";
+		echo "			".$text['label-end_date_time']."\n";
+		echo "		</div>\n";
+		echo "		<div class='field'>\n";
+		echo "			<input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#message_date_end' onblur=\"$(this).datetimepicker('hide');$('#quick_select option').removeAttr('selected');\" style='min-width: 115px; width: 115px; max-width: 115px;' name='message_date_end' id='message_date_end' placeholder='".$text['label-to']."' value='".escape($message_date_end ?? '')."'>\n";
+		echo "		</div>\n";
+		echo "	</div>\n";
+
+		echo "</div>\n";
+		echo "</div>\n";
+
+		if (!empty($_GET['show']) && $_GET['show'] == 'all' && permission_exists('message_summary_all')) {
+			echo "<input type='hidden' name='show' value='all'>";
+		}
+
+		echo "</form>";
+	}
+
+//show the results
+	echo "<div class='card'>\n";
+	echo "<table class='list'>\n";
+	echo "	<tr class='list-header'>\n";
+	if (!empty($_GET['show']) && $_GET['show'] === "all" && permission_exists('message_summary_all')) {
+		echo "		<th>".$text['label-domain']."</th>\n";
+	}
+	echo "		<th>".$text['label-message_destination']."</th>\n";
+	
+	echo "		<th class='center'>".$text['label-message_read']."</th>\n";
+	echo "		<th class='center'>".$text['label-message_unread']."</th>\n";
+	echo "		<th class='center'>".$text['label-message_received']."</th>\n";
+	echo "		<th class='center'>".$text['label-message_sent']."</th>\n";
+	echo "		<th class='hide-sm-dn'>".$text['label-message_description']."</th>\n";
+	echo "	</tr>\n";
+	
+	if (!empty($summary) && is_array($summary)) {
+		foreach ($summary as $key => $row) {
+			echo "<tr class='list-row'>\n";
+			if (!empty($_GET['show']) && $_GET['show'] === "all" && permission_exists('message_summary_all')) {
+				echo "	<td style=\"cursor: default\">".escape($row['domain_name'])."</td>\n";
+			}
+			echo "	<td style=\"cursor: default\">".escape($row['destination'])."</td>\n";
+			echo "	<td class='center' style=\"cursor: default\">".escape($row['message_read'])."&nbsp;</td>\n";
+			echo "	<td class='center' style=\"cursor: default\">".escape($row['message_unread'])."&nbsp;</td>\n";
+			echo "	<td class='center' style=\"cursor: default\">".escape($row['message_received'])."&nbsp;</td>\n";
+			echo "	<td class='center' style=\"cursor: default\">".escape($row['message_sent'])."&nbsp;</td>\n";
+			echo "	<td class='description overflow hide-sm-dn' style=\"cursor: default\">".escape($row['destination_description'])."&nbsp;</td>\n";
+			echo "</tr>\n";
+		}
+	}
+
+	echo "</table>\n";
+	echo "</div>\n";
+	echo "<br />\n";
+
+//show the footer
+	require_once "resources/footer.php";
+
+?>

+ 165 - 7
resources/classes/messages.php

@@ -4,6 +4,15 @@
 if (!class_exists('messages')) {
 	class messages {
 
+						/**
+		* declare public variables
+		*/
+		public $destinations;
+		public $domain_uuid;
+		public $message_date_begin;
+		public $message_date_end;
+		public $quick_select;
+
 		/**
 		 * declare private variables
 		 */
@@ -13,11 +22,19 @@ if (!class_exists('messages')) {
 		private $list_page;
 		private $table;
 		private $uuid_prefix;
+		private $settings;
 
 		/**
 		 * called when the object is created
 		 */
-		public function __construct() {
+		public function __construct($settings = null) {
+			if (is_null($this->domain_uuid)) {
+				$this->domain_uuid = $_SESSION['domain_uuid'];
+			}
+
+			if (!isset($settings)) {
+				$this->settings = new settings();
+			}
 
 			//assign private variables
 				$this->app_name = 'messages';
@@ -167,11 +184,11 @@ if (!class_exists('messages')) {
 				$sql .= "and provider_uuid is not null ";
 				$sql .= "and destination_enabled = 'true'; ";
 				$parameters['destination_number'] = $message_from;
-				if (!empty($debug)) {
-					file_put_contents($log_file, "sql: ".$sql."\n", FILE_APPEND);
-					//echo $sql."\n";
-					file_put_contents($log_file, print_r($parameters, true)."\n", FILE_APPEND);
-				}
+				// if (!empty($debug)) {
+				// 	file_put_contents($log_file, "sql: ".$sql."\n", FILE_APPEND);
+				// 	//echo $sql."\n";
+				// 	file_put_contents($log_file, print_r($parameters, true)."\n", FILE_APPEND);
+				// }
 				$database = new database;
 				$row = $database->select($sql, $parameters, 'row');
 				//view_array($row, false);
@@ -183,7 +200,7 @@ if (!class_exists('messages')) {
 					unset($row);
 				}
 				//if (!empty($debug)) {
-					view_array($row,false);
+					// view_array($row,false);
 					//file_put_contents($log_file, print_r($row, true)."\n", FILE_APPEND);
 				//}
 				unset($sql, $parameters);
@@ -290,6 +307,147 @@ if (!class_exists('messages')) {
 				$p->delete('message_media_add', 'temp');
 
 		} //method
+
+		public function message_summary() {
+			//set the time zone
+				if (!empty($this->settings->get('domain', 'time_zone'))) {
+					$time_zone = $this->settings->get('domain', 'time_zone');
+				}
+				else {
+					$time_zone = date_default_timezone_get();
+				}
+
+			//set the time zone for php
+				date_default_timezone_set($time_zone);
+				
+			//build the date range
+				if (!empty($this->message_date_begin) || !empty($this->message_date_end)) {
+					unset($this->quick_select);
+					if (strlen($this->message_date_begin) > 0 && !empty($this->message_date_end)) {
+						$sql_date_range = " and message_date between :message_date_begin::timestamptz and :message_date_end::timestamptz \n";
+						$parameters['message_date_begin'] = $this->message_date_begin.':00.000 '.$time_zone;
+						$parameters['message_date_end'] = $this->message_date_end.':59.999 '.$time_zone;
+					}
+					else {
+						if (!empty($this->message_date_begin)) {
+							$sql_date_range = "and message_date >= :message_date_begin::timestamptz \n";
+							$parameters['message_date_begin'] = $this->message_date_begin.':00.000 '.$time_zone;
+						}
+						if (!empty($this->message_date_end)) {
+							$sql_date_range .= "and message_date <= :message_date_end::timestamptz \n";
+							$parameters['message_date_end'] = $this->message_date_end.':59.999 '.$time_zone;
+						}
+					}
+				}
+				else {
+					switch ($this->quick_select) {
+						case 1: $sql_date_range = "and message_date >= '".date('Y-m-d H:i:s.000', strtotime("-1 week"))." ".$time_zone."'::timestamptz \n"; break; //last 7 days
+						case 2: $sql_date_range = "and message_date >= '".date('Y-m-d H:i:s.000', strtotime("-1 hour"))." ".$time_zone."'::timestamptz \n"; break; //last hour
+						case 3: $sql_date_range = "and message_date >= '".date('Y-m-d')." "."00:00:00.000 ".$time_zone."'::timestamptz \n"; break; //today
+						case 4: $sql_date_range = "and message_date between '".date('Y-m-d',strtotime("-1 day"))." "."00:00:00.000 ".$time_zone."'::timestamptz and '".date('Y-m-d',strtotime("-1 day"))." "."23:59:59.999 ".$time_zone."'::timestamptz \n"; break; //yesterday
+						case 5: $sql_date_range = "and message_date >= '".date('Y-m-d',strtotime("this week"))." "."00:00:00.000 ".$time_zone."' \n"; break; //this week
+						case 6: $sql_date_range = "and message_date >= '".date('Y-m-')."01 "."00:00:00.000 ".$time_zone."'::timestamptz \n"; break; //this month
+						case 7: $sql_date_range = "and message_date >= '".date('Y-')."01-01 "."00:00:00.000 ".$time_zone."'::timestamptz \n"; break; //this year
+					}
+				}
+
+				$sql  = "with \n"; 
+				$sql .= "message_inbound as ( \n";
+				$sql .= "select \n"; 
+				$sql .= "m.domain_uuid as domain_uuid, \n";
+				$sql .= "d.destination_uuid as destination_uuid, \n";
+				$sql .= "m.message_to as destination, \n";
+
+				//message_read
+				$sql .= "count(*) \n";
+				$sql .= "filter (where m.message_read IS TRUE) \n";
+				$sql .= "as message_read, \n";
+
+				//message_unread
+				$sql .= "count(*) \n";
+				$sql .= "filter (where m.message_read IS NOT TRUE) \n";
+				$sql .= "as message_unread, \n";
+
+				//message_received
+				$sql .= "count(*) \n";
+				$sql .= "as message_received, \n";
+
+				$sql .= "0 as message_sent \n";
+
+				$sql .= "from v_messages m, v_destinations d \n";
+				
+				if (!(!empty($_GET['show']) && $_GET['show'] === 'all' && permission_exists('message_summary_all'))) {
+					$sql .= "where m.domain_uuid = :domain_uuid \n";
+				}
+				else {
+					$sql .= "where true \n";
+				}
+				$sql .= $sql_date_range ?? '';
+				$sql .= "and m.message_direction = 'inbound' \n";
+				$sql .= "and m.message_to in (d.destination_number, concat(d.destination_prefix, d.destination_number), concat('+', d.destination_prefix, d.destination_number)) \n";
+				$sql .= "group by m.domain_uuid, d.destination_uuid, m.message_to \n";
+
+				$sql .= "), message_outbound as ( \n";
+
+				$sql .= "select \n"; 
+				$sql .= "m.domain_uuid as domain_uuid, \n";
+				$sql .= "d.destination_uuid as destination_uuid, \n";
+				$sql .= "m.message_from as destination, \n"; 
+				$sql .= "0 as message_read, \n";
+				$sql .= "0 as message_unread, \n";
+				$sql .= "0 as message_received, \n";
+
+				//message_sent
+				$sql .= "count(*) \n";
+				$sql .= "as message_sent \n";
+
+				$sql .= "from v_messages m, v_destinations d \n";
+				if (!(!empty($_GET['show']) && $_GET['show'] === 'all' && permission_exists('message_summary_all'))) {
+					$sql .= "where m.domain_uuid = :domain_uuid \n";
+				}
+				else {
+					$sql .= "where true \n";
+				}
+				$sql .= $sql_date_range ?? '';
+				$sql .= "and m.message_direction = 'outbound' \n";
+				$sql .= "and m.message_from in (d.destination_number, concat(d.destination_prefix, d.destination_number), concat('+', d.destination_prefix, d.destination_number)) \n";
+				$sql .= "group by m.domain_uuid, d.destination_uuid, m.message_from \n";
+				$sql .= ") \n";
+
+				$sql .= "select \n";
+				$sql .= "n.domain_uuid, \n"; 
+				$sql .= "d.destination_uuid, \n";
+				$sql .= "d.destination_description, \n";
+				$sql .= "n.domain_name, \n"; 
+				$sql .= "t.destination, \n"; 
+				$sql .= "sum(t.message_read) as message_read, \n"; 
+				$sql .= "sum(t.message_unread) as message_unread, \n"; 
+				$sql .= "sum(t.message_received) as message_received, \n"; 
+				$sql .= "sum(t.message_sent) as message_sent \n"; 
+				$sql .= "from ( \n";
+				$sql .= "select * from message_inbound \n";
+				$sql .= "union \n";
+				$sql .= "select * from message_outbound \n";
+				$sql .= ") as t, v_domains n, v_destinations d \n";
+				$sql .= "where \n";
+				$sql .= "n.domain_uuid = t.domain_uuid \n";
+				$sql .= "and d.destination_uuid = t.destination_uuid \n";
+				$sql .= "group by n.domain_uuid, d.destination_uuid, d.destination_description, n.domain_name, t.destination \n";
+				$sql .= "order by t.destination asc \n";
+
+				if (!(!empty($_GET['show']) && $_GET['show'] === 'all' && permission_exists('message_summary_all'))) {
+					$parameters['domain_uuid'] = $this->domain_uuid;
+				}
+
+				$database = database::new();
+				$summary = $database->select($sql, $parameters, 'all');
+				unset($parameters);
+				//view_array($database->message); 
+				
+				//return the array
+				return $summary;
+				
+		} //method
 		
 	} //class
 }