dates formatées
This commit is contained in:
parent
f50689dd38
commit
3db572f633
|
@ -7,6 +7,23 @@
|
||||||
// Lexique
|
// Lexique
|
||||||
include('./core/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_core.php');
|
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
|
// Création du brouillon s'il n'existe pas
|
||||||
if( !isset($_SESSION['draftPage'])){
|
if( !isset($_SESSION['draftPage'])){
|
||||||
$_SESSION['draftPage'] = [];
|
$_SESSION['draftPage'] = [];
|
||||||
|
@ -81,11 +98,15 @@ if($this->isPost() && isset($_POST['commentPageFormSubmit']) ) {
|
||||||
// Crée les données, l'indice des messages est la date unix
|
// Crée les données, l'indice des messages est la date unix
|
||||||
$id = time();
|
$id = time();
|
||||||
$this->setData(['comment', $this->getUrl(0), 'data', $id , $data]);
|
$this->setData(['comment', $this->getUrl(0), 'data', $id , $data]);
|
||||||
// Ajout de la date en clair pour les données dans le json
|
// Enregistrement de la date formatée
|
||||||
if( $this->getData(['config', 'i18n', 'langAdmin']) === 'en' ){
|
if( function_exists('datefmt_create') && function_exists('datefmt_format') && extension_loaded('intl') ){
|
||||||
$dateMessage = date('m/d/Y H:i', $id);
|
$dateMessage = datefmt_format($fmt, strtotime( date('Y/m/d H:i:s',$id)));
|
||||||
} else {
|
} 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 ]);
|
$this->setData(['comment', $this->getUrl(0), 'data', $id , 'Date' , $dateMessage ]);
|
||||||
// Liste des utilisateurs
|
// Liste des utilisateurs
|
||||||
|
@ -182,7 +203,7 @@ if ( NULL !== $dataPage && is_array($dataPage) && $dataPage !== [] ) {
|
||||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||||
$content = '';
|
$content = '';
|
||||||
$dataKeys = array_keys($dataPage[$i]);
|
$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>';
|
$content .= '<div class="dataComment">' . $dataPage[$i][$dataKeys[1]] . '</div></div></div><br>';
|
||||||
$data[] = [$content];
|
$data[] = [$content];
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ $text['core']['showComment'][8] = 'Send';
|
||||||
$text['core']['showComment'][9] = 'Name or nickname';
|
$text['core']['showComment'][9] = 'Name or nickname';
|
||||||
$text['core']['showComment'][10] = 'Comment';
|
$text['core']['showComment'][10] = 'Comment';
|
||||||
$text['core']['showComment'][11] = 'Page ';
|
$text['core']['showComment'][11] = 'Page ';
|
||||||
$text['core']['showComment'][12] = ' posted this comment on ';
|
$text['core']['showComment'][12] = ' on ';
|
||||||
// core.js.php
|
// core.js.php
|
||||||
$text['core_js'][0] = "Updating ?";
|
$text['core_js'][0] = "Updating ?";
|
||||||
// Select File
|
// Select File
|
||||||
|
|
|
@ -42,7 +42,7 @@ $text['core']['showComment'][8] = 'Enviar';
|
||||||
$text['core']['showComment'][9] = 'Nombre o apodo';
|
$text['core']['showComment'][9] = 'Nombre o apodo';
|
||||||
$text['core']['showComment'][10] = 'Comentario';
|
$text['core']['showComment'][10] = 'Comentario';
|
||||||
$text['core']['showComment'][11] = 'Página ';
|
$text['core']['showComment'][11] = 'Página ';
|
||||||
$text['core']['showComment'][12] = ' publicó este comentario en ';
|
$text['core']['showComment'][12] = ' en ';
|
||||||
// core.js.php
|
// core.js.php
|
||||||
$text['core_js'][0] = "¿Realizar actualización?";
|
$text['core_js'][0] = "¿Realizar actualización?";
|
||||||
// Seleccione Archivo
|
// Seleccione Archivo
|
||||||
|
|
|
@ -42,7 +42,7 @@ $text['core']['showComment'][8] = 'Envoyer';
|
||||||
$text['core']['showComment'][9] = 'Nom ou pseudo';
|
$text['core']['showComment'][9] = 'Nom ou pseudo';
|
||||||
$text['core']['showComment'][10] = 'Commentaire';
|
$text['core']['showComment'][10] = 'Commentaire';
|
||||||
$text['core']['showComment'][11] = 'Page ';
|
$text['core']['showComment'][11] = 'Page ';
|
||||||
$text['core']['showComment'][12] = ' a posté ce commentaire le ';
|
$text['core']['showComment'][12] = ' le ';
|
||||||
|
|
||||||
// core.js.php
|
// core.js.php
|
||||||
$text['core_js'][0] = "Effectuer la mise à jour ?";
|
$text['core_js'][0] = "Effectuer la mise à jour ?";
|
||||||
|
|
|
@ -50,10 +50,6 @@
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msgs .block .dataNameDate span{
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
.msgs .block .dataComment{
|
.msgs .block .dataComment{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue