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; }
<div class="row"> <div class="span9"> <?php // Welcome splash screen if (empty($list_of_users) || !in_array(getUsername(), $list_of_users)) { echo "<div class='hero-unit'><h1>Welcome to {$team_name} Weekly!</h1>"; echo "<p>{$team_name} Weekly allows the {$team_name} team to record and store our weekly updates, as well as categorise and report on "; echo "our on call experiences. </p><p>On the {$team_name} team? Get started by adding your first weekly update!</p>"; echo "<p><a href='{$ROOT_URL}/add.php' class='btn btn-success btn-large'><i class='icon-white icon-plus'></i> Add Yours Now</a></p>"; echo "</div>"; } if (isset($_GET['meeting_done'])) { echo insertNotify("success", "Thanks for running the weekly meeting! Your notes have been saved. "); } if ($results = checkForPreviousMeetingNotes(generateMeetingNotesID($start_ts, $end_ts))) { echo formatMeetingNotesForPrint($results); } if (getTeamConfig('oncall')) { // Print the on call report if there is one yet for this period if ($results = getOnCallReportForWeek($oncall_start, $oncall_end)) { echo "<h3>On call report <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></h3>"; echo "<h5>" . count($results) . " notifications received this week "; ?> <small><a href="#" onClick="$('#oncall-table').fadeToggle('fast')">hide/show</a></small></h5> <?php echo printOnCallTableHeader(); foreach ($results as $n) { echo formatOnCallRowForPrint($n); } echo printOnCallTableFooter();