Update Blog and News

This commit is contained in:
Fred Tempez 2024-10-12 11:02:08 +02:00
parent 7b9d145533
commit 18df3848f8
12 changed files with 386 additions and 175 deletions

View File

@ -16,7 +16,7 @@
class blog extends common class blog extends common
{ {
const VERSION = '7.12'; const VERSION = '8.0';
const REALNAME = 'Blog'; const REALNAME = 'Blog';
const DELETE = true; const DELETE = true;
const UPDATE = '0.0'; const UPDATE = '0.0';
@ -174,10 +174,12 @@ class blog extends common
$this->setData(['module', $this->getUrl(0), 'config', 'timeFormat', '%H:%M']); $this->setData(['module', $this->getUrl(0), 'config', 'timeFormat', '%H:%M']);
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '6.5']); $this->setData(['module', $this->getUrl(0), 'config', 'versionData', '6.5']);
} }
// Version 7.4 // Version 8.0
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '7.4', '<')) { if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '8.0', '<')) {
$this->setData(['module', $this->getUrl(0), 'config', 'buttonBack', true]); $this->setData(['module', $this->getUrl(0), 'config', 'buttonBack', true]);
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '7.4']); $this->setData(['module', $this->getUrl(0), 'config', 'showTime', true]);
$this->setData(['module', $this->getUrl(0), 'config', 'showDate', true]);
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '8.0']);
} }
} }
@ -578,7 +580,9 @@ class blog extends common
'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT, true), 'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT, true),
'dateFormat' => $this->getInput('blogOptionDateFormat'), 'dateFormat' => $this->getInput('blogOptionDateFormat'),
'timeFormat' => $this->getInput('blogOptionTimeFormat'), 'timeFormat' => $this->getInput('blogOptionTimeFormat'),
'buttonBack' => $this->getInput('newsOptionButtonBack'), 'buttonBack' => $this->getInput('blogOptionButtonBack', helper::FILTER_BOOLEAN),
'showDate' => $this->getInput('blogOptionShowDate', helper::FILTER_BOOLEAN),
'showTime' => $this->getInput('blogOptionShowTime', helper::FILTER_BOOLEAN),
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']), 'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
] ]
]); ]);
@ -596,7 +600,6 @@ class blog extends common
]); ]);
} }
/** /**
* Suppression * Suppression
*/ */

View File

@ -1,5 +1,8 @@
# Version 7.12 # Version 8.00
- Ajoute deux nouvelles options pour afficher ou masquer la date et l'heure de l'article.
- Corrige un bug d'affichage des articles lorsque le thème Moderne est sélectionné. - Corrige un bug d'affichage des articles lorsque le thème Moderne est sélectionné.
- Corrige un bug dans la méthode de tronquage de l'article, nécessite Zwii 13.5
- Corrige un mauvais format de la propriété buttonBack non stockée au type booléen.
# Version 7.11 # Version 7.11
- Le sélecteur de fichier affiche par défaut le chemin vers le fichier présent dans le champ. - Le sélecteur de fichier affiche par défaut le chemin vers le fichier présent dans le champ.
# Version 7.10 # Version 7.10

View File

