#715 Group by day -> month+day, group by month -> year+month, months are shown as a localized label

SVN:trunk[2702]
This commit is contained in:
Romain Quetiez
2013-04-26 09:46:31 +00:00
parent 4ea0093f12
commit f97f51b895
6 changed files with 97 additions and 16 deletions

View File

@@ -458,7 +458,7 @@ abstract class DashletGroupBy extends Dashlet
case 'month':
$sGroupByLabel = Dict::Format('UI:DashletGroupBy:Prop-GroupBy:Month', $sAttLabel);
$sGroupByExpr = "DATE_FORMAT($sClassAlias.$sAttCode, '%m')"; // 0 -> 31
$sGroupByExpr = "DATE_FORMAT($sClassAlias.$sAttCode, '%Y-%m')"; // yyyy-mm
break;
case 'day_of_week':
@@ -468,7 +468,7 @@ abstract class DashletGroupBy extends Dashlet
case 'day_of_month':
$sGroupByLabel = Dict::Format('UI:DashletGroupBy:Prop-GroupBy:DayOfMonth', $sAttLabel);
$sGroupByExpr = "DATE_FORMAT($sClassAlias.$sAttCode, '%e')"; // 0 -> 31
$sGroupByExpr = "DATE_FORMAT($sClassAlias.$sAttCode, '%m-%d')"; // mm-dd
break;
default:

View File

@@ -879,31 +879,63 @@ class FunctionExpression extends Expression
*/
public function MakeValueLabel($oFilter, $sValue, $sDefault)
{
static $aWeekDayToString = null;
if (is_null($aWeekDayToString))
{
// Init the correspondance table
$aWeekDayToString = array(
0 => Dict::S('DayOfWeek-Sunday'),
1 => Dict::S('DayOfWeek-Monday'),
2 => Dict::S('DayOfWeek-Tuesday'),
3 => Dict::S('DayOfWeek-Wednesday'),
4 => Dict::S('DayOfWeek-Thursday'),
5 => Dict::S('DayOfWeek-Friday'),
6 => Dict::S('DayOfWeek-Saturday')
);
}
static $aMonthToString = null;
if (is_null($aMonthToString))
{
// Init the correspondance table
$aMonthToString = array(
1 => Dict::S('Month-01'),
2 => Dict::S('Month-02'),
3 => Dict::S('Month-03'),
4 => Dict::S('Month-04'),
5 => Dict::S('Month-05'),
6 => Dict::S('Month-06'),
7 => Dict::S('Month-07'),
8 => Dict::S('Month-08'),
9 => Dict::S('Month-09'),
10 => Dict::S('Month-10'),
11 => Dict::S('Month-11'),
12 => Dict::S('Month-12'),
);
}
$sRes = $sDefault;
if (strtolower($this->m_sVerb) == 'date_format')
{
$oFormatExpr = $this->m_aArgs[1];
if ($oFormatExpr->Render() == "'%w'")
{
static $aWeekDayToString = null;
if (is_null($aWeekDayToString))
{
// Init the correspondance table
$aWeekDayToString = array(
0 => Dict::S('DayOfWeek-Sunday'),
1 => Dict::S('DayOfWeek-Monday'),
2 => Dict::S('DayOfWeek-Tuesday'),
3 => Dict::S('DayOfWeek-Wednesday'),
4 => Dict::S('DayOfWeek-Thursday'),
5 => Dict::S('DayOfWeek-Friday'),
6 => Dict::S('DayOfWeek-Saturday')
);
}
if (isset($aWeekDayToString[(int)$sValue]))
{
$sRes = $aWeekDayToString[(int)$sValue];
}
}
elseif ($oFormatExpr->Render() == "'%Y-%m'")
{
// yyyy-mm
$iMonth = (int) substr($sValue, -2); // the two last chars
$sRes = substr($sValue, 0, 4).' '.$aMonthToString[$iMonth];
}
elseif ($oFormatExpr->Render() == "'%m-%d'")
{
// mm-dd
$iMonth = (int) substr($sValue, 0, 2); // the two first chars
$sRes = $aMonthToString[$iMonth].' '.substr($sValue, -2);
}
}
return $sRes;
}

View File

@@ -946,6 +946,18 @@ Wenn Aktionen mit Trigger verknüpft sind, bekommt jede Aktion eine Auftragsnumm
'DayOfWeek-Thursday' => 'Donnerstag',
'DayOfWeek-Friday' => 'Freitag',
'DayOfWeek-Saturday' => 'Samstag',
'Month-01' => 'Januar',
'Month-02' => 'Februar',
'Month-03' => 'März',
'Month-04' => 'April',
'Month-05' => 'Mai',
'Month-06' => 'Juni',
'Month-07' => 'Juli',
'Month-08' => 'August',
'Month-09' => 'September',
'Month-10' => 'Oktober',
'Month-11' => 'November',
'Month-12' => 'Dezember',
'UI:FillAllMandatoryFields' => 'Bitte füllen Sie alle Pflichtfelder',
));
?>

View File

@@ -1123,6 +1123,18 @@ When associated with a trigger, each action is given an "order" number, specifyi
'DayOfWeek-Thursday' => 'Thursday',
'DayOfWeek-Friday' => 'Friday',
'DayOfWeek-Saturday' => 'Saturday',
'Month-01' => 'January',
'Month-02' => 'February',
'Month-03' => 'March',
'Month-04' => 'April',
'Month-05' => 'May',
'Month-06' => 'June',
'Month-07' => 'July',
'Month-08' => 'August',
'Month-09' => 'September',
'Month-10' => 'October',
'Month-11' => 'November',
'Month-12' => 'December',
'UI:Menu:ShortcutList' => 'Create a Shortcut...',
'UI:ShortcutRenameDlg:Title' => 'Rename the shortcut',

View File

@@ -1122,6 +1122,19 @@ Cuando se asocien con un disparador, cada acción recibe un número de "orden",
'DayOfWeek-Thursday' => 'Jueves',
'DayOfWeek-Friday' => 'Viernes',
'DayOfWeek-Saturday' => 'Sábado',
'Month-01' => 'Enero',
'Month-02' => 'Febrero',
'Month-03' => 'Marzo',
'Month-04' => 'Abril',
'Month-05' => 'Mayo',
'Month-06' => 'Junio',
'Month-07' => 'Julio',
'Month-08' => 'Agosto',
'Month-09' => 'Septiembre',
'Month-10' => 'Octubre',
'Month-11' => 'Noviembre',
'Month-12' => 'Diciembre',
));
//

View File

@@ -965,6 +965,18 @@ Lors de l\'association à un déclencheur, on attribue à chaque action un numé
'DayOfWeek-Thursday' => 'Jeudi',
'DayOfWeek-Friday' => 'Vendredi',
'DayOfWeek-Saturday' => 'Samedi',
'Month-01' => 'Janvier',
'Month-02' => 'Février',
'Month-03' => 'Mars',
'Month-04' => 'Avril',
'Month-05' => 'Mai',
'Month-06' => 'Juin',
'Month-07' => 'Juillet',
'Month-08' => 'Août',
'Month-09' => 'Septembre',
'Month-10' => 'Octobre',
'Month-11' => 'Novembre',
'Month-12' => 'Décembre',
'UI:Menu:ShortcutList' => 'Créer un Raccourci...',
'UI:ShortcutListDlg:Title' => 'Créer un raccourci pour la liste',