/
trans_info.php
110 lines (99 loc) · 3.19 KB
/
trans_info.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?
// $Header: /cvsroot/tsheet/timesheet.php/trans_info.php,v 1.6 2004/07/04 09:51:07 vexil Exp $
// Authenticate
require("class.AuthenticationManager.php");
if (!$authenticationManager->isLoggedIn()) {
Header("Location: login.php?redirect=$_SERVER[PHP_SELF]");
exit;
}
// Connect to database.
$dbh = dbConnect();
$contextUser = strtolower($_SESSION['contextUser']);
//load local vars from superglobals
$trans_num = $_REQUEST['trans_num'];
//get the timeformat
$timeFormat = getTimeFormat();
$dateFormatString = ($timeFormat == "12") ? "%m/%d/%Y %h:%i%p": "%m/%d/%Y %H:%i";
$query = "SELECT DATE_FORMAT(start_time, '$dateFormatString') as formattedStartTime, ".
"DATE_FORMAT(end_time, '$dateFormatString') as formattedEndTime, ".
"(unix_timestamp(end_time) - unix_timestamp(start_time)) as time,".
"log_message, " .
"$PROJECT_TABLE.title AS projectTitle, " .
"$PROJECT_TABLE.proj_status AS projectStatus, ".
"$TASK_TABLE.name AS taskName, " .
"$TASK_TABLE.status AS taskStatus, ".
"$CLIENT_TABLE.organisation, ".
"$USER_TABLE.first_name, ".
"$USER_TABLE.last_name " .
"FROM $TIMES_TABLE, $PROJECT_TABLE, $TASK_TABLE, $USER_TABLE, $CLIENT_TABLE ".
"WHERE $PROJECT_TABLE.proj_id=$TIMES_TABLE.proj_id ".
"AND $TASK_TABLE.task_id=$TIMES_TABLE.task_id ".
"AND $TIMES_TABLE.trans_num=$trans_num ".
"AND $PROJECT_TABLE.client_id = $CLIENT_TABLE.client_id ".
"AND $USER_TABLE.username = $TIMES_TABLE.uid";
//print "<PRE>$data[date]\n$data[time]\n$data[log_message]\n$data[title]\n$data[client]\n$data[first_name]\n$data[last_name]</PRE>";
?>
<html>
<head>
<title>Task Info</title>
<?
include ("header.inc");
?>
</head>
<body width="100%" height="100%" style="margin: 0px;" <? include ("body.inc"); ?> >
<table border="0" width="100%" height="100%" align="center" valign="center">
<?
list($qh, $num) = dbQuery($query);
if ($num > 0) {
$data = dbResult($qh);
?>
<tr>
<td>
<table width="100%" border="0" class="section_body">
<tr>
<td>
<span class="label">Project:</span>
<span class="project_title"><?php echo stripslashes($data["projectTitle"]); ?></span>
<span class="project_status"><<?php echo $data["projectStatus"]; ?>></span>
</td>
</tr>
<tr>
<td>
<span class="label">Task:</span>
<span class="task_title"><?php echo stripslashes($data["taskName"]); ?></span>
<span class="project_status"><<?php echo $data["taskStatus"]; ?>></span>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
<span class="label">Clocked On:</span>
<? echo $data["formattedStartTime"]; ?>
<span class="label">Clocked Off:</span>
<? echo $data["formattedEndTime"]; ?>
</td>
</tr>
<tr>
<td>
<span class="label">Duration:</span>
<? echo formatSeconds($data["time"]); ?>
</td>
</tr>
<tr>
<td valign="top" align="left">
<span class="label">Log Message:</span>
<? echo $data["log_message"]; ?>
</td>
<tr>
</table>
</td>
</tr>
<?php
}
?>
</BODY>
</HTML>