dates formatées

This commit is contained in:
Deltacms 2024-02-18 09:53:23 +01:00
parent f50689dd38
commit 3db572f633
5 changed files with 30 additions and 13 deletions

View File

@ -7,6 +7,23 @@
// Lexique
include('./core/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_core.php');
// Pour les dates suivant la langue de rédaction du site (langue principale ou langue de traduction rédigée)
if( function_exists('datefmt_create') && function_exists('datefmt_format') && extension_loaded('intl') ){
if( isset( $_SESSION['langFrontEnd']) && isset( $_SESSION['translationType']) && $_SESSION['translationType'] === 'site' ){
$lang_date = $_SESSION['langFrontEnd'];
} else {
$lang_date = $this->getData(['config', 'i18n', 'langBase']);
}
$zone = 'Europe/Paris';
$fmt = datefmt_create(
$lang_date,
IntlDateFormatter::LONG,
IntlDateFormatter::SHORT,
$zone,
IntlDateFormatter::GREGORIAN
);
}
// Création du brouillon s'il n'existe pas
if( !isset($_SESSION['draftPage'])){
$_SESSION['draftPage'] = [];
@ -81,12 +98,16 @@ if($this->isPost() && isset($_POST['commentPageFormSubmit']) ) {
// Crée les données, l'indice des messages est la date unix
$id = time();
$this->setData(['comment', $this->getUrl(0), 'data', $id , $data]);
// Ajout de la date en clair pour les données dans le json
if( $this->getData(['config', 'i18n', 'langAdmin']) === 'en' ){
$dateMessage = date('m/d/Y H:i', $id);
// Enregistrement de la date formatée
if( function_exists('datefmt_create') && function_exists('datefmt_format') && extension_loaded('intl') ){
$dateMessage = datefmt_format($fmt, strtotime( date('Y/m/d H:i:s',$id)));
} else {
$dateMessage = date('d/m/Y H:i', $id);
}
if( mb_detect_encoding(date('d/m/Y - H:i', $id), 'UTF-8', true)){
$dateMessage = date('d/m/Y - H:i', $id);
} else {
$dateMessage = utf8_encode(date('d/m/Y - H:i', $id));
}
}
$this->setData(['comment', $this->getUrl(0), 'data', $id , 'Date' , $dateMessage ]);
// Liste des utilisateurs
$userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname');
@ -182,7 +203,7 @@ if ( NULL !== $dataPage && is_array($dataPage) && $dataPage !== [] ) {
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
$content = '';
$dataKeys = array_keys($dataPage[$i]);
$content .= '<div class="msgs"><div class="block"><div class="dataNameDate blockTitle">'. $dataPage[$i][$dataKeys[0]] . '<span>'. $text['core']['showComment'][12] .' </span>' . $dataPage[$i][$dataKeys[2]] .'</div>';
$content .= '<div class="msgs"><div class="block"><div class="dataNameDate blockTitle">'. $dataPage[$i][$dataKeys[0]] . $text['core']['showComment'][12] . $dataPage[$i][$dataKeys[2]] .'</div>';
$content .= '<div class="dataComment">' . $dataPage[$i][$dataKeys[1]] . '</div></div></div><br>';
$data[] = [$content];
}

View File

@ -42,7 +42,7 @@ $text['core']['showComment'][8] = 'Send';
$text['core']['showComment'][9] = 'Name or nickname';
$text['core']['showComment'][10] = 'Comment';
$text['core']['showComment'][11] = 'Page ';
$text['core']['showComment'][12] = ' posted this comment on ';
$text['core']['showComment'][12] = ' on ';
// core.js.php
$text['core_js'][0] = "Updating ?";
// Select File

View File

@ -42,7 +42,7 @@ $text['core']['showComment'][8] = 'Enviar';
$text['core']['showComment'][9] = 'Nombre o apodo';
$text['core']['showComment'][10] = 'Comentario';
$text['core']['showComment'][11] = 'Página ';
$text['core']['showComment'][12] = ' publicó este comentario en ';
$text['core']['showComment'][12] = ' en ';
// core.js.php
$text['core_js'][0] = "¿Realizar actualización?";
// Seleccione Archivo

View File

@ -42,7 +42,7 @@ $text['core']['showComment'][8] = 'Envoyer';
$text['core']['showComment'][9] = 'Nom ou pseudo';
$text['core']['showComment'][10] = 'Commentaire';
$text['core']['showComment'][11] = 'Page ';
$text['core']['showComment'][12] = ' a posté ce commentaire le ';
$text['core']['showComment'][12] = ' le ';
// core.js.php
$text['core_js'][0] = "Effectuer la mise à jour ?";

View File

@ -50,10 +50,6 @@
font-weight: normal;
}
.msgs .block .dataNameDate span{
font-style: italic;
}
.msgs .block .dataComment{
}