Daily - display the current day instead of the previous one

Also mention if it's today or yesterday for clarity using `dayDesc`
variable

Fixes #1299
This commit is contained in:
ArthurHoaro 2019-05-25 16:40:45 +02:00
parent c3a04e328f
commit 5321f704b5
5 changed files with 444 additions and 325 deletions

3
.gitignore vendored
View file

@ -47,3 +47,6 @@ tpl/default/img
tpl/vintage/js
tpl/vintage/css
tpl/vintage/img
# Documented scripts
generate_templates.php

File diff suppressed because it is too large Load diff

View file

@ -392,9 +392,16 @@ function showDailyRSS($conf, $loginManager)
*/
function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager, $loginManager)
{
$day = date('Ymd', strtotime('-1 day')); // Yesterday, in format YYYYMMDD.
if (isset($_GET['day'])) {
$day = $_GET['day'];
if ($day === date('Ymd', strtotime('now'))) {
$pageBuilder->assign('dayDesc', t('Today'));
} elseif ($day === date('Ymd', strtotime('-1 days'))) {
$pageBuilder->assign('dayDesc', t('Yesterday'));
}
} else {
$day = date('Ymd', strtotime('now')); // Today, in format YYYYMMDD.
$pageBuilder->assign('dayDesc', t('Today'));
}
$days = $LINKSDB->days();

View file

@ -44,7 +44,12 @@
</div>
</div>
<div>
<h3 class="window-subtitle">{function="format_date($dayDate, false)"}</h3>
<h3 class="window-subtitle">
{if="!empty($dayDesc)"}
{$dayDesc} -
{/if}
{function="format_date($dayDate, false)"}
</h3>
<div id="plugin_zone_about_daily" class="plugin_zone">
{loop="$daily_about_plugin"}

View file

@ -35,6 +35,9 @@
<div class="dailyDate">
<span class="nomobile">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;</span>
{if="!empty($dayDesc)"}
{$dayDesc} -
{/if}
{function="strftime('%A %d, %B %Y', $day)"}
<span class="nomobile">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;</span>
</div>