@ -18,11 +18,28 @@
<?php endif; ?> <?php endif; ?>
</div> </div>
<div class="col6 newsDate textAlignRight"> <div class="col6 newsDate textAlignRight">
<!-- bloc signature et date --> <!-- bloc signature -->
<?php echo template::ico('user'); ?> <?php echo template::ico('user'); ?>
<?php echo $module::$articleSignature; ?> <?php echo $module::$articleSignature; ?>
<?php echo template::ico('calendar-empty'); ?> <!-- bloc date -->
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI) . ' ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?> <?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo '&nbsp;-&nbsp;'; ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<!-- Bloc edition --> <!-- Bloc edition -->
<?php if ( <?php if (
$this->isConnected() === true $this->isConnected() === true

View File

@ -24,11 +24,28 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col6 blogEdit"> <div class="col6 blogEdit">
<!-- bloc signature et date --> <!-- bloc signature -->
<?php echo template::ico('user'); ?> <?php echo template::ico('user'); ?>
<?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?> <?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
<?php echo template::ico('calendar-empty'); ?> <!-- bloc Date -->
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI) . '&nbsp;' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?> <?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo '&nbsp;-&nbsp;'; ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -139,12 +156,28 @@
</a> </a>
</div> </div>
<div class="blogDate"> <div class="blogDate">
<!-- bloc signature et date --> <!-- bloc signature -->
<?php echo template::ico('user'); ?> <?php echo template::ico('user'); ?>
<?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?> <?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
<?php echo template::ico('calendar-empty'); ?> <!-- bloc date -->
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI) . '&nbsp;' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?> <?php if (
</div> $this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo '&nbsp;-&nbsp;'; ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<div class="blogContent"> <div class="blogContent">
<?php $lenght = $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']); ?> <?php $lenght = $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']); ?>
<?php if ($lenght > 0): ?> <?php if ($lenght > 0): ?>
@ -163,6 +196,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
</article> </article>

View File

@ -0,0 +1,40 @@
/**
* This file is part of Zwii.
*
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2024, Frédéric Tempez
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
* @link http://zwiicms.fr/
*/
$(document).ready(function() {
// Gestion du changement de la case "Afficher la date"
$('#blogOptionShowDate').change(function() {
var showDateChecked = $(this).is(':checked');
// Afficher ou masquer le wrapper de l'heure selon l'état de la date
if (showDateChecked) {
$('.timeWrapper').show();
} else {
$('.timeWrapper').hide();
// Désactiver l'option "Afficher l'heure" lorsque la date est désactivée
$('#blogOptionShowTime').prop('checked', false).trigger('change');
}
// Afficher ou masquer le format de la date
$('#blogOptionDateFormatWrapper').toggle(showDateChecked);
}).trigger('change'); // Déclenchement au chargement de la page
// Gestion du changement de la case "Afficher l'heure"
$('#blogOptionShowTime').change(function() {
var showTimeChecked = $(this).is(':checked');
// Afficher ou masquer le format de l'heure
$('#blogOptionTimeFormatWrapper').toggle(showTimeChecked);
}).trigger('change'); // Déclenchement au chargement de la page
});

View File

@ -19,30 +19,22 @@
</h4> </h4>
<div class="row"> <div class="row">
<div class="col3"> <div class="col3">
<?php echo template::select('blogOptionArticlesLayout', $module::$articlesLayout, [ <?php echo template::checkbox('blogOptionShowDate', true, 'Afficher la date', [
'label' => 'Disposition', 'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'showDate']),
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'layout'])
]); ?> ]); ?>
</div> </div>
<div class="col3"> <div class="col3">
<?php echo template::select('blogOptionArticlesLenght', $module::$articlesLenght, [
'label' => 'Aperçus',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght'])
]); ?>
</div>
<div class="col2">
<?php echo template::select('blogOptionItemsperPage', $module::$ArticlesListed, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage'])
]); ?>
</div>
<div class="col2">
<?php echo template::select('blogOptionDateFormat', $module::$dateFormats, [ <?php echo template::select('blogOptionDateFormat', $module::$dateFormats, [
'label' => 'Format des dates', 'label' => 'Format des dates',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat']) 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat'])
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col3 timeWrapper">
<?php echo template::checkbox('blogOptionShowTime', true, 'Afficher l\'heure', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'showTime']),
]); ?>
</div>
<div class="col3 timeWrapper">
<?php echo template::select('blogOptionTimeFormat', $module::$timeFormats, [ <?php echo template::select('blogOptionTimeFormat', $module::$timeFormats, [
'label' => 'Format des heures', 'label' => 'Format des heures',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat']) 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat'])
@ -50,19 +42,39 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col3"> <div class="col4">
<?php echo template::checkbox('blogOptionShowFeeds', true, 'Lien du flux RSS', [ <?php echo template::select('blogOptionArticlesLayout', $module::$articlesLayout, [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']), 'label' => 'Disposition',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'layout'])
]); ?> ]); ?>
</div> </div>
<div class="col4">
<?php echo template::select('blogOptionArticlesLenght', $module::$articlesLenght, [
'label' => 'Aperçus',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('blogOptionItemsperPage', $module::$ArticlesListed, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage'])
]); ?>
</div>
</div>
<div class="row">
<div class="col3"> <div class="col3">
<?php echo template::checkbox('newsOptionButtonBack', true, 'Bouton de retour', [ <?php echo template::checkbox('newsOptionButtonBack', true, 'Bouton de retour', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'buttonBack']) 'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'buttonBack'])
]); ?> ]); ?>
</div> </div>
<div class="col3">
<?php echo template::checkbox('blogOptionShowFeeds', true, 'Lien du flux RSS', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
]); ?>
</div>
<div class="col6"> <div class="col6">
<?php echo template::text('blogOptionFeedslabel', [ <?php echo template::text('blogOptionFeedslabel', [
'label' => 'Texte de l\'étiquette', 'label' => 'Texte de l\'étiquette RSS',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel']) 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
]); ?> ]); ?>
</div> </div>

