Mark all as read

Mark all as read
This commit is contained in:
novgorodschi catalin
2026-08-18 10:10:22 +03:00
parent 971bb56efe
commit 8f14ed7647
8 changed files with 97 additions and 0 deletions
@@ -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);
+1
View File
@@ -198,6 +198,7 @@ tz_def('WAIT_FOR_CONFIRM', 'Wait for confirm');
tz_def('CONFIRM', 'Confirm');
tz_def('WRITE_MESS_WARN', '<b>Warning:</b> you can`t use the values <b>[message]</b> or <b>[/message]</b> 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');
+1
View File
@@ -204,6 +204,7 @@ tz_def('WAIT_FOR_CONFIRM', 'En attente de confirmation');
tz_def('CONFIRM', 'Confirmer');
tz_def('WRITE_MESS_WARN', '<b>Attention :</b> vous ne pouvez pas utiliser les balises <b>[message]</b> ou <b>[/message]</b> 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');
+1
View File
@@ -200,6 +200,7 @@ tz_def('WAIT_FOR_CONFIRM', 'Așteaptă confirmarea');
tz_def('CONFIRM', 'Confirmă');
tz_def('WRITE_MESS_WARN', '<b>Atenție:</b> nu poți folosi <b>[message]</b> sau <b>[/message]</b> î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');
+17
View File
@@ -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;
+19
View File
@@ -99,6 +99,25 @@ if(isset($_GET['newdid'])) {
?>
</div>
<?php
/**
* Buton "Read All" (cerut de Catalin): marcheaza dintr-un click toate
* rapoartele necitite ca citite, indiferent de tab/pagina curenta - fara
* sa mai fie nevoie sa deschizi fiecare raport pe rand. Vizibil doar cand
* exista ceva necitit ($message->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 '<div id="textmenu" class="rpt-readall">';
echo '<form method="post" action="berichte.php" style="display:inline;">';
echo '<button type="submit" name="readall" value="1" class="rpt-readall-btn">';
echo htmlspecialchars(READ_ALL_REPORTS, ENT_QUOTES, 'UTF-8');
echo '</button>';
echo '</form>';
echo '</div>';
}
?>
<?php
/**
* Filtru dupa rezultat, doar in categoria de atacuri.
+19
View File
@@ -5924,6 +5924,25 @@ div#textmenu span {
div#textmenu a.selected {
border-bottom: 1px dashed Silver;
}
/* Buton "Read All" din berichte.php - stilizat sa se potriveasca cu linkurile de tab din #textmenu */
div#textmenu.rpt-readall {
text-align: right;
}
button.rpt-readall-btn {
background: none;
border: none;
padding: 0;
margin: 0;
color: #71D000;
font-weight: bold;
font-size: 13px;
font-family: Verdana, Arial, Helvetica, sans-serif;
text-decoration: none;
cursor: pointer;
}
button.rpt-readall-btn:hover {
color: #00BC00;
}
.none {
color: #C0C0C0;
}
+19
View File
@@ -5924,6 +5924,25 @@ div#textmenu span {
div#textmenu a.selected {
border-bottom: 1px dashed Silver;
}
/* Buton "Read All" din berichte.php - stilizat sa se potriveasca cu linkurile de tab din #textmenu */
div#textmenu.rpt-readall {
text-align: right;
}
button.rpt-readall-btn {
background: none;
border: none;
padding: 0;
margin: 0;
color: #71D000;
font-weight: bold;
font-size: 13px;
font-family: Verdana, Arial, Helvetica, sans-serif;
text-decoration: none;
cursor: pointer;
}
button.rpt-readall-btn:hover {
color: #00BC00;
}
.none {
color: #C0C0C0;
}