当前位置: 首页>>代码示例>>PHP>>正文


PHP EventManager::GetEventTypes方法代码示例

本文整理汇总了PHP中EventManager::GetEventTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP EventManager::GetEventTypes方法的具体用法?PHP EventManager::GetEventTypes怎么用?PHP EventManager::GetEventTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventManager的用法示例。


在下文中一共展示了EventManager::GetEventTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: EventManager

?>

	<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>
开发者ID:n8felton,项目名称:mc911feedwatcher,代码行数:31,代码来源:events.php

示例2: GetIncidentCountsByDate

 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;
 }
开发者ID:n8felton,项目名称:mc911feedwatcher,代码行数:92,代码来源:IncidentManager.class.php


注:本文中的EventManager::GetEventTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。