View File

@ -1,3 +1,6 @@
# Versions 6.0
- Ajoute deux nouvelles options pour afficher ou masquer la date et l'heure de l'article.
- Corrige un mauvais format de la propriété buttonBack non stockée au type booléen.
# Versions 5.9 # Versions 5.9
- Largeur d'un bouton de retour. - Largeur d'un bouton de retour.
# Versions 5.7 - 5.8 # Versions 5.7 - 5.8

View File

@ -16,7 +16,7 @@
class news extends common class news extends common
{ {
const VERSION = '5.9'; const VERSION = '6.0';
const REALNAME = 'News'; const REALNAME = 'News';
const DATADIRECTORY = self::DATA_DIR . 'news/'; const DATADIRECTORY = self::DATA_DIR . 'news/';
@ -128,7 +128,8 @@ class news extends common
$feeds->setLink(helper::baseUrl() . $this->getUrl(0)); $feeds->setLink(helper::baseUrl() . $this->getUrl(0));
if ($this->getData(['page', $this->getUrl(0), 'metaDescription'])) { if ($this->getData(['page', $this->getUrl(0), 'metaDescription'])) {
$feeds->setDescription($this->getData(['page', $this->getUrl(0), 'metaDescription'])); $feeds->setDescription($this->getData(['page', $this->getUrl(0), 'metaDescription']));
}; }
;
$feeds->setChannelElement('language', 'fr-FR'); $feeds->setChannelElement('language', 'fr-FR');
$feeds->setDate(date('r', time())); $feeds->setDate(date('r', time()));
$feeds->addGenerator(); $feeds->addGenerator();
@ -174,7 +175,8 @@ class news extends common
$publishedOn = $this->getInput('newsAddPublishedOn', helper::FILTER_DATETIME, true); $publishedOn = $this->getInput('newsAddPublishedOn', helper::FILTER_DATETIME, true);
$publishedOff = $this->getInput('newsAddPublishedOff') ? $this->getInput('newsAddPublishedOff', helper::FILTER_DATETIME) : ''; $publishedOff = $this->getInput('newsAddPublishedOff') ? $this->getInput('newsAddPublishedOff', helper::FILTER_DATETIME) : '';
$this->setData([ $this->setData([
'module', $this->getUrl(0), 'module',
$this->getUrl(0),
'posts', 'posts',
$newsId, $newsId,
[ [
@ -288,7 +290,8 @@ class news extends common
// Fin feuille de style // Fin feuille de style
$this->setData([ $this->setData([
'module', $this->getUrl(0), 'module',
$this->getUrl(0),
'theme', 'theme',
[ [
'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' : '', 'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' : '',
@ -300,7 +303,8 @@ class news extends common
]); ]);
$this->setData([ $this->setData([
'module', $this->getUrl(0), 'module',
$this->getUrl(0),
'config', 'config',
[ [
'feeds' => $this->getInput('newsOptionShowFeeds', helper::FILTER_BOOLEAN), 'feeds' => $this->getInput('newsOptionShowFeeds', helper::FILTER_BOOLEAN),
@ -310,7 +314,9 @@ class news extends common
'height' => $this->getInput('newsOptionHeight', helper::FILTER_INT, true), 'height' => $this->getInput('newsOptionHeight', helper::FILTER_INT, true),
'dateFormat' => $this->getInput('newsOptionDateFormat'), 'dateFormat' => $this->getInput('newsOptionDateFormat'),
'timeFormat' => $this->getInput('newsOptionTimeFormat'), 'timeFormat' => $this->getInput('newsOptionTimeFormat'),
'buttonBack' => $this->getInput('newsOptionButtonBack'), 'buttonBack' => $this->getInput('newsOptionButtonBack', helper::FILTER_BOOLEAN),
'showDate' => $this->getInput('newsOptionShowDate', helper::FILTER_BOOLEAN),
'showTime' => $this->getInput('newsOptionShowTime', helper::FILTER_BOOLEAN),
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']), 'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
] ]
]); ]);
@ -318,7 +324,7 @@ class news extends common
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/option', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => helper::translate('Modifications enregistrées'), 'notification' => helper::translate('Modifications enregistrées'),
'state' => true 'state' => true
]); ]);
@ -428,7 +434,8 @@ class news extends common
$publishedOn = $this->getInput('newsEditPublishedOn', helper::FILTER_DATETIME, true); $publishedOn = $this->getInput('newsEditPublishedOn', helper::FILTER_DATETIME, true);
$publishedOff = $this->getInput('newsEditPublishedOff') ? $this->getInput('newsEditPublishedOff', helper::FILTER_DATETIME) : ''; $publishedOff = $this->getInput('newsEditPublishedOff') ? $this->getInput('newsEditPublishedOff', helper::FILTER_DATETIME) : '';
$this->setData([ $this->setData([
'module', $this->getUrl(0), 'module',
$this->getUrl(0),
'posts', 'posts',
$newsId, $newsId,
[ [
@ -490,6 +497,8 @@ class news extends common
} }
// L'article existe // L'article existe
else { else {
self::$dateFormat = $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat']);
self::$timeFormat = $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat']);
self::$articleSignature = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId'])); self::$articleSignature = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']));
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
@ -609,6 +618,14 @@ class news extends common
// Mettre à jour la version // Mettre à jour la version
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '5.3']); $this->setData(['module', $this->getUrl(0), 'config', 'versionData', '5.3']);
} }
// Mise à jour 6.0
if (version_compare($versionData, '6.0', '<')) {
$this->setData(['module', $this->getUrl(0), 'config', 'buttonBack', true]);
$this->setData(['module', $this->getUrl(0), 'config', 'showTime', true]);
$this->setData(['module', $this->getUrl(0), 'config', 'showDate', true]);
// Mettre à jour la version
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '6.0']);
}
} }

View File

@ -12,12 +12,28 @@
<?php endif; ?> <?php endif; ?>
</div> </div>
<div class="col6 newsDate textAlignRight"> <div class="col6 newsDate textAlignRight">
<!-- bloc signature et date --> <!-- bloc signature -->
<?php echo template::ico('user'); ?> <?php echo template::ico('user'); ?>
<?php echo $module::$articleSignature . ' - '; ?> <?php echo $module::$articleSignature; ?>
<?php echo template::ico('calendar-empty'); ?> <!-- bloc date -->
<?php echo helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI) . '&nbsp' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?> <?php if (
<!-- Bloc edition --> $this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo '&nbsp;-&nbsp;'; ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?> <!-- Bloc edition -->
<?php if ( <?php if (
$this->isConnected() === true $this->isConnected() === true
and and
@ -25,15 +41,13 @@
($this->getUser('group') === self::GROUP_ADMIN) ($this->getUser('group') === self::GROUP_ADMIN)
) )
): ?> ): ?>
&nbsp;-&nbsp;
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1); ?>"> <a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1); ?>">
<?php echo template::ico('pencil'); ?> <?php echo template::ico('pencil', ['margin' => 'left']); ?>
<?php echo helper::translate('Éditer'); ?> <?php echo helper::translate('Éditer'); ?>
</a> </a>
<?php endif; ?> <?php endif; ?>
<!-- Bloc RSS--> <!-- Bloc RSS-->
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'feeds'])): ?> <?php if ($this->getData(['module', $this->getUrl(0), 'config', 'feeds'])): ?>
&nbsp;-&nbsp;
<div id="rssFeed"> <div id="rssFeed">
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?>" <a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?>"
target="_blank"> target="_blank">

