From 7fd584192cc4573984f16df12771e7edcc904e3c Mon Sep 17 00:00:00 2001 From: pero1203 Date: Thu, 31 Mar 2022 09:02:23 +0200 Subject: [PATCH] Obvestila - popravljeno, da belezijo tudi cas posiljanja in ne samo datuma --- admin/survey/classes/class.Notifications.php | 28 ++++++++++---------- sql/update2.sql | 4 +++ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/admin/survey/classes/class.Notifications.php b/admin/survey/classes/class.Notifications.php index 5e12ab737..367e2d3b2 100644 --- a/admin/survey/classes/class.Notifications.php +++ b/admin/survey/classes/class.Notifications.php @@ -85,10 +85,10 @@ class Notifications { // Napolnimo array prejetih sporocil $recievedMessages = array(); - $sql = sisplet_query("SELECT n.id AS id, n.recipient AS recipient, n.viewed AS viewed, m.id AS message_id, m.date AS date, m.title AS title, m.text AS text + $sql = sisplet_query("SELECT n.id AS id, n.recipient AS recipient, n.viewed AS viewed, m.id AS message_id, m.send_time AS send_time, m.title AS title, m.text AS text FROM srv_notifications n, srv_notifications_messages m WHERE n.recipient='".$global_user_id."' AND n.message_id=m.id - ORDER BY m.date DESC"); + ORDER BY m.send_time DESC"); while($row = mysqli_fetch_array($sql)){ $recievedMessages[$row['id']] = $row; } @@ -107,7 +107,7 @@ class Notifications { echo $message['title']; echo ''; echo '
'; - echo $message['date']; + echo date('Y-m-d H:i:s', strtotime($message['send_time'])); echo '
'; echo ''; @@ -129,7 +129,7 @@ class Notifications { // Napolnimo array poslanih sporocil $sentMessages = array(); - $sql = sisplet_query("SELECT * FROM srv_notifications_messages WHERE author='".$global_user_id."' ORDER BY date DESC"); + $sql = sisplet_query("SELECT * FROM srv_notifications_messages WHERE author='".$global_user_id."' ORDER BY send_time DESC"); while($row = mysqli_fetch_array($sql)){ $sentMessages[$row['id']] = $row; } @@ -147,7 +147,7 @@ class Notifications { echo $message['title']; echo ''; echo '
'; - echo $message['date']; + echo date('Y-m-d H:i:s', strtotime($message['send_time'])); echo '
'; echo ''; @@ -327,7 +327,7 @@ class Notifications { if($recipient_all_slo == 1 || $recipient_all_ang == 1){ // Dodamo novo sporocilo v bazo - $sql = sisplet_query("INSERT INTO srv_notifications_messages (author, date, title, text, force_show) VALUES ('".$global_user_id."', NOW(), '".$title."', '".$notification."', '".$force_show."')"); + $sql = sisplet_query("INSERT INTO srv_notifications_messages (author, send_time, title, text, force_show) VALUES ('".$global_user_id."', NOW(), '".$title."', '".$notification."', '".$force_show."')"); $message_id = mysqli_insert_id($GLOBALS['connect_db']); $note = ''; @@ -354,7 +354,7 @@ class Notifications { $rowU = mysqli_fetch_array($sqlU); // Dodamo novo sporocilo v bazo - $sql = sisplet_query("INSERT INTO srv_notifications_messages (author, date, title, text, force_show) VALUES ('".$global_user_id."', NOW(), '".$title."', '".$notification."', '".$force_show."')"); + $sql = sisplet_query("INSERT INTO srv_notifications_messages (author, send_time, title, text, force_show) VALUES ('".$global_user_id."', NOW(), '".$title."', '".$notification."', '".$force_show."')"); $message_id = mysqli_insert_id($GLOBALS['connect_db']); // Dodamo novo sporocilo v bazo @@ -418,7 +418,7 @@ class Notifications { $sql = sisplet_query("UPDATE srv_notifications SET viewed='1' WHERE id='$id'"); // Dobimo sporocilo - $sql = sisplet_query("SELECT n.id AS id, m.title AS title, m.text AS text, m.date AS date + $sql = sisplet_query("SELECT n.id AS id, m.title AS title, m.text AS text, m.send_time AS send_time FROM srv_notifications n, srv_notifications_messages m WHERE n.id='$id' AND m.id=n.message_id"); $row = mysqli_fetch_array($sql); @@ -446,11 +446,11 @@ class Notifications { echo ''; echo '
'; - echo '('.$row['date'].')'; + echo '('.date('Y-m-d H:i:s', strtotime($row['send_time'])).')'; echo '
'; // Stara sporocila so brez editorja - $text = (strtotime($row['date']) < strtotime('2021-08-26')) ? nl2br($row['text']) : $row['text']; + $text = (strtotime($row['send_time']) < strtotime('2021-08-26')) ? nl2br($row['text']) : $row['text']; echo '
'; echo $text; echo '
'; @@ -470,17 +470,17 @@ class Notifications { echo '