Blog date and time format WIP

This commit is contained in:
Fred Tempez 2023-02-10 17:19:38 +01:00
parent 2b68bb2659
commit 46482b7d2b
10 changed files with 45 additions and 13 deletions

View File

@ -16,7 +16,7 @@
class blog extends common
{
const VERSION = '6.4';
const VERSION = '6.5';
const REALNAME = 'Blog';
const DELETE = true;
const UPDATE = '0.0';
@ -112,6 +112,25 @@ class blog extends common
];
public static $dateFormats = [
'%d %B %Y' => 'DD MMMM YYYY',
'%d/%m/%Y' => 'DD/MM/YYYY',
'%m/%d/%Y' => 'MM/DD/YYYY',
'%d/%m/%y' => 'DD/MM/YY',
'%m/%d/%y' => 'MM/DD/YY',
'%d-%m-%Y' => 'DD-MM-YYYY',
'%m-%d-%Y' => 'MM-DD-YYYY',
'%d-%m-%y' => 'DD-MM-YY',
'%m-%d-%y' => 'MM-DD-YY',
];
public static $timeFormats = [
'%H:%M' => 'HH:MM',
'%I:%M:%S %p' => "HH:MM tt",
];
public static $timeFormat = '';
public static $dateFormat = '';
// Nombre d'articles dans la page de config:
public static $itemsperPage = 8;
@ -519,6 +538,8 @@ class blog extends common
'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT, true),
'articlesLenght' => $this->getInput('blogOptionArticlesLenght', helper::FILTER_INT),
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
'dateFormat' => $this->getInput('blogOptionDateFormat', helper::FILTER_STRING_SHORT),
'timeFormat' => $this->getInput('blogOptionTimeFormat', helper::FILTER_STRING_SHORT),
]]);
// Valeurs en sortie
$this->addOutput([
@ -812,6 +833,9 @@ class blog extends common
for ($i = $pagination['first']; $i < $pagination['last']; $i++) {
self::$articles[$articleIds[$i]] = $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i]]);
}
// Format de temps
self::$dateFormat = $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat']);
self::$timeFormat = $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat']);
// Valeurs en sortie
$this->addOutput([
'showBarEditButton' => true,

View File

@ -1,4 +1,6 @@
# version 6.4
- Formats de date
# version 6.4
- Multilingisme
# version 6.31
- Miniature de l'image dans le flux RSS

View File

@ -36,7 +36,6 @@
"Grande": "Large",
"Groupe du propriétaire": "Owner's group",
"Image de couverture": "Coverage",
"Index des articles": "Index des articles",
"Informations générales": "General informations",
"L'article n'est visible qu'après la date de publication prévue.": "The article is only visible after the date of publication provided.",
"Largeur de l'image": "Image width",

View File

@ -36,7 +36,6 @@
"Grande": "Grande",
"Groupe du propriétaire": "Grupo de propietarios",
"Image de couverture": "Imagen de portada",
"Index des articles": "Índice de artículos",
"Informations générales": "Información general",
"L'article n'est visible qu'après la date de publication prévue.": "El artículo solo es visible después de la fecha de publicación programada.",
"Largeur de l'image": "Ancho de la imagen",

View File

@ -36,7 +36,6 @@
"Grande": "",
"Groupe du propriétaire": "",
"Image de couverture": "",
"Index des articles": "",
"Informations générales": "",
"L'article n'est visible qu'après la date de publication prévue.": "",
"Largeur de l'image": "",

View File

@ -36,7 +36,6 @@
"Grande": "Μεγάλη",
"Groupe du propriétaire": "Ομάδα ιδιοκτήτη",
"Image de couverture": "εικόνα εξωφύλλου",
"Index des articles": "Ευρετήριο άρθρων",
"Informations générales": "Γενικές πληροφορίες",
"L'article n'est visible qu'après la date de publication prévue.": "Το άρθρο είναι ορατό μόνο μετά την προγραμματισμένη ημερομηνία δημοσίευσης",
"Largeur de l'image": "Πλάτος εικόνας",

View File

@ -36,7 +36,7 @@
"Grande": "Grande",
"Groupe du propriétaire": "Gruppo del proprietario",
"Image de couverture": "Copertura",
"Index des articles": "Articoli indicizzati",
"Informations générales": "Informazioni generali",
"L'article n'est visible qu'après la date de publication prévue.": "L'articolo è visibile solo dopo la data di pubblicazione fornita.",
"Largeur de l'image": "Larghezza dell'immagine",

View File

@ -36,7 +36,6 @@
"Grande": "Grande",
"Groupe du propriétaire": "Grupo do proprietário",
"Image de couverture": "Cobertura",
"Index des articles": "ÍNDICE DES ARTIGOS",
"Informations générales": "Informações gerais",
"L'article n'est visible qu'après la date de publication prévue.": "O artigo é visível apenas após a data da publicação fornecida.",
"Largeur de l'image": "Largura da imagem",

View File

@ -17,7 +17,7 @@
<?php echo template::ico('user'); ?>
<?php echo $module->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
<?php echo template::ico('calendar-empty'); ?>
<?php echo helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' - ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' - ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?>
</div>
</div>
<div class="row">
@ -130,7 +130,7 @@
<?php echo template::ico('user'); ?>
<?php echo $module->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId']));?>
<?php echo template::ico('calendar-empty'); ?>
<?php echo helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' - ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' - ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?>
</div>
<p class="blogContent">
<?php $lenght = $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) !== 0 ? $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) : 500 ?>

View File

@ -14,21 +14,32 @@
<div class="row">
<div class="col12">
<div class="block">
<h4><?php echo helper::translate('Index des articles');?></h4>
<h4><?php echo helper::translate('Paramètres');?></h4>
<div class="row">
<div class="col6">
<div class="col3">
<?php echo template::select('blogOptionArticlesLenght', $module::$articlesLenght, [
'label' => 'Disposition',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght'])
]); ?>
</div>
<div class="col6">
<div class="col3">
<?php echo template::select('blogOptionItemsperPage', $module::$ArticlesListed, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage'])
]); ?>
</div>
<div class="col3">
<?php echo template::select('blogOptionDateFormat', $module::$dateFormats, [
'label' => 'Format des dates',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat'])
]); ?>
</div>
<div class="col3">
<?php echo template::select('blogOptionDateFormat', $module::$timeFormats, [
'label' => 'Format des heures',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat'])
]); ?>
</div>
</div>
</div>
</div>