4
<meta charset="utf-8" />
5
<title>Helioviewer.org - Data Monitor</title>
6
<style type='text/css'>
7
#header {font-size:2em; vertical-align: middle; margin-top: 15px; margin-bottom: 26px;}
8
#headerText {display: inline-block; vertical-align: super; font-family: arial,helvetica,liberation sans,bitstream vera sans,freesans,clean,sans-serif; font-size:1.2em;}
12
<div id='main' style='width:50%; margin-left:auto; margin-right:auto;'>
14
<img src="../resources/images/logos/hvlogo1s_transparent_logo.png" alt="Helioviewer logo" />
15
<div id='headerText'>The Helioviewer Project - Data Monitor</div>
18
<table style='width:70%;'>
19
<tr style='font-weight:bold;'>
20
<td width='150'>Datasource</td>
21
<td width='200'>Latest Image</td>
22
<td width='50' align='center'>Status</td>
25
include_once "../api/src/Database/DbConnection.php";
26
include_once "../api/src/Database/ImgIndex.php";
27
include_once "../api/src/Config.php";
29
$config = new Config("../settings/Config.ini");
30
date_default_timezone_set('UTC');
35
$db = new Database_DbConnection();
36
$imgIndex = new Database_ImgIndex();
38
$datasources = $db->query("SELECT * FROM datasources");
40
// Add an entry to the table for each data source
41
while($ds = mysqli_fetch_assoc($datasources)) {
42
// Get date of most recent image
43
$date = $imgIndex->getNewestImage($ds['id']);
45
$img = "<img src='status_%02d.png' alt='datasource status' />";
47
// Determine status from 1 (out of date) to 4 (recent)
48
$elapsed = $now - strtotime($date);
50
if ($elapsed < 60 * 60) {
51
$img = sprintf($img, 4);
52
} else if ($elapsed < 2 * 60 * 60) {
53
$img = sprintf($img, 3);
54
} else if ($elapsed < 3 * 60 * 60) {
55
$img = sprintf($img, 2);
57
$img = sprintf($img, 1);
60
printf("<tr><td>%s</td><td>%s</td><td align='center'>%s</td></tr>",
61
$ds['name'], $date, $img);