Make table on homepage responsive

master
Skylar Ittner 6 years ago
parent f6b4c1c4ce
commit 050e13cbe8

@ -22,53 +22,55 @@ include __DIR__ . "/../bits/navbar.php";
</div> </div>
<table id="questions" class="table table-hover mt-4"> <div class="table-responsive">
<thead> <table id="questions" class="table table-hover mt-4">
<tr> <thead>
<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> <tr>
<td> <th data-priority="0"></th>
<a class="btn btn-sm btn-info" href="<?php echo "./q/" . $row['qcode']; ?>"> <th data-priority="1"><i class="far fa-fw fa-question-circle d-none d-md-inline"></i> Question</th>
<i class="fas fa-chart-bar"></i> Results <th data-priority="2"><i class="fas fa-fw fa-link d-none d-md-inline"></i> Code</th>
</a> <th data-priority="2"><i class="fas fa-fw fa-list d-none d-md-inline"></i> Answers</th>
</td> <th data-priority="1"><i class="fas fa-fw fa-reply-all d-none d-md-inline"></i> Responses</th>
<td>
<?php echo $row['qtext']; ?>
</td>
<td>
<?php echo $row['qcode']; ?>
</td>
<td>
<?php echo $answers; ?>
</td>
<td>
<?php echo $responses; ?>
</td>
</tr> </tr>
</thead>
<tbody>
<?php <?php
} $table = $database->select("questions", ['qid', 'qtext', 'qcode']);
?> foreach ($table as $row) {
</tbody> $answers = $database->count("answers", ['qid' => $row['qid']]);
<tfoot> $responses = $database->count("responses", ['qid' => $row['qid']]);
<tr> ?>
<th data-priority="0"></th> <tr>
<th data-priority="1"><i class="far fa-fw fa-question-circle d-none d-md-inline"></i> Question</th> <td>
<th data-priority="2"><i class="fas fa-fw fa-link d-none d-md-inline"></i> Code</th> <a class="btn btn-sm btn-info" href="<?php echo "./q/" . $row['qcode']; ?>">
<th data-priority="2"><i class="fas fa-fw fa-list d-none d-md-inline"></i> Answers</th> <i class="fas fa-chart-bar"></i> Results
<th data-priority="1"><i class="fas fa-fw fa-reply-all d-none d-md-inline"></i> Responses</th> </a>
</tfoot> </td>
</table> <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> </div>
Loading…
Cancel
Save