Exemple #1
0
?>

	<br>
	<h3>Different Event Types Used by Monroe County, NY Dispatch</h3>
	<br>
	
	There are a lot of different types of incidents used by Monroe Count, NY 911 dispatch.  The list below is the currently used types by dispatch.<br>
	<br>

	<?php 
require_once "./tools/EventManager.class.php";
require_once "./tools/EventType.class.php";
// create an instance of our event manager object
$eventManager = new EventManager();
// get a list of all of the event types
$eventtypes = $eventManager->GetEventTypes();
// print all of the event types with a link to "all time by hour" page
foreach ($eventtypes as $eventtype) {
    echo '<div class="eventtype">';
    echo '<p class="tab">';
    echo $eventtype->eventtype . " ";
    echo '(<a href="alltimehourly.php?eventtypeid=' . $eventtype->eventtypeid . '">all-time by hour</a>)<br>';
    echo '</p>';
    echo '</div>';
}
?>

	<br>
	Note: this list is dynamically added to as new types are seen by the web scrapers.  For more information how how this data is created, check out the 
	<a href="about.php">about</a> page and the <a href="developers.php">developers</a> page.<br>
	<br>
 function GetIncidentCountsByDate($date)
 {
     dprint("GetIncidentCountsByDate() Start.");
     $incidents = $this->GetIncidentsByDay($date, "");
     $dict = array();
     foreach ($incidents as $incident) {
         if (!array_key_exists(strtolower($incident->event), $dict)) {
             $dict[strtolower($incident->event)] = 1;
         } else {
             $dict[strtolower($incident->event)] += 1;
         }
     }
     echo "\n\n// " . json_encode($dict) . " //";
     // create an instance of our event manager
     $eventManager = new EventManager();
     // get all of the known event types
     $eventtypes = $eventManager->GetEventTypes();
     // create an array to return that has our counts in it
     $counts = array();
     // create our count list based on our dictionary entries
     foreach ($eventtypes as $eventtype) {
         $id = strtolower($eventtype->eventtype);
         // add the count for the event type to the counts array.  If it doesn't exist, it will be zero
         if (isset($dict[$id])) {
             $counts[] = $dict[$id];
         } else {
             $counts[] = 0;
         }
     }
     /*
     
     			try
     			{
     				
     				$db = new DatabaseTool();
     		
     				if( $date == "" )
     					$date = date("Y-m-d");
     	// get the counts for all incidents seen today
     				$query = 'select count(distinct itemid) as count, event from incidents where pubdate = ? group by event';
     	$mysqli = $db->Connect();
     				$stmt = $mysqli->prepare($query);
     				$stmt->bind_param("s", $date); // bind the variable
     				$results = $db->Execute($stmt);
     		
     				// create a dictionary to hold our results in
     				$dict = array();
     		
     				foreach( $results as $result )
     				{
     		// decode the row data
     					$event = strtolower($result['event']);
     					$count = $result['count'];
     					
     					// add the key and value to the dictionary
     					$dict[$event] = $count;
     				
     				}
     		
     				// create an instance of our event manager
     				$eventManager = new EventManager();
     				
     				// get all of the known event types
     				$eventtypes = $eventManager->GetEventTypes();
     				
     				// create an array to return that has our counts in it
     				$counts = array();
     				
     				// create our count list based on our dictionary entries
     				foreach($eventtypes as $eventtype)
     				{
     					$id = strtolower($eventtype->eventtype);
     				
     					// add the count for the event type to the counts array.  If it doesn't exist, it will be zero
     					if( isset($dict[$id]) )
     						$counts[] = $dict[$id];
     					else
     						$counts[] = 0;
     				}
     				
     				// close our DB connection
     				$db->Close($mysqli, $stmt);
     }
     			catch (Exception $e)
     			{
     				dprint( "Caught exception: " . $e->getMessage() );
     			}
     */
     dprint("GetIncidentCountsByDate() Done.");
     // return our array of counts for the event types
     return $counts;
 }