Browse Source

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

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2702 a333f486-631f-4898-b8df-5754b55c2be0
romainq 12 years ago
parent
commit
1e37f957b6

+ 2 - 2
application/dashlet.class.inc.php

@@ -458,7 +458,7 @@ abstract class DashletGroupBy extends Dashlet
 
 
 				case 'month':
 				case 'month':
 					$sGroupByLabel = Dict::Format('UI:DashletGroupBy:Prop-GroupBy:Month', $sAttLabel);
 					$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;
 					break;
 
 
 				case 'day_of_week':
 				case 'day_of_week':
@@ -468,7 +468,7 @@ abstract class DashletGroupBy extends Dashlet
 
 
 				case 'day_of_month':
 				case 'day_of_month':
 					$sGroupByLabel = Dict::Format('UI:DashletGroupBy:Prop-GroupBy:DayOfMonth', $sAttLabel);
 					$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;
 					break;
 
 
 				default:
 				default:

+ 46 - 14
core/expression.class.inc.php

@@ -879,31 +879,63 @@ class FunctionExpression extends Expression
 	 */	
 	 */	
 	public function MakeValueLabel($oFilter, $sValue, $sDefault)
 	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;
 		$sRes = $sDefault;
 		if (strtolower($this->m_sVerb) == 'date_format')
 		if (strtolower($this->m_sVerb) == 'date_format')
 		{
 		{
 			$oFormatExpr = $this->m_aArgs[1];
 			$oFormatExpr = $this->m_aArgs[1];
 			if ($oFormatExpr->Render() == "'%w'")
 			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]))
 				if (isset($aWeekDayToString[(int)$sValue]))
 				{
 				{
 					$sRes = $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;
 		return $sRes;
 	}
 	}

+ 12 - 0
dictionaries/de.dictionary.itop.ui.php

@@ -946,6 +946,18 @@ Wenn Aktionen mit Trigger verknüpft sind, bekommt jede Aktion eine Auftragsnumm
 	'DayOfWeek-Thursday' => 'Donnerstag',
 	'DayOfWeek-Thursday' => 'Donnerstag',
 	'DayOfWeek-Friday' => 'Freitag',
 	'DayOfWeek-Friday' => 'Freitag',
 	'DayOfWeek-Saturday' => 'Samstag',
 	'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',
 	'UI:FillAllMandatoryFields' => 'Bitte füllen Sie alle Pflichtfelder',
 ));
 ));
 ?>
 ?>

+ 12 - 0
dictionaries/dictionary.itop.ui.php

@@ -1123,6 +1123,18 @@ When associated with a trigger, each action is given an "order" number, specifyi
 	'DayOfWeek-Thursday' => 'Thursday',
 	'DayOfWeek-Thursday' => 'Thursday',
 	'DayOfWeek-Friday' => 'Friday',
 	'DayOfWeek-Friday' => 'Friday',
 	'DayOfWeek-Saturday' => 'Saturday',
 	'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:Menu:ShortcutList' => 'Create a Shortcut...',
 	'UI:ShortcutRenameDlg:Title' => 'Rename the shortcut',
 	'UI:ShortcutRenameDlg:Title' => 'Rename the shortcut',

+ 13 - 0
dictionaries/es_cr.dictionary.itop.ui.php

@@ -1122,6 +1122,19 @@ Cuando se asocien con un disparador, cada acción recibe un número de "orden",
 	'DayOfWeek-Thursday' => 'Jueves',
 	'DayOfWeek-Thursday' => 'Jueves',
 	'DayOfWeek-Friday' => 'Viernes',
 	'DayOfWeek-Friday' => 'Viernes',
 	'DayOfWeek-Saturday' => 'Sábado',
 	'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',
 ));
 ));
 
 
 //
 //

+ 12 - 0
dictionaries/fr.dictionary.itop.ui.php

@@ -965,6 +965,18 @@ Lors de l\'association à un déclencheur, on attribue à chaque action un numé
 	'DayOfWeek-Thursday' => 'Jeudi',
 	'DayOfWeek-Thursday' => 'Jeudi',
 	'DayOfWeek-Friday' => 'Vendredi',
 	'DayOfWeek-Friday' => 'Vendredi',
 	'DayOfWeek-Saturday' => 'Samedi',
 	'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:Menu:ShortcutList' => 'Créer un Raccourci...',
 	'UI:ShortcutListDlg:Title' => 'Créer un raccourci pour la liste',
 	'UI:ShortcutListDlg:Title' => 'Créer un raccourci pour la liste',