News 6.0 ajout des options date et heure
This commit is contained in:
parent
1a6fadf976
commit
483ebd64fe
@ -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
|
||||
- Largeur d'un bouton de retour.
|
||||
# Versions 5.7 - 5.8
|
||||
|
@ -16,7 +16,7 @@
|
||||
class news extends common
|
||||
{
|
||||
|
||||
const VERSION = '5.9';
|
||||
const VERSION = '6.0';
|
||||
const REALNAME = 'News';
|
||||
const DATADIRECTORY = self::DATA_DIR . 'news/';
|
||||
|
||||
@ -124,11 +124,12 @@ class news extends common
|
||||
$feeds = new \FeedWriter\RSS2();
|
||||
|
||||
// En-tête
|
||||
$feeds->setTitle($this->getData(['page', $this->getUrl(0), 'title']) ? $this->getData(['page', $this->getUrl(0), 'title']): '');
|
||||
$feeds->setTitle($this->getData(['page', $this->getUrl(0), 'title']) ? $this->getData(['page', $this->getUrl(0), 'title']) : '');
|
||||
$feeds->setLink(helper::baseUrl() . $this->getUrl(0));
|
||||
if ($this->getData(['page', $this->getUrl(0), 'metaDescription'])) {
|
||||
$feeds->setDescription($this->getData(['page', $this->getUrl(0), 'metaDescription']));
|
||||
};
|
||||
}
|
||||
;
|
||||
$feeds->setChannelElement('language', 'fr-FR');
|
||||
$feeds->setDate(date('r', time()));
|
||||
$feeds->addGenerator();
|
||||
@ -174,7 +175,8 @@ class news extends common
|
||||
$publishedOn = $this->getInput('newsAddPublishedOn', helper::FILTER_DATETIME, true);
|
||||
$publishedOff = $this->getInput('newsAddPublishedOff') ? $this->getInput('newsAddPublishedOff', helper::FILTER_DATETIME) : '';
|
||||
$this->setData([
|
||||
'module', $this->getUrl(0),
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
'posts',
|
||||
$newsId,
|
||||
[
|
||||
@ -288,7 +290,8 @@ class news extends common
|
||||
// Fin feuille de style
|
||||
|
||||
$this->setData([
|
||||
'module', $this->getUrl(0),
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
'theme',
|
||||
[
|
||||
'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' : '',
|
||||
@ -300,7 +303,8 @@ class news extends common
|
||||
]);
|
||||
|
||||
$this->setData([
|
||||
'module', $this->getUrl(0),
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
'config',
|
||||
[
|
||||
'feeds' => $this->getInput('newsOptionShowFeeds', helper::FILTER_BOOLEAN),
|
||||
@ -310,7 +314,9 @@ class news extends common
|
||||
'height' => $this->getInput('newsOptionHeight', helper::FILTER_INT, true),
|
||||
'dateFormat' => $this->getInput('newsOptionDateFormat'),
|
||||
'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']),
|
||||
]
|
||||
]);
|
||||
@ -318,7 +324,7 @@ class news extends common
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/option',
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => helper::translate('Modifications enregistrées'),
|
||||
'state' => true
|
||||
]);
|
||||
@ -428,7 +434,8 @@ class news extends common
|
||||
$publishedOn = $this->getInput('newsEditPublishedOn', helper::FILTER_DATETIME, true);
|
||||
$publishedOff = $this->getInput('newsEditPublishedOff') ? $this->getInput('newsEditPublishedOff', helper::FILTER_DATETIME) : '';
|
||||
$this->setData([
|
||||
'module', $this->getUrl(0),
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
'posts',
|
||||
$newsId,
|
||||
[
|
||||
@ -490,6 +497,8 @@ class news extends common
|
||||
}
|
||||
// L'article existe
|
||||
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']));
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -609,6 +618,14 @@ class news extends common
|
||||
// Mettre à jour la version
|
||||
$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']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -12,12 +12,28 @@
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="col6 newsDate textAlignRight">
|
||||
<!-- bloc signature et date -->
|
||||
<!-- bloc signature -->
|
||||
<?php echo template::ico('user'); ?>
|
||||
<?php echo $module::$articleSignature . ' - '; ?>
|
||||
<?php echo template::ico('calendar-empty'); ?>
|
||||
<?php echo helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI) . ' ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
|
||||
<!-- Bloc edition -->
|
||||
<!-- bloc date -->
|
||||
<?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 ' - '; ?>
|
||||
<?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 (
|
||||
$this->isConnected() === true
|
||||
and
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?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'])): ?>
|
||||
<div id="rssFeed">
|
||||
<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>'; ?>
|
||||
</h2>
|
||||
<div class="newsSignature">
|
||||
<!-- bloc signature -->
|
||||
<?php echo template::ico('user'); ?>
|
||||
<?php echo $news['userId'] . ' - '; ?>
|
||||
<?php echo template::ico('calendar-empty'); ?>
|
||||
<?php echo helper::dateUTF8($module::$dateFormat, $news['publishedOn'], self::$i18nUI) . ' ' . helper::dateUTF8($module::$timeFormat, $news['publishedOn'], self::$i18nUI); ?>
|
||||
<?php echo $news['userId']; ?>
|
||||
<!-- bloc Date -->
|
||||
<?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 ' - '; ?>
|
||||
<?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 (
|
||||
$this->isConnected() === true
|
||||
@ -32,10 +51,8 @@
|
||||
($this->getUser('group') === self::GROUP_ADMIN)
|
||||
)
|
||||
): ?>
|
||||
-
|
||||
<a
|
||||
href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsId; ?>">
|
||||
<?php echo template::ico('pencil'); ?> Éditer
|
||||
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsId; ?>">
|
||||
<?php echo template::ico('pencil', ['margin' => 'left']); ?> Éditer
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@ -51,7 +68,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</div>
|
||||
</article>
|
||||
<?php echo $module::$pages; ?>
|
||||
|
40
module/news/view/option/option.js.php
Normal file
40
module/news/view/option/option.js.php
Normal 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
|
||||
});
|
@ -10,28 +10,15 @@
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('newsOptionSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4><?php echo helper::translate('Paramètres'); ?></h4>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::select('newsOptionItemsperCol', $module::$columns, [
|
||||
'label' => 'Nombre de colonnes',
|
||||
'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 class="col3">
|
||||
<?php echo template::checkbox('newsOptionShowDate', true, 'Afficher la date', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'showDate']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
@ -40,7 +27,12 @@
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat'])
|
||||
]); ?>
|
||||
</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, [
|
||||
'label' => 'Format des heures',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat'])
|
||||
@ -48,42 +40,62 @@
|
||||
</div>
|
||||
</div>
|
||||
<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">
|
||||
<?php echo template::checkbox('newsOptionShowFeeds', true, 'Lien du flux RSS', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
||||
'help' => 'Flux limité aux articles de la première page.'
|
||||
]); ?>
|
||||
</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">
|
||||
<?php echo template::text('newsOptionFeedslabel', [
|
||||
'label' => 'Étiquette RSS',
|
||||
'label' => 'Texte de l\'étiquette RSS',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4><?php echo helper::translate('Thème');?></h4>
|
||||
<h4><?php echo helper::translate('Thème'); ?></h4>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('newsThemeBorderStyle', $module::$borderStyle, [
|
||||
'label' => 'Bordure',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderStyle'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme', 'borderStyle'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('newsThemeBorderWidth', $module::$borderWidth, [
|
||||
'label' => 'Épaisseur',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderWidth'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme', 'borderWidth'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
@ -91,7 +103,7 @@
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
|
||||
'label' => 'Couleur de la bordure',
|
||||
'value' => $this->getData(['module', $this->getUrl(0),'theme', 'borderColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'theme', 'borderColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
@ -99,13 +111,13 @@
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
|
||||
'label' => 'Couleur du fond',
|
||||
'value' => $this->getData(['module', $this->getUrl(0),'theme', 'backgroundColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'theme', 'backgroundColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
|
Loading…
Reference in New Issue
Block a user