diff --git a/GameEngine/Database/DatabaseMessageQueries.php b/GameEngine/Database/DatabaseMessageQueries.php index fad918be..fa67201f 100644 --- a/GameEngine/Database/DatabaseMessageQueries.php +++ b/GameEngine/Database/DatabaseMessageQueries.php @@ -359,6 +359,26 @@ References: User ID/Message ID, Mode return mysqli_query($this->dblink,$q); } + /** + * Buton "Read All" (cerut de Catalin, berichte.php): marcheaza TOATE + * rapoartele necitite ale userului ca citite dintr-o singura interogare, + * in loc sa deschizi fiecare in parte. + * + * Acelasi domeniu ca getNotice($uid) (doar del = 0) - deci acopera + * exact ce se vede in lista, inclusiv rapoartele arhivate necitite + * (ntype = 9). + */ + function noticeViewedAll($uid) { + $uid = (int) $uid; + + if ($uid <= 0) { + return false; + } + + $q = "UPDATE " . TB_PREFIX . "ndata set viewed = 1 WHERE uid = $uid AND viewed = 0 AND del = 0"; + return mysqli_query($this->dblink,$q); + } + function addNotice($uid, $toWref, $ally, $type, $topic, $data, $time = 0) { list($uid, $toWref, $ally, $type, $topic, $data, $time) = $this->escape_input((int) $uid, (int) $toWref, (int) $ally, (int) $type, $topic, $data, (int) $time); diff --git a/GameEngine/Lang/en.php b/GameEngine/Lang/en.php index 3eca418e..edbde9f4 100755 --- a/GameEngine/Lang/en.php +++ b/GameEngine/Lang/en.php @@ -198,6 +198,7 @@ tz_def('WAIT_FOR_CONFIRM', 'Wait for confirm'); tz_def('CONFIRM', 'Confirm'); tz_def('WRITE_MESS_WARN', 'Warning: you can`t use the values [message] or [/message] in your message because it can cause problem with bbcode system'); tz_def('NO_REPORTS', 'There are no reports available'); +tz_def('READ_ALL_REPORTS', 'Mark all as read'); tz_def('ATTACKER', 'Attacker'); tz_def('NATAR_COUNTERFORCE', 'Natar Counterforce'); tz_def('FROM_THE_VILL', 'from the village'); diff --git a/GameEngine/Lang/fr.php b/GameEngine/Lang/fr.php index 6d843389..4aed7b34 100644 --- a/GameEngine/Lang/fr.php +++ b/GameEngine/Lang/fr.php @@ -204,6 +204,7 @@ tz_def('WAIT_FOR_CONFIRM', 'En attente de confirmation'); tz_def('CONFIRM', 'Confirmer'); tz_def('WRITE_MESS_WARN', 'Attention : vous ne pouvez pas utiliser les balises [message] ou [/message] dans votre message car cela peut causer des problèmes avec le système BBCode.'); tz_def('NO_REPORTS', 'Aucun rapport disponible'); +tz_def('READ_ALL_REPORTS', 'Marquer tout comme lu'); tz_def('ATTACKER', 'Attaquant'); tz_def('NATAR_COUNTERFORCE', 'Contre-offensive Natar'); tz_def('FROM_THE_VILL', 'du village'); diff --git a/GameEngine/Lang/ro.php b/GameEngine/Lang/ro.php index 42a17e75..96c7f9f1 100644 --- a/GameEngine/Lang/ro.php +++ b/GameEngine/Lang/ro.php @@ -200,6 +200,7 @@ tz_def('WAIT_FOR_CONFIRM', 'Așteaptă confirmarea'); tz_def('CONFIRM', 'Confirmă'); tz_def('WRITE_MESS_WARN', 'Atenție: nu poți folosi [message] sau [/message] în mesaj deoarece pot cauza probleme cu sistemul BBCode'); tz_def('NO_REPORTS', 'Nu există rapoarte disponibile'); +tz_def('READ_ALL_REPORTS', 'Marchează toate ca citite'); tz_def('ATTACKER', 'Atacator'); tz_def('NATAR_COUNTERFORCE', 'Contraatac Natari'); tz_def('FROM_THE_VILL', 'din satul'); diff --git a/GameEngine/Message.php b/GameEngine/Message.php index ff143cde..860f6bb6 100755 --- a/GameEngine/Message.php +++ b/GameEngine/Message.php @@ -201,6 +201,9 @@ class Message if (isset($post['start_x'])) { $this->unarchiveNotice($post); } + if (isset($post['readall'])) { + $this->readAllNotices(); + } } public function quoteMessage($id) @@ -415,6 +418,20 @@ class Message exit; } + /** + * Buton "Read All" (cerut de Catalin): marcheaza toate rapoartele + * necitite ale userului ca citite dintr-o singura actiune, indiferent + * de tab/filtru curent - la fel ca removeNotice/archiveNotice/ + * unarchiveNotice de mai sus (POST + redirect la lista de baza). + */ + private function readAllNotices() + { + global $database, $session; + $database->noticeViewedAll((int) $session->uid); + header("Location: berichte.php"); + exit; + } + private function getReadNotice($id) { global $database, $session; diff --git a/berichte.php b/berichte.php index 568908d3..4f7b01b2 100644 --- a/berichte.php +++ b/berichte.php @@ -99,6 +99,25 @@ if(isset($_GET['newdid'])) { ?> +nunread, calculat deja in constructorul + * Message). Trimite POST catre acelasi Message::procNotice() care trateaza + * deja del_x/archive_x/start_x mai sus in acest fisier (linia 31). + */ +if ($message->nunread > 0) { + echo '
'; +} +?>