Skip to content

Commit e11f5dd

Browse files
author
redray
committed
improved displaying of dates.
1 parent 727ff9f commit e11f5dd

File tree

13 files changed

+88
-6
lines changed

13 files changed

+88
-6
lines changed

interface/lib/classes/listform.inc.php

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ class listform {
3838
private $pagingValues;
3939
private $searchChanged = 0;
4040
private $module;
41-
private $dateformat = 'Y-m-d H:i';
4241
public $wordbook;
4342

4443
public function loadListDef($file, $module = '')
@@ -280,7 +279,25 @@ public function decode($record)
280279
break;
281280

282281
case 'DATE':
283-
$record[$key] = ($record[$key] > 0) ? date($this->dateformat,$record[$key]) : '';
282+
if ($record[$key] > 0) {
283+
// is value int?
284+
if (ereg("^[0-9]+[.]?[0-9]*$", $record[$key], $p)) {
285+
$record[$key] = date($this->lng('conf_format_dateshort'), $record[$key]);
286+
} else {
287+
$record[$key] = date($this->lng('conf_format_dateshort'), strtotime($record[$key]));
288+
}
289+
}
290+
break;
291+
292+
case 'DATETIME':
293+
if ($record[$key] > 0) {
294+
// is value int?
295+
if (ereg("^[0-9]+[.]?[0-9]*$", $record[$key], $p)) {
296+
$record[$key] = date($this->lng('conf_format_datetime'), $record[$key]);
297+
} else {
298+
$record[$key] = date($this->lng('conf_format_datetime'), strtotime($record[$key]));
299+
}
300+
}
284301
break;
285302

286303
case 'INTEGER':
@@ -322,8 +339,13 @@ public function encode($record)
322339

323340
case 'DATE':
324341
if($record[$key] > 0) {
325-
list($tag,$monat,$jahr) = explode('.',$record[$key]);
326-
$record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
342+
$record[$key] = date('Y-m-d',strtotime($record[$key]));
343+
}
344+
break;
345+
346+
case 'DATETIME':
347+
if($record[$key] > 0) {
348+
$record[$key] = date('Y-m-d H:i:s',strtotime($record[$key]));
327349
}
328350
break;
329351

interface/lib/lang/bg.lng

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<?php
2+
$wb['conf_format_dateshort'] = 'Y-m-d';
3+
$wb['conf_format_datelong'] = 'l dS of F Y';
4+
$wb['conf_format_timeshort'] = 'H:i';
5+
$wb['conf_format_timelong'] = 'H:i:s';
6+
$wb['conf_format_datetime'] = 'Y-m-d H:i';
7+
28
$wb['301'] = 'Този модул не е разрешен за текущия потреител.';
39
$wb['302'] = 'Невалиден модул.';
410
$wb['1001'] = 'Потребителското име и паролата не могат да бъдат празни!';

interface/lib/lang/de.lng

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<?php
2+
$wb['conf_format_dateshort'] = 'd.m.Y';
3+
$wb['conf_format_datelong'] = 'l, d. F Y';
4+
$wb['conf_format_timeshort'] = 'H:i';
5+
$wb['conf_format_timelong'] = 'H:i:s';
6+
$wb['conf_format_datetime'] = 'd.m.Y H:i';
7+
28
$wb['301'] = 'Modul für Benutzer nicht erlaubt.';
39
$wb['302'] = 'Modul ungültig.';
410
$wb['1001'] = 'Der Benutzername und das Passwort dürfen nicht leer sein!';

interface/lib/lang/en.lng

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<?php
2+
$wb['conf_format_dateshort'] = 'Y-m-d';
3+
$wb['conf_format_datelong'] = 'l dS of F Y';
4+
$wb['conf_format_timeshort'] = 'H:i';
5+
$wb['conf_format_timelong'] = 'H:i:s';
6+
$wb['conf_format_datetime'] = 'Y-m-d H:i';
7+
28
$wb['301'] = 'Module not permitted for the current user.';
39
$wb['302'] = 'Module invalid.';
410
$wb['1001'] = 'The username and password cannot be empty !';

interface/lib/lang/es.lng

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<?php
2+
$wb['conf_format_dateshort'] = 'Y-m-d';
3+
$wb['conf_format_datelong'] = 'l dS of F Y';
4+
$wb['conf_format_timeshort'] = 'H:i';
5+
$wb['conf_format_timelong'] = 'H:i:s';
6+
$wb['conf_format_datetime'] = 'Y-m-d H:i';
7+
28
$wb['301'] = 'Modulo no permitido para el usuario actual.';
39
$wb['302'] = 'Modulo inválido.';
410
$wb['1001'] = '¡ El usuario y contraseña no pueden estar vacíos !';

interface/lib/lang/fi.lng

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<?php
2+
$wb['conf_format_dateshort'] = 'Y-m-d';
3+
$wb['conf_format_datelong'] = 'l dS of F Y';
4+
$wb['conf_format_timeshort'] = 'H:i';
5+
$wb['conf_format_timelong'] = 'H:i:s';
6+
$wb['conf_format_datetime'] = 'Y-m-d H:i';
7+
28
$wb['301'] = 'Tämä moduuli ei ole sallittu nykyiselle käyttäjälle.';
39
$wb['302'] = 'Viallinen moduuli.';
410
$wb['1001'] = 'Käyttäjätunnus ja/tai salasana eivät voi olla tyhjiä!';

interface/lib/lang/fr.lng

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<?php
2+
$wb['conf_format_dateshort'] = 'Y-m-d';
3+
$wb['conf_format_datelong'] = 'l dS of F Y';
4+
$wb['conf_format_timeshort'] = 'H:i';
5+
$wb['conf_format_timelong'] = 'H:i:s';
6+
$wb['conf_format_datetime'] = 'Y-m-d H:i';
7+
28
$wb['301'] = 'Module interdit pour lutilisateur courant.';
39
$wb['302'] = 'Module invalide.';
410
$wb['1001'] = 'The username and password must not be empty!';

interface/lib/lang/it.lng

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<?php
2+
$wb['conf_format_dateshort'] = 'Y-m-d';
3+
$wb['conf_format_datelong'] = 'l dS of F Y';
4+
$wb['conf_format_timeshort'] = 'H:i';
5+
$wb['conf_format_timelong'] = 'H:i:s';
6+
$wb['conf_format_datetime'] = 'Y-m-d H:i';
7+
28
$wb['301'] = 'Modulo non permesso per l`utente corrente.';
39
$wb['302'] = 'Modulo non valido.';
410
$wb['1001'] = 'Nome utente e password non possono essere vuoti!';

interface/lib/lang/nl.lng

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<?php
2+
$wb['conf_format_dateshort'] = 'Y-m-d';
3+
$wb['conf_format_datelong'] = 'l dS of F Y';
4+
$wb['conf_format_timeshort'] = 'H:i';
5+
$wb['conf_format_timelong'] = 'H:i:s';
6+
$wb['conf_format_datetime'] = 'Y-m-d H:i';
7+
28
$wb['301'] = 'Module niet toegestaan voor de huidige gebruiker.';
39
$wb['302'] = 'Ongeldige module.';
410
$wb['1001'] = 'De gebruikersnaam en wachtwoord kunnen niet leeg zijn!';

interface/lib/lang/ru.lng

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<?php
2+
$wb['conf_format_dateshort'] = 'Y-m-d';
3+
$wb['conf_format_datelong'] = 'l dS of F Y';
4+
$wb['conf_format_timeshort'] = 'H:i';
5+
$wb['conf_format_timelong'] = 'H:i:s';
6+
$wb['conf_format_datetime'] = 'Y-m-d H:i';
7+
28
$wb['301'] = 'Модуль недоступен для данной учетной записи.';
39
$wb['302'] = 'Модуль неправилен.';
410
$wb['1001'] = 'Имя или пароль не должны быть пустыми!';

0 commit comments

Comments
 (0)