-
Notifications
You must be signed in to change notification settings - Fork 0
/
startevaluation.php
70 lines (68 loc) · 1.94 KB
/
startevaluation.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
<?php
session_start();
require_once "includer.php";
if(!is_admin()){
redirect("adminlogin.php");
}
$datee = post("enddate");
$note = post("note");
function process(){
if(!no_post("start")){
$date = date("Y-m-d");
$dateend = post("enddate");
$notes= post("note");
if($dateend < $date){
return "Please select a valid date. Try the date today or a date after today";
}
$created = Evaluation::create($dateend, $notes);
if($created){
Evaluation::closeAll();
}
return "Y";
}
}
$error = process();
$success = null;
if($error === "Y"){
$success = "Evaluation was successfully started";
$error = null;
}
?>
<html>
<head>
<title>Start evaluation</title>
<?php
include_once "includes/styles.php";
?>
<style>
.center{
margin-top: 18vh;
}
</style>
</head>
<body>
<?php include_once "includes/admin_nav_logged_in.php"; ?>
<div class="col-md-4 offset-4 center">
<h3 class="text-center">Start evaluation</h3>
<?php if(isset($error)){
?>
<p class="bg-danger text-white p-2"><?= $error ?></p>
<?php
} if(isset($success)) { ?>
<p class="bg-success text-white p-2"><?= $success ?></p>
<?php
}
?>
<form method="post">
<p><strong>End date</strong></p>
<input type="date" class="form-control" name="enddate" min="today" value="<?= $datee ?>" required/><br>
<p><strong>Add some notes</strong></p>
<textarea class="form-control" name="note" required><?= $note ?></textarea><br>
<button class="btn btn-primary btn-block" name="start">Start evaluation <i class="fa fa-arrow-circle-right"></i> </button>
</form>
</div>
<?php
include_once "includes/scripts.php";
?>
</body>
</html>