A simple system for creating multiple-choice questions for an audience to answer on their phones. Responses are tallied and displayed in real-time. https://openquestion.netsyms.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

76 lines
3.1 KiB

<?php
include __DIR__ . "/../bits/navbar.php";
?>
<div class="container pt-4">
<div class="card-deck">
<div class="card text-light bg-primary">
<div class="card-body">
<h5 class="card-title">Questions</h5>
<h1><i class="fas fa-question-circle"></i> <?php echo $database->count("questions"); ?></h1>
</div>
</div>
<div class="card text-light bg-success">
<div class="card-body">
<h5 class="card-title">Responses</h5>
<h1><i class="fas fa-reply-all"></i> <?php echo $database->count("responses"); ?></h1>
</div>
</div>
</div>
<div class="table-responsive">
<table id="questions" class="table table-hover mt-4">
<thead>
<tr>
<th data-priority="0"></th>
<th data-priority="1"><i class="far fa-fw fa-question-circle d-none d-md-inline"></i> Question</th>
<th data-priority="2"><i class="fas fa-fw fa-link d-none d-md-inline"></i> Code</th>
<th data-priority="2"><i class="fas fa-fw fa-list d-none d-md-inline"></i> Answers</th>
<th data-priority="1"><i class="fas fa-fw fa-reply-all d-none d-md-inline"></i> Responses</th>
</tr>
</thead>
<tbody>
<?php
$table = $database->select("questions", ['qid', 'qtext', 'qcode']);
foreach ($table as $row) {
$answers = $database->count("answers", ['qid' => $row['qid']]);
$responses = $database->count("responses", ['qid' => $row['qid']]);
?>
<tr>
<td>
<a class="btn btn-sm btn-info" href="<?php echo "./q/" . $row['qcode']; ?>">
<i class="fas fa-chart-bar"></i> Results
</a>
</td>
<td>
<?php echo $row['qtext']; ?>
</td>
<td>
<?php echo $row['qcode']; ?>
</td>
<td>
<?php echo $answers; ?>
</td>
<td>
<?php echo $responses; ?>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<th data-priority="0"></th>
<th data-priority="1"><i class="far fa-fw fa-question-circle d-none d-md-inline"></i> Question</th>
<th data-priority="2"><i class="fas fa-fw fa-link d-none d-md-inline"></i> Code</th>
<th data-priority="2"><i class="fas fa-fw fa-list d-none d-md-inline"></i> Answers</th>
<th data-priority="1"><i class="fas fa-fw fa-reply-all d-none d-md-inline"></i> Responses</th>
</tfoot>
</table>
</div>
</div>