<th>Offrs</th> <th>UOs</th> <th>Cdts</th> </tr> </thead> <tfoot> <tr> </tr> </tfoot> <tbody> <?php foreach ($nzcf20[4] as $activity) { $activity->startdate = strtotime($activity->startdate); $activity->enddate = strtotime($activity->enddate); $length = ($activity->enddate - $activity->startdate) / 60 / 60 / 24; $attendees = $ATC->get_activity_attendance($activity->activity_id); $attending_officers = $attending_cadets = $attending_uos = 0; foreach ($attendees as $attendee) { if ($attendee->presence === ATC_ATTENDANCE_PRESENT && array_search($attendee->access_rights, explode(',', ATC_USER_GROUP_OFFICERS)) !== false) { $attending_officers++; } elseif ($attendee->presence === ATC_ATTENDANCE_PRESENT && array_search($attendee->access_rights, explode(',', ATC_USER_LEVEL_SNCO)) !== false) { $attending_uos++; } elseif ($attendee->presence === ATC_ATTENDANCE_PRESENT && array_search($attendee->access_rights, explode(',', ATC_USER_GROUP_CADETS)) !== false) { $attending_cadets++; } } echo '<tr>'; echo ' <td> ' . date('M d', $activity->startdate) . ($length > 1 ? '-' . date('M d', $activity->enddate) : '') . ' ' . $activity->title . ' </td>'; echo ' <td> ' . $attending_officers . ' </td>'; echo ' <td> ' . $attending_uos . ' </td>'; echo ' <td> ' . $attending_cadets . '</td>';