View File

@ -1,5 +1,6 @@
<?php if ($module::$news): ?> <?php if ($module::$news): ?>
<link rel="stylesheet" type="text/css" href="<?php echo helper::baseUrl(false) . $this->getData(['module', $this->getUrl(0), 'theme', 'style']);?> "/> <link rel="stylesheet" type="text/css"
href="<?php echo helper::baseUrl(false) . $this->getData(['module', $this->getUrl(0), 'theme', 'style']); ?> " />
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'feeds'])): ?> <?php if ($this->getData(['module', $this->getUrl(0), 'config', 'feeds'])): ?>
<div id="rssFeed"> <div id="rssFeed">
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?>" target="_blank"> <a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?>" target="_blank">
@ -20,10 +21,28 @@
<?php echo '<a href="' . helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '">' . $news['title'] . '</a>'; ?> <?php echo '<a href="' . helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '">' . $news['title'] . '</a>'; ?>
</h2> </h2>
<div class="newsSignature"> <div class="newsSignature">
<!-- bloc signature -->
<?php echo template::ico('user'); ?> <?php echo template::ico('user'); ?>
<?php echo $news['userId'] . ' - '; ?> <?php echo $news['userId']; ?>
<?php echo template::ico('calendar-empty'); ?> <!-- bloc Date -->
<?php echo helper::dateUTF8($module::$dateFormat, $news['publishedOn'], self::$i18nUI) . '&nbsp;' . helper::dateUTF8($module::$timeFormat, $news['publishedOn'], self::$i18nUI); ?> <?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo '&nbsp;-&nbsp;'; ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<!-- Bloc edition --> <!-- Bloc edition -->
<?php if ( <?php if (
$this->isConnected() === true $this->isConnected() === true
@ -32,10 +51,8 @@
($this->getUser('group') === self::GROUP_ADMIN) ($this->getUser('group') === self::GROUP_ADMIN)
) )
): ?> ): ?>
&nbsp;-&nbsp; <a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsId; ?>">
<a <?php echo template::ico('pencil', ['margin' => 'left']); ?> Éditer
href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsId; ?>">
<?php echo template::ico('pencil'); ?> Éditer
</a> </a>
<?php endif; ?> <?php endif; ?>
</div> </div>
@ -51,7 +68,6 @@
</div> </div>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
</article> </article>
<?php echo $module::$pages; ?> <?php echo $module::$pages; ?>

