} $start_time = getmicrotime(); //require_once("./tools/Database.class.php"); require_once "./tools/IncidentManager.class.php"; require_once "./tools/Incident.class.php"; require_once "./tools/AgencyManager.class.php"; require_once "./tools/Agency.class.php"; // calculate tomorrow $tomorrowtime = strtotime('+1 day', strtotime($date)); $tommorrow = date('Y-m-d', $tomorrowtime); // calculate yesterday $yesterdaytime = strtotime('-1 day', strtotime($date)); $yesterday = date('Y-m-d', $yesterdaytime); // get all of the incidents for the date passed in by the user $start_get_incidents = getmicrotime(); $incidentManager = new IncidentManager(); $incidents = $incidentManager->GetIncidentsByDay($date, $agencyShortName); $end_get_incidents = getmicrotime(); echo "\n\n<!-- incidents gotten in: " . ($end_get_incidents - $start_get_incidents) . "-->"; // to handle all agency related querys $agencyManager = new AgencyManager(); // display links to go to previous day and next day echo '<div class="yesterdaylink">'; echo '<a href="incidents.php?date=' . $yesterday . '">Incidents for ' . date("l F j, Y", strtotime($yesterday)) . '</a>'; echo '</div>'; if ($date != date("Y-m-d")) { echo '<div class="tomorrowlink">'; echo '<a href="incidents.php?date=' . $tommorrow . '">Incidents for ' . date("l F j, Y", strtotime($tommorrow)) . '</a>'; echo '</div>'; } echo '<br><br>';
} ?> <?php require_once "./tools/AgencyManager.class.php"; require_once "./tools/Agency.class.php"; require_once "./tools/IncidentManager.class.php"; require_once "./tools/Incident.class.php"; // get the agency we are viewing $agencyshortname = $_GET['agency']; // TODO: sanity check this // create an instance of our agency manager object $agencyManager = new AgencyManager(); // create an instance of our incident manager $incidentManager = new IncidentManager(); // get agency information using the shortname passed in by the user $agency = $agencyManager->GetAgencyFromShortName($agencyshortname); // get the last 25 incidents this agency has seen $incidents = $incidentManager->GetIncidentsByAgencyID($agency->agencyid, 25); // note: 25 here is the number of incidents to return // do some decode if we haven't decoded the 4 letter code yet //if( $agency->longname == "" ) // $agency->longname = "- unknown -"; // get the current year $year = date("Y"); // get todays date for later use $todaysdate = date("Y-m-d"); // get the total number of calls for todays date $todaystotalcalls = $incidentManager->GetIncidentCountByAgencyIDAndDate($agency->agencyid, $todaysdate); // get the total number of calls for this year for this agency
// create the canvas object var ctx = createCanvas("IncidentsDiv"); // setup the bargraph var graph = new BarGraph(ctx); graph.width = 940; graph.height = 400; //graph.maxValue = 30; graph.margin = 2; graph.colors = [ "#49a0d8", "#d353a0", "#ffc527", "#df4c27"]; <?php require_once "./tools/IncidentManager.class.php"; $incidentManager = new IncidentManager(); $counts = $incidentManager->GetIncidentCountsByDate($date); // set the maximum for the graph echo "graph.maxValue = " . max($counts) . ";\n"; // set the x axis labels $letter = "A"; echo "graph.xAxisLabelArr = ["; for ($i = 0; $i < count($counts) - 1; $i++) { echo '"' . $letter . '",'; $letter++; } echo '"' . $letter . '"'; echo "];\n"; // graph bogus data echo 'graph.update(['; for ($i = 0; $i < count($counts) - 1; $i++) {