private function printSet($cohortid, $cohortname) { $stats = Attendance_Record_Set::getStatsForPeriod($this->_start_date, $this->_end_date, $cohortid); if (empty($stats) || $stats[NULL]['rate'] == 0) { return FALSE; } ?> <div class="span4"> <table class="table table-bordered attendance-stats"> <thead> <tr> <th colspan="4"><?php echo ents($cohortname); ?> </th> </tr> <tr> <th><?php echo _('Segment'); ?> </th> <th title=<?php echo _('"Percentage of dates marked present rather than absent"'); ?> ><?php echo _('Rate'); ?> </th> <th class="present" title=<?php echo _('"Average number marked present per date"'); ?> ><?php echo _('Avg P'); ?> </th> <th class="absent" title="<?php echo _('Average number marked absent per date"'); ?> ><?php echo _('Avg A'); ?> </th> </thead> <tbody> <?php $map['age_bracket'] = explode(',', AGE_BRACKET_OPTIONS); if ($cohortid[0] == 'g') { list($map['status'], $default) = Person_Group::getMembershipStatusOptionsAndDefault(); } else { $map['status'] = $this->status_map; } foreach (array('status', 'age_bracket') as $grouping) { foreach ($map[$grouping] as $k => $v) { if (!isset($stats[$grouping][$k])) { continue; } ?> <tr <?php if ($k == 0 && $grouping == 'age_bracket') { echo 'class="thick-top-border"'; } ?> > <th><?php echo ents($v); ?> </th> <?php if (isset($stats[$grouping][$k])) { ?> <td><?php echo $stats[$grouping][$k]['rate']; ?> %</td> <td><?php echo number_format($stats[$grouping][$k]['avg_present'], 1); ?> </td> <td><?php echo number_format($stats[$grouping][$k]['avg_absent'], 1); ?> </td> <?php } else { ?> <td>-</td> <td>-</td> <td>-</td> <?php } ?> </tr> <?php } } ?> <tr class="thick-top-border"> <th><?php echo _('Overall'); ?> </th> <td><?php echo $stats[NULL]['rate']; ?> %</td> <td><?php echo number_format($stats[NULL]['avg_present'], 1); ?> </td> <td><?php echo number_format($stats[NULL]['avg_absent'], 1); ?> </td> </tr> <tr class="headcount"> <th colspan="2"> <?php echo _('Avg Headcount'); ?> </th> <td class="right"> <?php $bits = explode('-', $cohortid); $hc = Headcount::fetchAverage($bits[0], $bits[1], $this->_start_date, $this->_end_date); if ($hc) { echo number_format($hc, 1); } else { echo 'N/A'; } ?> </td> <td colspan="2"></td> </tr> </tbody> </table> </div> <?php return TRUE; }
private function printSet($cohortid, $cohortname) { $stats = Attendance_Record_Set::getStatsForPeriod($this->_start_date, $this->_end_date, $cohortid); if (empty($stats)) { return FALSE; } ?> <div class="span4"> <table class="table table-bordered attendance-stats"> <thead> <tr> <th colspan="4"><?php echo ents($cohortname); ?> </th> </tr> <tr> <th>Status</th> <th title="Percentage of dates marked present rather than absent">Rate</th> <th class="present" title="Average number marked present per date">Avg P</th> <th class="absent" title="Average number marked absent per date">Avg A</th> </thead> <tbody> <?php if ($cohortid[0] == 'g') { list($map, $default) = Person_Group::getMembershipStatusOptionsAndDefault(); } else { $map = $this->status_map; } foreach ($map as $k => $v) { if (isset($stats[$k])) { ?> <tr> <th><?php echo ents($v); ?> </th> <td style="width: 6ex; text-align: right"><?php echo $stats[$k]['rate']; ?> %</td> <td style="width: 6ex; text-align: right"><?php echo number_format($stats[$k]['avg_present'], 1); ?> </td> <td style="width: 6ex; text-align: right"><?php echo number_format($stats[$k]['avg_absent'], 1); ?> </td> </tr> <?php } } ?> <tr class="thick-top-border"> <th>Overall</th> <td style="width: 6ex; text-align: right"><?php echo $stats[NULL]['rate']; ?> %</td> <td style="width: 6ex; text-align: right"><?php echo number_format($stats[NULL]['avg_present'], 1); ?> </td> <td style="width: 6ex; text-align: right"><?php echo number_format($stats[NULL]['avg_absent'], 1); ?> </td> </tr> <tr class="headcount"> <th colspan="2"> Avg Headcount </th> <td class="right"> <?php $bits = explode('-', $cohortid); $hc = Headcount::fetchAverage($bits[0], $bits[1], $this->_start_date, $this->_end_date); if ($hc) { echo number_format($hc, 1); } else { echo 'N/A'; } ?> </td> <td colspan="2"></td> </tr> </tbody> </table> </div> <?php return TRUE; }