1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 04:23:01 +00:00

Group recent changes entries by day. Fixes #56.

This commit is contained in:
Starbeamrainbowlabs 2016-04-03 18:11:34 +01:00
parent 187c45ee6a
commit 0f288aa195
4 changed files with 15 additions and 3 deletions

View file

@ -5,7 +5,7 @@ $start_time = time(true);
/* /*
* Pepperminty Wiki * Pepperminty Wiki
* ================ * ================
* Inspired by Minty Wiki by am2064: * Inspired by Minty Wiki by am2064
* Link: https://github.com/am2064/Minty-Wiki * Link: https://github.com/am2064/Minty-Wiki
* *
* Credits: * Credits:
@ -1693,9 +1693,15 @@ function add_recent_change($rchange)
function render_recent_changes($recentchanges) function render_recent_changes($recentchanges)
{ {
$content = "<ul class='page-list'>\n"; $content = "<ul class='page-list'>\n";
$last_time = 0;
foreach($recentchanges as $rchange) foreach($recentchanges as $rchange)
{ {
if($last_time !== date("dmY", $rchange->timestamp))
$content .= "<li><h2>" . date("jS F", $rchange->timestamp) . "</h2></li>\n";
$content .= render_recent_change($rchange); $content .= render_recent_change($rchange);
$last_time = date("dmY", $rchange->timestamp);
} }
$content .= "\t\t</ul>"; $content .= "\t\t</ul>";

View file

@ -41,7 +41,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Adds recent changes. Access through the 'recent-changes' action.", "description": "Adds recent changes. Access through the 'recent-changes' action.",
"id": "feature-recent-changes", "id": "feature-recent-changes",
"lastupdate": 1459695897, "lastupdate": 1459703430,
"optional": false "optional": false
}, },
{ {

View file

@ -97,9 +97,15 @@ function add_recent_change($rchange)
function render_recent_changes($recentchanges) function render_recent_changes($recentchanges)
{ {
$content = "<ul class='page-list'>\n"; $content = "<ul class='page-list'>\n";
$last_time = 0;
foreach($recentchanges as $rchange) foreach($recentchanges as $rchange)
{ {
if($last_time !== date("dmY", $rchange->timestamp))
$content .= "<li><h2>" . date("jS F", $rchange->timestamp) . "</h2></li>\n";
$content .= render_recent_change($rchange); $content .= render_recent_change($rchange);
$last_time = date("dmY", $rchange->timestamp);
} }
$content .= "\t\t</ul>"; $content .= "\t\t</ul>";

View file

@ -2,7 +2,7 @@
/* /*
* Pepperminty Wiki * Pepperminty Wiki
* ================ * ================
* Inspired by Minty Wiki by am2064: * Inspired by Minty Wiki by am2064
* Link: https://github.com/am2064/Minty-Wiki * Link: https://github.com/am2064/Minty-Wiki
* *
* Credits: * Credits: