Backport R2197 - registration stats by langauge, ticket #441 - for Mariette

This commit is contained in:
james 2011-03-14 19:26:44 +00:00
parent 4a6f9d0e4e
commit 17f6feee93

View File

@ -97,7 +97,8 @@ else $wherestatus="";
projects.title,
projects.projectnumber,
projects.projectcategories_id,
projects.projectdivisions_id
projects.projectdivisions_id,
projects.language
FROM
registrations
left outer join projects on projects.registrations_id=registrations.id
@ -118,7 +119,9 @@ else $wherestatus="";
$stats_projects_catdiv=array();
$stats_students_schools=array();
$stats_projects_schools=array();
$stats_projects_lang=array();
$schools_names=array();
$languages=array();
while($r=mysql_fetch_object($q))
{
@ -126,6 +129,8 @@ else $wherestatus="";
$stats_divisions[$r->projectdivisions_id]++;
$stats_categories[$r->projectcategories_id]++;
$stats_projects_catdiv[$r->projectcategories_id][$r->projectdivisions_id]++;
$stats_projects_lang[$r->projectcategories_id][$r->projectdivisions_id][$r->language]++;
$languages[$r->language]++;
switch($r->status)
{
@ -257,6 +262,70 @@ else $wherestatus="";
echo i18n("%1 schools total",array(count($schools_names)));
echo "</td></tr>";
echo "<tr><td colspan=\"2\"><br /></td></tr>";
echo "<tr><td colspan=\"2\"><h3>{$status_str[$showstatus]} - ".i18n("Projects per age category / division / language")."</h3></td></tr>";
echo "<tr><td colspan=\"2\">";
echo "<table class=\"tableview\" width=\"100%\">";
echo "<thead><tr><td rowspan='2' width=\"50%\"></td>";
foreach($cats AS $c=>$cn) {
echo "<th colspan='".count($languages)."'>$cn</th>";
}
echo "<th colspan='".count($languages)."'>".i18n("Total")."</nobr></th>";
echo "</tr><tr>";
ksort($languages);
$tprojcat = array();
foreach($cats AS $c=>$cn) {
foreach($languages AS $l=>$ln) {
echo "<th>$l</th>";
}
}
foreach($languages AS $l=>$ln) {
echo "<th>$l</th>";
}
echo "</tr></thead>";
foreach($divs AS $d=>$dn) {
echo "<tr><td>$dn</td>";
$tproj=array();
foreach($cats AS $c=>$cn)
{
foreach($languages AS $l=>$ln) {
echo "<td align=\"center\">";
echo ($stats_projects_lang[$c][$d][$l]?$stats_projects_lang[$c][$d][$l]:0);
echo "</td>";
$tproj[$l]+=$stats_projects_lang[$c][$d][$l];
$tprojcat[$c][$l]+=$stats_projects_lang[$c][$d][$l];
}
}
foreach($tproj AS $l=>$ln) {
echo "<td align=\"center\"><b>";
echo ($ln?$ln:0);
echo "</b></td>";
}
echo "</tr>";
}
echo "<tr><td><b>".i18n("Total")."</b></td>";
$tproj=array();
foreach($cats AS $c=>$cn) {
foreach($languages AS $l=>$ln) {
echo "<td align=\"center\"><b>";
echo ($tprojcat[$c][$l]?$tprojcat[$c][$l]:0);
echo "</b></td>";
$tproj[$l]+=$tprojcat[$c][$l];
}
}
foreach($tproj AS $l=>$ln) {
echo "<td align=\"center\"><b>";
echo ($ln);
echo "</b></td>";
}
echo "</tr>";
echo "</table>";
echo "</td></tr>";
echo "</table>";
echo "<br />";