/
log_display_functions.php
64 lines (49 loc) · 1.58 KB
/
log_display_functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
//Commonly used functions for displaying log data
function get_column_names(){
# Get all log Column names
$query = "SELECT * from log
WHERE session_id = 1 ";
$result = do_sql($query);
$details = pg_fetch_array($result, null, PGSQL_ASSOC) ;
$columns = array_keys($details) ;
return $columns ;
}
function generate_date_range($start,$end){
$start=strtotime(validate_date($start,"eu","us"));
$end=strtotime(validate_date($end,"eu","us"));
$datearray=array();
$day= 60*60*24;
while ( $start <= $end ) {
array_push($datearray,$start);
$start+=$day;
}
//Returns array of days in the range, but in seconds format.
// need to use date function to convert them to desired format.
return $datearray;
}
function display_date_range_selector($athlete_id, $start, $end) {
# $monthago=date("j/n/Y",strtotime($start));
# $nextweek=date("j/n/Y",strtotime($end));
$start=validate_date($start,"eu","eu");
$end=validate_date($end,"eu","eu");
echo <<<ENDHTML
<form action=view_log.php method=post >
Select Date range:
From <input type=text id=cal1_container name=startdate value="$start" >
to <input type=text id=cal2_container name=enddate value="$end" >
<input type=submit value=Go>
<input type=hidden name=athlete_id value=$athlete_id >
</form>
<!-- <TD>
Experimental links:
<a href=my_event_calendar.php > My Event Calendar </a>
<a href=my_training_plan.php> My Training Plan</a>
<a href=my_training_plan.php> My Training Plan</a>
</TD>
</TR>
-->
ENDHTML
;
}
?>