5 use CXGN
::DB
::Connection
;
11 my $page=CXGN
::Page
->new("SGN Stats","johnathon");
12 my $dbh = CXGN
::DB
::Connection
->new("sgn_people");
14 my $logged_in_person_id=CXGN
::Login
->new($dbh)->verify_session();
15 my $logged_in_user=CXGN
::People
::Person
->new($dbh, $logged_in_person_id);
16 my $logged_in_username=$logged_in_user->get_first_name()." ".$logged_in_user->get_last_name();
17 my $logged_in_user_type=$logged_in_user->get_user_type();
20 my ($time_to_check) = $page->get_encoded_arguments("hours");
23 my $people_logged_in = $_[0];
24 for my $person(@
$people_logged_in){
25 $person->[2] = int($person->[2]/60);
27 return $people_logged_in;
30 $page->header("SGN Stats", "SGN Stats");
33 <script type='text/javascript' language='javascript'>
34 function lookup_person(id){
36 if(window.XMLHttpRequest){
37 http_request = new XMLHttpRequest();
39 else if(window.ActiveXObject){
40 http_request = new ActiveXObject("Microsoft.XMLHTTP");
43 alert('Giving up :( Cannot create an XMLHTTP instance');
46 http_request.onreadystatechange = function() { writeData(http_request); };
47 http_request.open('GET', 'get_person.pl?id='+id, true);
48 http_request.send("id="+id);
50 function writeData(http_request){
51 if(http_request.readyState == 4){
52 if(http_request.status == 200){
53 var table = document.getElementById("idnumbers");
54 table.innerHTML += http_request.responseText;
57 alert("Error " + http_request.status);
64 <form method="get" action="stats.pl" name="time" id="time"><label for="minutes">Time restraint (in hours):       </label>
65 <input type="text" size="5" name="hours" id="hours" value="$time_to_check" />
66 <input type="submit" id="submit" value="Submit" /></form>
67 <form id="lookup" name="lookup" action="javascript:lookup_person(document.lookup.number.value)">
68 <span id="request" name="request"
69 style="cursor: pointer; text-decoration: underline"
70 onclick="javascript:lookup_person(document.lookup.number.value)">
71 Obtain user info on id number:
73 <input type="text" size="5" name="number" />
74 <input type="submit" id="sumbitnum" value="Submit" />
77 <script type="text/javascript" language="javascript">document.time.hours.focus();</script>
80 <table style="width: 45%" name="idnumbers" id="idnumbers"><tr><th>Username:</th><th>Timestamp:</th></tr></table>