-
Notifications
You must be signed in to change notification settings - Fork 0
/
recent_jobs.php
70 lines (59 loc) · 2.41 KB
/
recent_jobs.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
<!DOCTYPE html>
<?php
require_once('assets/config.php');
date_default_timezone_set('Europe/Vienna');
?>
<html>
<head>
<meta charset="UTF-8">
<meta content="VARIFI" name="Keywords">
<meta content="VARIFI" name="Description">
<title>VARIFI - Recent Jobs</title>
<link href='https://fonts.googleapis.com/css?family=Fira+Sans' rel='stylesheet' type='text/css'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="assets/css/reset.css">
<link rel="stylesheet" type="text/css" href="assets/css/style.css">
<meta name="viewport" content="initial-scale=1">
</head>
<body>
<?php include('header.php'); ?>
<main>
<?php
if (isset($_COOKIE['varifi_rj'])) {
$tokens = explode('|', $_COOKIE['varifi_rj']);
foreach($tokens as $t) {
$query = 'SELECT job_token, submitted_on, available_until, finished from submitted_jobs WHERE BINARY job_token = :token';
$query_params = array(':token' => $t);
try {
$stmt = $db->prepare($query);
$stmt->execute($query_params);
} catch (PDOException $ex) { die(); }
if ($stmt->rowCount()) {
foreach ($stmt as $row) {
echo " <article>
<header><h2>" . $row['job_token'] . "</h2></header>
<p>Your job started on <strong>" . date("j/n H:i:s", strtotime($row['submitted_on'])) . "</strong> and
has " . ($row['finished'] ? "finished. You can download your results from <a href='http://varifi.cibiv.univie.ac.at/job_results.php?token=" . $row['job_token'] . "'>here</a>,
until <strong>" . date("j/n", strtotime($row['available_until'])) . " 23:59:59</strong>." : "not yet finished.
You can view your job progress <a href='http://varifi.cibiv.univie.ac.at/job_progress.php?token=" . $row['job_token'] . "'>here</a>.") . "</p>
</article>";
}
} else {
echo " <article>
<header><h2>Job(s) expired</h2></header>
<p>Your stored jobs have expired. The cookie has been deleted.</p>
</article>";
unset($_COOKIE['varifi_rj']);
setcookie('varifi_rj', '', time() - 3600);
}
}
} else {
echo " <article>
<header><h2>No recent jobs found</h2></header>
</article>";
}
?>
<?php include('footer.php'); ?>
</main>
</body>
</html>