public function getInfectonReportSummary() { # Returns HTML form elements for configuring infection report for country administrators # Called from reports.php # Fetch settings for all tests from dummy record $site_settings = GlobalInfectionReport::getByKeys($_SESSION['user_id'], 0, 0); ?> <div class='pretty_box' style='width:700px;'> <table class='hor-minimalist-b'> <tbody> <tr valign='top'> <td><?php echo "Group By Gender"; //LangUtil::$pageTerms['GROUP_BYGENDER']; ?></td> <td> <?php if($site_settings->groupByGender == 1) echo LangUtil::$generalTerms['YES']; else echo LangUtil::$generalTerms['NO']; ?> </td> </tr> <tr valign='top'> <td><?php echo "Group By Age"; //LangUtil::$pageTerms['GROUP_BYAGE']; ?></td> <td> <?php if($site_settings->groupByAge == 1) echo LangUtil::$generalTerms['YES']; else echo LangUtil::$generalTerms['NO']; ?> </td> </tr> <tr valign='top' <?php if($site_settings->groupByAge == 0) echo " style='display:none' "; ?>> <td><?php echo "Age Range"; //LangUtil::$pageTerms['RANGE_AGE']; ?> (<?php echo "Years"; //LangUtil::$generalTerms['YEARS']; ?>)</td> <td> <?php # Group by age enabled $age_parts = explode(",", $site_settings->ageGroups); foreach($age_parts as $age_part) { if(trim($age_part) == "") continue; $age_bounds = explode(":", $age_part); echo $age_bounds[0]."-".$age_bounds[1]; echo " "; } ?> </td> </tr> <?php # For each test with numeric range, show ranges $test_list = getTestTypesCountryLevel(); foreach($test_list as $test_type) { ?> <tr valign='top'> <td> <?php echo $test_type->getName(); ?> </td> <td> <?php $measure_to_set = false; $measure_list = $test_type->getMeasures(); ?> <?php $measure_count = 0; foreach($measure_list as $measure) { $disease_report = GlobalInfectionReport::getByKeys($_SESSION['user_id'], $test_type->testId, $measure->measureId); $measure_count++; if(strpos($measure->range, "/") !== false) { # Alphanumeric options # Do nothing //$range_options = explode("/", $measure->range); } else { # Numeric ranges # Show fields to select range slots $measure_to_set = true; if(count($measure_list) != 1) { # Show measure names if more than one. echo $measure->getName()." "; } $range_bounds = explode(":", $measure->range); if($disease_report == null) { # No entry exists. Show default values. echo $range_bounds[0]."-".$range_bounds[1]; } else { # Entries exist. Prefill form with these values. $slot_list = explode(",", $disease_report->measureGroups); foreach($slot_list as $slot_part) { if(trim($slot_part) == "") continue; $slot_bounds = explode(":", $slot_part); echo $slot_bounds[0]."-".$slot_bounds[1]; echo " "; } } echo "<br><br>"; } } if($measure_to_set === false) { echo "<small>"."No range configuration required"./*LangUtil::$pageTerms['RANGE_NOTREQD'].*/"</small><br><br>"; } ?> </td> </tr> <?php } ?> </tbody> </table> </div> <?php }
<tr> </thead> <tbody> <?php foreach ($selected_test_types as $test) { $currentMeasurecount = 0; StatsLib::setDiseaseSetListAggregate($lab_config_ids, $test, $date_from, $date_to); $measures = $test->getMeasures(); foreach ($measures as $measure) { $male_total = array(); $female_total = array(); $cross_gender_total = array(); $curr_male_total = 0; $curr_female_total = 0; $curr_cross_gender_total = 0; $disease_report = GlobalInfectionReport::getByKeys($_SESSION['user_id'], $test->testId, $measure->measureId); if ($disease_report == null) { # TODO: Check for error control # Alphanumeric values. Hence entry not found. //continue; break; } $is_range_options = true; if (strpos($measure->range, "/") === false) { $is_range_options = false; } $range_values = array(); if ($is_range_options) { # Alphanumeric options $range_values1 = explode("/", $measure->range); $range_values = str_replace("#", "/", $range_values1);
function publishValues($test, $measure, $age_total, $age_total1, $age_total2, $male_total, $female_total, $cross_gender_total, $grand_total) { global $site_settings; $disease_report = GlobalInfectionReport::getByKeys($_SESSION['user_id'], $test->testId, $measure->measureId); $is_range_options = true; if (strpos($measure->range, "/") === false) { $is_range_options = false; } $range_values = array(); if ($is_range_options) { # Alphanumeric options $range_values1 = explode("/", $measure->range); $range_values = str_replace("#", "/", $range_values1); } else { # Numeric ranges: Fetch ranges configured for this test-type/measure from DB $range_values = $disease_report->getMeasureGroupAsList(); } $row_id = "row_" . $test->testId . "_" . $measure->measureId; echo "<tr valign='top' id='{$row_id}'>"; echo "<td>" . $measure->name . "</td>"; echo "<td>"; foreach ($range_values as $range_value) { if ($is_range_options) { echo "{$range_value}<br>"; } else { echo "{$range_value['0']}-{$range_value['1']}<br>"; } if ($site_settings->groupByGender == 1) { echo "<br>"; } } echo "</td>"; if ($site_settings->groupByGender == 1) { # Group by gender set to true echo "<td>"; for ($i = 1; $i <= count($range_values); $i++) { echo "M<br>F<br>"; } echo "</td>"; } if ($site_settings->groupByAge == 1) { # Group by age set to true: Fetch age slots from DB $age_slot_list = $site_settings->getAgeGroupAsList(); $j = 0; foreach ($age_slot_list as $age_slot) { echo "<td>"; $k = 0; foreach ($range_values as $range_value) { $range_type = DiseaseSetFilter::$CONTINUOUS; if ($is_range_options == true) { $range_type = DiseaseSetFilter::$DISCRETE; } if ($site_settings->groupByGender == 0) { echo $age_total[$j][$k] . "<br>"; } else { echo $age_total1[$j][$k] . "<br>" . $age_total2[$j][$k] . "<br>"; } $k++; } $j++; echo "</td>"; } } else { # Age slots not configured: Show cumulative count for all age values $range_value_count = 0; foreach ($range_values as $range_value) { $range_type = DiseaseSetFilter::$CONTINUOUS; if ($is_range_options == true) { $range_type = DiseaseSetFilter::$DISCRETE; } if ($site_settings->groupByGender == 1) { echo "<td>"; for ($i = 1; $i <= count($range_values); $i++) { $this_male_total = $male_total[$i]; $this_female_total = $female_total[$i]; echo "{$this_male_total}<br>{$this_female_total}<br>"; $this_cross_gender_total = $this_male_total + $this_female_total; } echo "</td>"; } } } echo "<td>"; for ($i = 1; $i <= count($range_values); $i++) { if ($site_settings->groupByGender == 1) { echo $male_total[$i]; echo "<br>"; echo $female_total[$i]; echo "<br>"; } else { echo $cross_gender_total[$i]; echo "<br>"; } } echo "</td>"; echo "<td>"; for ($i = 1; $i <= count($cross_gender_total); $i++) { echo "{$cross_gender_total[$i]}<br><br>"; } echo "</td>"; }