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.

home.php 3.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. include __DIR__ . "/../bits/navbar.php";
  3. ?>
  4. <div class="container pt-4">
  5. <div class="card-deck">
  6. <div class="card text-light bg-primary">
  7. <div class="card-body">
  8. <h5 class="card-title">Questions</h5>
  9. <h1><i class="fas fa-question-circle"></i> <?php echo $database->count("questions"); ?></h1>
  10. </div>
  11. </div>
  12. <div class="card text-light bg-success">
  13. <div class="card-body">
  14. <h5 class="card-title">Responses</h5>
  15. <h1><i class="fas fa-reply-all"></i> <?php echo $database->count("responses"); ?></h1>
  16. </div>
  17. </div>
  18. </div>
  19. <div class="table-responsive">
  20. <table id="questions" class="table table-hover mt-4">
  21. <thead>
  22. <tr>
  23. <th data-priority="0"></th>
  24. <th data-priority="1"><i class="far fa-fw fa-question-circle d-none d-md-inline"></i> Question</th>
  25. <th data-priority="2"><i class="fas fa-fw fa-link d-none d-md-inline"></i> Code</th>
  26. <th data-priority="2"><i class="fas fa-fw fa-list d-none d-md-inline"></i> Answers</th>
  27. <th data-priority="1"><i class="fas fa-fw fa-reply-all d-none d-md-inline"></i> Responses</th>
  28. </tr>
  29. </thead>
  30. <tbody>
  31. <?php
  32. $table = $database->select("questions", ['qid', 'qtext', 'qcode']);
  33. foreach ($table as $row) {
  34. $answers = $database->count("answers", ['qid' => $row['qid']]);
  35. $responses = $database->count("responses", ['qid' => $row['qid']]);
  36. ?>
  37. <tr>
  38. <td>
  39. <a class="btn btn-sm btn-info" href="<?php echo "./q/" . $row['qcode']; ?>">
  40. <i class="fas fa-chart-bar"></i> Results
  41. </a>
  42. </td>
  43. <td>
  44. <?php echo $row['qtext']; ?>
  45. </td>
  46. <td>
  47. <?php echo $row['qcode']; ?>
  48. </td>
  49. <td>
  50. <?php echo $answers; ?>
  51. </td>
  52. <td>
  53. <?php echo $responses; ?>
  54. </td>
  55. </tr>
  56. <?php
  57. }
  58. ?>
  59. </tbody>
  60. <tfoot>
  61. <tr>
  62. <th data-priority="0"></th>
  63. <th data-priority="1"><i class="far fa-fw fa-question-circle d-none d-md-inline"></i> Question</th>
  64. <th data-priority="2"><i class="fas fa-fw fa-link d-none d-md-inline"></i> Code</th>
  65. <th data-priority="2"><i class="fas fa-fw fa-list d-none d-md-inline"></i> Answers</th>
  66. <th data-priority="1"><i class="fas fa-fw fa-reply-all d-none d-md-inline"></i> Responses</th>
  67. </tfoot>
  68. </table>
  69. </div>
  70. </div>