示例#1
0
		function convertSessions($ss, $distUnit, $timeUnit)
		{
			$sessions = array();
			foreach ($ss as $sess)
			{
				$s = DcUnitConverter::convertSession($sess, $distUnit, $timeUnit);
				array_push($sessions, $s);
			}
			return $sessions;
		}
示例#2
0
	{
		//make sure session belongs to user
		$err[0] = "You do not have permission to view this session.";
		$smarty->assign('errors', $err );
		$smarty->display('error.tpl');
	}
	
	else 
	{
		$device = $manager->getDevice($s->deviceId);
		
		$distUnit = "km";
		$timeUnit = "h";
		$velUnit = $distUnit . "/" . $timeUnit;
		
		$session = DcUnitConverter::convertSession($s, $distUnit, $timeUnit);
		
		$smarty->assign('sessId', $session->sessionId);
		$smarty->assign('deviceName', $device->name);
		$smarty->assign('lastName', $user->lastName);
		$smarty->assign('firstName', $user->firstName);
		$smarty->assign('startTime', $session->startTime);
		$smarty->assign('endTime', $session->endTime);
		$smarty->assign('duration', $session->elapsed);
		$smarty->assign('distUnit', $distUnit);
		$smarty->assign('velUnit', $velUnit);
		$smarty->assign('totalDist', $session->distance);
		$smarty->assign('averageVel', $session->averageVelocity);
		
		$smarty->display('viewSession.tpl');
	}
示例#3
0
	require("include/graph/jpgraph_line.php");
	require("include/main/DcWebManager.inc.php");
	require("include/main/DcUnitConverter.inc.php");
	
	$sessId = $_GET['s'];
	if (!$sessId)
	{ 
		die();
	}

	$manager = new DcWebManager();
	$session = $manager->getSession($sessId);
	
	//TODO: make sure session belongs to user
	
	$session = DcUnitConverter::convertSession($session, "km", "h");
	$ydata = $session->velPoints;
	if (count($ydata) > 1)
	{
		// Create the graph. These two calls are always required
		$graph = new Graph(350,180,"auto");	
		$graph->SetScale("textlin");
		// Create the linear plot
		$lineplot=new LinePlot($ydata);
		$lineplot->SetColor("green");
		// Add the plot to the graph
		$graph->Add($lineplot);
		$title = new Text("Session Velocity");
		//$title->SetFont(FF_ARIAL);
		$graph->title = $title;
		$graph->yaxis->SetTitle("Velocity (km/h)",'middle');