$rowno = 0; $statusses = array(STATUS_ON => 'on', STATUS_OFF => 'off', STATUS_NOSHOW => 'noshow', STATUS_LATE => 'late', STATUS_SUBSTITUTE => 'substitute', 0 => 'future', -1 => 'past', -2 => 'unset', STATUS_LATE_SIGNOFF => 'late_signoff'); $raid_sums = array(); $raidData = array(); // data used in the addon... $armory_link = $config['raidattendance_armory_link']; $realm = $config['raidattendance_realm_name']; $url_base = $armory_link . '/character-sheet.xml?r=' . urlencode($realm) . '&cn='; $date_array = getdate($tstamp); $last_week = mktime(0, 0, 0, $date_array['mon'], $date_array['mday'] - 7, $date_array['year']); $next_week = mktime(0, 0, 0, $date_array['mon'], $date_array['mday'] + 7, $date_array['year']); $dump_months = request_var('dump_months', 1); $dump_start = mktime(0, 0, 0, $date_array['mon'] - $dump_months, $date_array['mday'], $date_array['year']); $dump_end = $tstamp; // For now... just for the summary... should be merged in the future... $summary_attendance = get_attendance_for_time($dump_start, $dump_end, $raid_id); // Sort, if were sorting on availability (col 7) if ($col_sort[0] == 7 or $col_sort[0] == -7) { $sort_obj = new summary_sort($summary_attendance, $col_sort[0]); uasort($raiders, array($sort_obj, 'sort')); } foreach ($raiders as $name => $raider) { $sums = array(0, $summary_attendance[$raider->name]['summary_1'], $summary_attendance[$raider->name]['summary_2'], $summary_attendance[$raider->name]['summary_3'], $summary_attendance[$raider->name]['summary_4'], $summary_attendance[$raider->name]['summary_5'], $summary_attendance[$raider->name]['summary_6']); $sum_attendance = $sums[1] + $sums[5]; if ($sum_attendance > 0) { $sum_attendance = 100 * $sums[1] / $sum_attendance; } $template->assign_block_vars('raiders', array('ROWNO' => $rowno + 1, 'ID' => $raider->id, 'NAME' => $raider->name, 'RANK' => $raider->get_rank_name(), 'ROLE' => $raider->get_role_name(), 'LEVEL' => $raider->level, 'CLASS' => $user->lang['CLASS_' . $raider->class], 'USER' => $raider->user_id, 'STATUS' => $raider->get_status(), 'ROW_CLASS' => $rowno % 2 == 0 ? 'even' : 'uneven', 'CHECKED' => $raider->is_checked() ? ' checked' : '', 'CSS_CLASS' => 'class_' . $raider->class, 'S_EDITABLE' => $user->data['user_id'] == $raider->user_id or $raider->user_id == 0 and $user->data['username'] == $raider->name, 'ARMORY_LINK' => sprintf($user->lang['CHARACTER_ARMORY_LINK'], $armory_link, rawurlencode($realm), rawurlencode($raider->name)), 'SUMMARY_LINK' => sprintf($user->lang['SUMMARY_LINK'], $sums[1], $sums[2], $sums[3], $sums[4], $sums[5]), 'SUMMARY_TOOLTIP' => sprintf($user->lang['SUMMARY_TOOLTIP'], $sums[1] + $sums[5], $sum_attendance), 'SUMMARY_DETAIL_LINK' => sprintf($user->lang['SUMMARY_DETAIL_LINK'], $sums[1], $sums[2], $sums[3], $sums[4], $sums[5], $user->lang['LEGEND_STATUS_ON'], $user->lang['LEGEND_STATUS_OFF'], $user->lang['LEGEND_STATUS_NOSHOW'], $user->lang['LEGEND_STATUS_LATE'], $user->lang['LEGEND_STATUS_SUBSTITUTE']))); $num_days = floor(sizeof($raids) / 3); if ($num_days <= 0 or !is_numeric($num_days)) { $num_days = 1;
$output_cell = '%s'; $output_summary = '%02$1f/%02$2f/%02$3f/%02$4f/%02$5f'; $output_colheader_cancelled = '%s [%s]'; if ($user->lang['OUTPUT_COLHEADER_CANCELLED_' . $output]) { $output_colheader_cancelled = $user->lang['OUTPUT_COLHEADER_CANCELLED_' . $output]; } if ($user->lang['OUTPUT_ROW_' . $output]) { $output_row = $user->lang['OUTPUT_ROW_' . $output]; } if ($user->lang['OUTPUT_CELL_' . $output]) { $output_cell = $user->lang['OUTPUT_CELL_' . $output]; } if ($user->lang['OUTPUT_SUMMARY_' . $output]) { $output_summary = $user->lang['OUTPUT_SUMMARY_' . $output]; } $attendance = get_attendance_for_time($start, $end, $raid_id); $is_first = true; $first_line = ''; foreach ($attendance as $raider => $nights) { if ($raider == '__RAID__') { continue; } $line = ''; if ($is_first) { $first_line = sprintf($output_cell, $user->lang['NAME']); } $line = $line . sprintf($output_cell, $raider); ksort(&$nights); foreach ($nights as $night => $status) { if (!is_numeric($night)) { continue;