<title>John Holdun</title> <style> body { background: black; margin: 24px auto; color: white; width: 600px; font-family: "Georgia"; text-shadow: 1px 1px 1px black; font-size: 24px; line-height: 1.5; } p { margin-bottom: 1em; } a { color: #99F; text-decoration: none; } ul { list-style: none; overflow: hidden; margin: 0; padding: 0; font-size: 20px; } li { float: left; margin-right: 12px; } li:after { content: "\2022"; margin-left: 12px; } li:last-child:after { display: none; } </style> </head> <body> <p>I’m John Holdun. I design interactions for the web.</p> <p><?php echo current_status(); ?> </p> <p>I’m currently in <?php echo current_city(); ?> .</p> <ul> <?php foreach (links() as $link) { ?> <li><a href="<?php echo $link->url; ?>
/** * Main function * handles GET parameters * handles normal and AJAX requests */ function main() { $out = ''; if (isset($_POST['sensor_id'])) { $sensor_id = $_POST['sensor_id']; $data = sensor_data($sensor_id); if (!isset($_POST['page'])) { $page = 0; } else { $page = $_POST['page']; } $out .= '<h2>Sensor '.$sensor_id.'</h2>'; $sum_time = 0; if (!empty($data['times'])) { foreach($data['times'] as $t) { $sum_time += $t['duration']; } } $out .= '<h3>'; $out .= 'Összesen '.count($data['times']). ' alkalommal, '.format_time($sum_time).' vették fel a szenzort.'; $out .= '</h3>'; $out .= pager($sensor_id, count($data['times']), $page); $rows_per_page = 10; for($i = $page * $rows_per_page; $i < ($page+1) * $rows_per_page; $i++) { if (isset($data['times'][$i])) { $out .= '<div class="detail-row">'; $out .= '<span>'.$data['times'][$i]['formatted_start'].'</span>-kor felvették <span title="'.$data['times'][$i]['duration'].' másodperc">'.format_time($data['times'][$i]['duration']).'</span>'; $out .= '</div>'; $out .= "\n"; } } $out .= pager($sensor_id, count($data['times']), $page); } else { $data = current_status(); $out .= head(); $out .= "\n"; $out .= '<div id="sensors">'; $out .= "\n"; foreach($data as $sensor_id => $sensor) { $out .= '<div class="sensor-button" id="sensor-'.$sensor_id.'" onclick="showSensor('.$sensor_id.', 0)">'; $out .= "\n"; $out .= '<img src="'.(0 == $sensor['direction'] ? 'red':'green').'.png" width="50" height="50" alt="Sensor '.$sensor_id.'" title="Sensor '.$sensor_id.'">'; $out .= "\n"; $out .= '</div>'; $out .= "\n"; } $out .= '</div><br style="clear: both"/><div id="detailed"><div style="text-align:center">Válasszon a fenti szenzorok közül!</div></div>'; $out .= "\n"; $out .= footer(); } return $out; }