forked from Mayankgbrc/Task_Manager
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtask.php
More file actions
106 lines (99 loc) · 3.01 KB
/
task.php
File metadata and controls
106 lines (99 loc) · 3.01 KB
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
<?php
session_start();
if(!isset($_SESSION['id'])){
header("location: login.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Task Manager</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div class="w3-container w3-center w3-pale-red">
<h2>Task Manager - To do list</h2>
</div>
<div class="w3-bar w3-black">
<a href="task.php" class="w3-bar-item w3-button"> <i class="fa fa-home"></i> Home </a>
<a href="add.php" class="w3-bar-item w3-button"> <i class="fa fa-plus"></i> Add </a>
<div class="w3-dropdown-hover w3-right">
<button class="w3-button"><b><i class="fa fa-power-off"></i> <?php echo $_SESSION['name']; ?></b></button>
<div class="w3-dropdown-content w3-bar-block w3-card-4">
<a href="logout.php" class="w3-bar-item w3-button">Log Out</a>
</div>
</div>
</div>
<br>
<div class="w3-row-padding">
<?php
date_default_timezone_set('Asia/Kolkata');
$cdate = time();
include("db.php");
$userid = $_SESSION['id'];
$sql = "SELECT * FROM work WHERE userid='$userid' ORDER BY status, duedate";
$result = mysqli_query($conn,$sql);
$count = mysqli_num_rows($result);
if ($count == 0){
echo "You currently have 0 task. Go to Add Button to Add a task.";
}
else{
while($row = mysqli_fetch_assoc($result)){
$startdate = $row['entrydate'];
$duedate = $row['duedate'];
$stdate = date("d/m/Y",$startdate);
$ddate = date("d/m/Y",$duedate);
$status = $row['status'];
$label = $row['label'];
$workid = $row['workid'];
if($status==0){
if ( $duedate < $cdate ){
$data = "<span style='color:red'>Time Over</span>";
}
elseif (($startdate + 600)>$cdate){
$data = "<span style='color:blue'>New Record</span>";
}
else{
$data = "<span style='color:orange'>In Progress</span>";
}
}
else{
$data = "<span style='color:green'>Task Completed</span>";
}
?>
<div class="w3-third w3-container">
<div class="w3-card-4">
<header class="w3-container w3-light-grey">
<h3><?php echo $row['name']; ?>
<span class="w3-tag w3-round-large w3-small w3-green"><?php echo $label; ?></span>
</h3>
</header>
<div class="w3-container">
<p> Started on <?php echo $stdate; ?> | Due date : <?php echo $ddate; ?></p>
<hr>
<p><?php echo $data; ?></p><br>
</div>
<?php
if ($status==0){
$que = $userid."_".$workid;
?>
<a href="update.php?data=<?php echo $que; ?>" style="text-decoration: none;">
<button class="w3-button w3-block w3-dark-grey">End Now</button></a>
<?php
}
else{
echo '<button class="w3-button w3-block w3-dark-grey" disabled>Ended</button>';
}
?>
</button>
</div><br>
</div>
<?php
}
}
?>
</div>
</body>
</html>