{ header("Location: day.php"); } else { $uId = $u; } } $smarty = smartyInit(); $sId = $_GET['s']; $manager = new DcWebManager(); $user = $manager->loadUser($uId); $s = $manager->getSession($sId); if (!$manager->isSessionOwnedByUser($sId, $uId)) { //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";
<? require("include/graph/jpgraph.php"); 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);