-
Notifications
You must be signed in to change notification settings - Fork 0
/
Home.php
68 lines (65 loc) · 2.06 KB
/
Home.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
<?php
include 'Header.php';
?>
<div style="text-align: right;font-size: 25px;">Welcome <?php echo "$login_session |"; ?> 	 <a href = "logout.php">Sign Out</a></div>
<h1 style="text-align:center;">Projects</h1>
<?php
if (isset($_SESSION ['role'])){
$role_session = $_SESSION ['role'];
$selectquery = "select P.ProjectId, P.Title, P.StartDate, P.EndDate, ur.RoleId from Project P INNER JOIN UserToProject UP ON P.ProjectId = UP.ProjectId INNER JOIN usertorole ur on ur.Id = UP.UtoRId where ur.EmpId = $EmpId_session";
$result = mysqli_query ( $connect, $selectquery );
/* $selectquery1 = "select P.ProjectId, P.Title, P.StartDate, P.EndDate from Project P INNER JOIN UserToProject UP ON P.ProjectId = UP.ProjectId INNER JOIN UserToRole UR ON UP.UtoRId = UR.Id where UR.RoleId = 4 and UR.EmpId = $EmpId_session;";
$result1 = mysqli_query ( $connect, $selectquery1 );
*/
}
?>
<div id="hometable" class="table-responsive">
<br/>
<table class="table table-bordered" id="t01">
<thead>
<tr class="success">
<th>Project ID</th>
<th>Project Name</th>
<th>Start Date</th>
<th>End Date</th>
</tr>
</thead>
<tbody>
<?php
if (! $result) {
echo "<tr>
<td>Connection failed</td></tr> ";
} else {
while ( $row = mysqli_fetch_row ( $result ) ) {
echo "<tr class=\"info\">
<td>{$row[0]}</td>
<td><a href=\"#\" onclick=\"navigateToDetails($row[0],$row[4])\">{$row[1]}</a></td>
<td>{$row[2]}</td>
<td>{$row[3]}</td>
</tr>\n";
}
/* while ( $row = mysqli_fetch_row ( $result1 ) ) {
echo "<tr class=\"info\">
<td>{$row[0]}</td>
<td><a href=\"ViewTask.php?link=$row[0]\">{$row[1]}</a></td>
<td>{$row[2]}</td>
<td>{$row[3]}</td>
</tr>\n";
} */
}
?>
</tbody>
</table>
</div>
<script>
function navigateToDetails(ProjectId,roleId){
if(roleId==3)
window.location.href="ProjectHome.php?link="+ProjectId;
else if(roleId==4)
window.location.href="TaskDetails.php?link="+ProjectId;
else if(roleId==2)
window.location.href="ViewAllTasks.php?link="+ProjectId;
}
</script>
</body>
</html>