View File

@ -0,0 +1,40 @@
/**
* This file is part of Zwii.
*
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2024, Frédéric Tempez
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
* @link http://zwiicms.fr/
*/
$(document).ready(function() {
// Gestion du changement de la case "Afficher la date"
$('#newsOptionShowDate').change(function() {
var showDateChecked = $(this).is(':checked');
// Afficher ou masquer le wrapper de l'heure selon l'état de la date
if (showDateChecked) {
$('.timeWrapper').show();
} else {
$('.timeWrapper').hide();
// Désactiver l'option "Afficher l'heure" lorsque la date est désactivée
$('#newsOptionShowTime').prop('checked', false).trigger('change');
}
// Afficher ou masquer le format de la date
$('#newsOptionDateFormatWrapper').toggle(showDateChecked);
}).trigger('change'); // Déclenchement au chargement de la page
// Gestion du changement de la case "Afficher l'heure"
$('#newsOptionShowTime').change(function() {
var showTimeChecked = $(this).is(':checked');
// Afficher ou masquer le format de l'heure
$('#newsOptionTimeFormatWrapper').toggle(showTimeChecked);
}).trigger('change'); // Déclenchement au chargement de la page
});

View File

@ -16,22 +16,9 @@
<div class="block"> <div class="block">
<h4><?php echo helper::translate('Paramètres'); ?></h4> <h4><?php echo helper::translate('Paramètres'); ?></h4>
<div class="row"> <div class="row">
<div class="col2"> <div class="col3">
<?php echo template::select('newsOptionItemsperCol', $module::$columns, [ <?php echo template::checkbox('newsOptionShowDate', true, 'Afficher la date', [
'label' => 'Nombre de colonnes', 'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'showDate']),
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol'])
]); ?>
</div>
<div class="col2">
<?php echo template::select('newsOptionItemsperPage', $module::$itemsList, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
]); ?>
</div>
<div class="col2">
<?php echo template::select('newsOptionHeight', $module::$height, [
'label' => 'Abrégé de l\'article',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'height'])
]); ?> ]); ?>
</div> </div>
<div class="col3"> <div class="col3">
@ -40,7 +27,12 @@
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat']) 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat'])
]); ?> ]); ?>
</div> </div>
<div class="col3"> <div class="col3 timeWrapper">
<?php echo template::checkbox('newsOptionShowTime', true, 'Afficher l\'heure', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'showTime']),
]); ?>
</div>
<div class="col3 timeWrapper">
<?php echo template::select('newsOptionTimeFormat', $module::$timeFormats, [ <?php echo template::select('newsOptionTimeFormat', $module::$timeFormats, [
'label' => 'Format des heures', 'label' => 'Format des heures',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat']) 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat'])
@ -48,20 +40,40 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col4">
<?php echo template::select('newsOptionItemsperCol', $module::$columns, [
'label' => 'Nombre de colonnes',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperCol'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('newsOptionItemsperPage', $module::$itemsList, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('newsOptionHeight', $module::$height, [
'label' => 'Abrégé de l\'article',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'height'])
]); ?>
</div>
</div>
<div class="row">
<div class="col3">
<?php echo template::checkbox('newsOptionButtonBack', true, 'Bouton de retour', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'buttonBack'])
]); ?>
</div>
<div class="col3"> <div class="col3">
<?php echo template::checkbox('newsOptionShowFeeds', true, 'Lien du flux RSS', [ <?php echo template::checkbox('newsOptionShowFeeds', true, 'Lien du flux RSS', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']), 'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
'help' => 'Flux limité aux articles de la première page.' 'help' => 'Flux limité aux articles de la première page.'
]); ?> ]); ?>
</div> </div>
<div class="col3">
<?php echo template::checkbox('newsOptionButtonBack', true, 'Bouton de retour', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'buttonBack'])
]); ?>
</div>
<div class="col6"> <div class="col6">
<?php echo template::text('newsOptionFeedslabel', [ <?php echo template::text('newsOptionFeedslabel', [
'label' => 'Étiquette RSS', 'label' => 'Texte de l\'étiquette RSS',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel']) 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
]); ?> ]); ?>
</div> </div>