Revision: 1827
http://mrbs.svn.sourceforge.net/mrbs/?rev=1827&view=rev
Author: cimorrison
Date: 2011-05-14 11:01:24 +0000 (Sat, 14 May 2011)
Log Message:
-----------
Added an option to report.php to summarize by type. Thamks to a patch
submitted by Thomas Bleher.
Modified Paths:
--------------
mrbs/trunk/web/lang.de
mrbs/trunk/web/lang.en
mrbs/trunk/web/report.php
Modified: mrbs/trunk/web/lang.de
===================================================================
--- mrbs/trunk/web/lang.de 2011-05-14 10:15:57 UTC (rev 1826)
+++ mrbs/trunk/web/lang.de 2011-05-14 11:01:24 UTC (rev 1827)
@@ -264,6 +264,7 @@
$vocab["summarize_by"] = "Zusammenfassung nach";
$vocab["sum_by_descrip"] = "Kurzbeschreibung";
$vocab["sum_by_creator"] = "Ersteller";
+$vocab["sum_by_type"] = "Typ";
$vocab["entry_found"] = "Eintrag gefunden";
$vocab["entries_found"] = "Einträge gefunden";
$vocab["summary_header"] = "Stundenzusammenfassung der Einträge";
Modified: mrbs/trunk/web/lang.en
===================================================================
--- mrbs/trunk/web/lang.en 2011-05-14 10:15:57 UTC (rev 1826)
+++ mrbs/trunk/web/lang.en 2011-05-14 11:01:24 UTC (rev 1827)
@@ -267,6 +267,7 @@
$vocab["summarize_by"] = "Summarize by";
$vocab["sum_by_descrip"] = "Brief description";
$vocab["sum_by_creator"] = "Creator";
+$vocab["sum_by_type"] = "Type";
$vocab["entry_found"] = "entry found";
$vocab["entries_found"] = "entries found";
$vocab["summary_header"] = "Summary of (Entries) Hours";
Modified: mrbs/trunk/web/report.php
===================================================================
--- mrbs/trunk/web/report.php 2011-05-14 10:15:57 UTC (rev 1826)
+++ mrbs/trunk/web/report.php 2011-05-14 11:01:24 UTC (rev 1827)
@@ -441,6 +441,29 @@
}
}
+
+function get_sumby_name_from_row(&$row)
+{
+ global $sumby, $typel;
+
+ // Use brief description, created by or type as the name:
+ switch( $sumby )
+ {
+ case 'd':
+ $name = $row['name'];
+ break;
+ case 't':
+ $name = $typel[ $row['type'] ];
+ break;
+ case 'c':
+ default:
+ $name = $row['create_by'];
+ break;
+ }
+ return escape($name);
+}
+
+
// Collect summary statistics on one entry. See below for columns in $row[].
// $sumby selects grouping on brief description (d) or created by (c).
// This also builds hash tables of all unique names and rooms. When sorted,
@@ -448,10 +471,9 @@
function accumulate(&$row, &$count, &$hours, $report_start, $report_end,
&$room_hash, &$name_hash)
{
- global $sumby;
global $output_as_csv;
- // Use brief description or created by as the name:
- $name = escape($row[($sumby == "d" ? 'name' : 'create_by')]);
+ // Use brief description, created by or type as the name:
+ $name = get_sumby_name_from_row($row);
// Area and room separated by break (if not CSV):
$room = escape($row['area_name']);
$room .= ($output_as_csv) ? '/' : "<br>";
@@ -468,14 +490,14 @@
function accumulate_periods(&$row, &$count, &$hours, $report_start,
$report_end, &$room_hash, &$name_hash)
{
- global $sumby;
global $periods;
global $output_as_csv;
$max_periods = count($periods);
- // Use brief description or created by as the name:
- $name = escape($row[($sumby == "d" ? 'name' : 'create_by')]);
+ // Use brief description, created by or type as the name:
+ $name = get_sumby_name_from_row($row);
+
// Area and room separated by break (if not CSV):
$room = escape($row['area_name']);
$room .= ($output_as_csv) ? '/' : "<br>";
@@ -1091,7 +1113,7 @@
$match_confirmed = CONFIRMED_BOTH;
}
-// $sumby: d=by brief description, c=by creator.
+// $sumby: d=by brief description, c=by creator, t=by type.
if (empty($sumby))
{
$sumby = "d";
@@ -1370,6 +1392,13 @@
echo ">" . get_vocab("sum_by_creator");
?>
</label>
+ <label>
+ <input class="radio" type="radio" name="sumby" value="t"
+ <?php
+ if ($sumby=="t") echo " checked=\"checked\"";
+ echo ">" . get_vocab("sum_by_type");
+ ?>
+ </label>
</div>
</div>
</fieldset>
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits