| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <?php
- /**
- * @var Location $location
- */
- $tests = $location->getCompletedTests();
- ?>
- <div class="tab-pane fade" id="tests" role="tabpanel" aria-labelledby="tests-tab">
- <?php
- if(empty($tests)) {
- ?>
- <div class="alert alert-info">
- This location has no tests.
- </div>
- <?php
- }
- else {
- ?>
- <table class="table table-bordered table-hover">
- <thead>
- <tr>
- <th>ID</th>
- <?php
- if(Core::$user->isAdmin()) {
- ?>
- <th>Project</th>
- <?php
- }
- else {
- ?>
- <th>Date/Time</th>
- <?php
- }
- ?>
- <th>Status</th>
- <th>Result</th>
- <th>Challenge Stage</th>
- <th>PDF</th>
- <?php
- if(Core::$user->isAdmin()) {
- ?>
- <th>Actions</th>
- <?php
- }
- ?>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach($tests as $test) {
- $project = $test->getProject();
- $template = $project->getTemplate();
- $has_pass_fail = $template->hasPassFail();
- $pass_text = $test->getPassText();
- $pass_class = $test->getPassClass();
- $pass_icon = $test->getPassIcon();
- $challenge_stage = $test->challenge_stage;
- $challenge_stage_text = $test->getChallengeStageText();
- ?>
- <tr>
- <td class="text-right align-middle">
- <?=$test->id?>
- </td>
- <td>
- <?php
- if(Core::$user->isAdmin()) {
- ?>
- <a href="/account/projects/<?=$project->id?>"><?=htmlspecialchars($project->name)?></a>
- <?php
- }
- else {
- echo Util::getDisplayDateTimeFromUTC($test->dts_start);
- }
- ?>
- </td>
- <td class="text-center">
- <span class="badge badge-lg badge-<?=$test->getStatusClass()?>"><?=htmlspecialchars($test->getStatusText())?></span>
- </td>
- <td class="text-center">
- <?php
- if($has_pass_fail) {
- ?>
- <strong class="text-<?=$pass_class?>"><?=htmlspecialchars($pass_text)?></strong>
- <?php
- }
- else {
- echo htmlspecialchars(__("N/A"));
- }
- ?>
- </td>
- <td>
- <?php
- if($has_pass_fail) {
- if($test->isPending()) {
- ?>
- <?=htmlspecialchars(__("Pending"))?>
- <?php
- }
- else {
- ?>
- <strong class="text-<?=$pass_class?>"><?=htmlspecialchars(__("Stage %d", $challenge_stage))?></strong> -
- <?=htmlspecialchars($challenge_stage_text)?>
- <?php
- }
- }
- else {
- echo htmlspecialchars(__("N/A"));
- }
- ?>
- </td>
- <td>
- <?php
- if($test->hasPDF()) {
- $pdf_url = $test->getPDFUrl();
- ?>
- <a href="<?=htmlspecialchars($pdf_url)?>" target="_blank">View PDF</a>
- <?php
- }
- else {
- echo htmlspecialchars(__("No PDF available"));
- }
- ?>
- </td>
- <?php
- if(Core::$user->isAdmin()) {
- ?>
- <td>
- <?php
- if($test->status >= Test::STATUS_PENDING_VERIFICATION) {
- ?>
- <a href="/account/tests/<?=$test->id?>">View Results</a>
- <?php
- }
- else {
- ?>
- <a href="/account/projects/<?=$test->project_id?>">View Project</a>
- <?php
- }
- ?>
- </td>
- <?php
- }
- ?>
- </tr>
- <?php
- }
- ?>
- </tbody>
- </table>
- <?php
- }
- ?>
- </div>
|