<?php if ($results = getOnCallReportForWeek($oncall_start, $oncall_end)) { echo "<small> for week " . date("l jS F Y", $oncall_start) . " - " . date("l jS F Y", $oncall_end); echo " compiled by " . guessPersonOnCall($oncall_start, $oncall_end) . "</small></h2>"; ?> <table class="table table-striped table-bordered table-hover" id="oncall-table" style='font-size: 90%'> <thead> <tr> <th>Date/Time</th><th>Host</th><th>Service</th><th>Output</th><th>State</th> </tr> </thead> <tbody> <?php foreach ($results as $n) { echo formatOnCallRowForPrint($n); } echo "</tbody></table>"; } else { echo "</h2>"; echo insertNotify("critical", "Uh-oh! There has been no weekly report filed for this week yet!"); } ?> <div id="oncall-stats">Loading report...</div> <script> $.post("<?php echo $root_url; ?> /generate_report.php/generate_report.php", { type: 'week', date: '<?php echo $time_requested;
function formatSearchResults(array $results, $search_type, $highlight_term, $limit = 0, $start = 0) { // If only a limited number of results is required, reduce the array down to that number. if ($limit != 0) { $results = array_slice($results, $start, $limit); } switch ($search_type) { case 'service': case 'hostname': $results = highlightSearchQuery($results, $highlight_term, $search_type); $html = printOnCallTableHeader(); foreach ($results as $n) { $html .= formatOnCallRowForPrint($n); } $html .= printOnCallTableFooter(); break; case 'report': $results = highlightSearchQuery($results, $highlight_term, 'report'); foreach ($results as $result) { $html .= formatWeeklyReportForPrint($result); } break; case 'notes': $results = highlightSearchQuery($results, $highlight_term, 'notes'); foreach ($results as $result) { $html .= formatMeetingNotesForPrint($result, true); } break; default: return false; } return $html; }