oddluck-limnoria-plugins/php/index.php

105 lines
3.4 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<?php
include('config.php');
include('includes/storage.php');
try {
$storage = new Storage($config['dbLocation']);
} catch(StorageException $e) {
}
?>
<head>
<meta charset="utf-8">
<title>Home &middot; TriviaTime</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/triviatime.css" rel="stylesheet">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button class="btn btn-navbar collapsed" data-toggle="collapse" data-target=".nav-collapse" type="button">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="index.php" class="brand">TriviaTime</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="active"><a href="index.php">Home</a></li>
<li><a href="stats.php">Stats</a></li>
<li><a href="user.php">Players</a></li>
<li><a href="reports.php">Reports</a></li>
<li><a href="about.php">About</a></li>
</ul>
</div>
</div>
</div>
</div><!-- /.navbar -->
<div class="container">
<div class="hero-unit">
<h1>Home</h1>
<p>Get the latest stats for players and updates.</p>
</div>
<div class="row">
<div class="span12">
<h2>Latest questions asked</h2>
<?php
try {
$result = $storage->getRecentAskedQuestions();
} catch(StorageSchemaException $e) {
echo "<div class='alert alert-error'>Error: Database schema is not queryable</div>";
$result = array();
$result[0] = array('round_num'=>'', 'channel'=>'', 'question'=>'', 'line_num'=>'');
} catch(StorageConnectionException $e) {
echo "<div class='alert alert-error'>Error: Database is not available</div>";
$result = array();
$result[0] = array('round_num'=>'', 'channel'=>'', 'question'=>'', 'line_num'=>'');
}
$storage->close();
?>
<table class="table modal-table">
<thead>
<tr>
<th>Round #</th>
<th>Channel</th>
<th>Question</th>
<th>Question #</th>
</tr>
</thead>
<tbody>
<?php
foreach($result as $res) {
echo '<tr>';
echo '<td>' . $res['round_num'] . '</td>';
echo '<td>' . $res['channel'] . '</td>';
echo '<td class="breakable">' . $res['question'] . '</td>';
echo '<td>' . $res['line_num'] . '</td>';
echo '</tr>';
}
?>
</tbody>
</table>
</div>
</div>
<div class="footer">
<p>&copy; Trivialand 2013 - <a target="_blank" href="https://github.com/tannn/TriviaTime">Github</a></p>
</div>
</div> <!-- /container -->
<script src="http://codeorigin.jquery.com/jquery-2.0.3.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/triviatime.js"></script>
</body>
</html>