1
0
Fork 0
app.sixfold.org/lib/partials/assignments.php

98 lines
3.4 KiB
PHP

<?php
$assignments = new stdClass();
$assignments->params = [
"game_id" => $game->id,
"member_id" => 30436 ?? $_SESSION["account"]->id,
"round" => 1,
];
$stmt_assignments = $db["data"]->prepare(
"SELECT submissions.id, title, hash, score FROM assignments
JOIN submissions ON submissions.id = assignments.submission_id
WHERE assignments.game_id = :game_id AND assignments.member_id = :member_id
AND round_number = :round"
);
$stmt_assignments->execute($assignments->params);
$assignments->round_1 = $stmt_assignments->fetchAll(PDO::FETCH_OBJ);
$assignments->params["round"] = 2;
$stmt_assignments->execute($assignments->params);
$assignments->round_2 = $stmt_assignments->fetchAll(PDO::FETCH_OBJ);
$assignments->params["round"] = 3;
$stmt_assignments->execute($assignments->params);
$assignments->round_3 = $stmt_assignments->fetchAll(PDO::FETCH_OBJ);
?>
<section class="flow" aria-labelledby="assignments">
<h2 id="assignments">Your Assignments</h2>
<?php if (in_array($game->status_id, [
STATUS_ENROLLING,
STATUS_REVIEW,
])) { ?>
<p>The manuscripts to which you've been assigned to provide feedback will appear here.</p>
<?php } ?>
<?php if ($assignments->round_1): ?>
<div role="region" aria-labelledby="round-1-assignments-caption" tabindex="0">
<table>
<caption id="round-1-assignments-caption">Round One Assignments for <?= $game->name ?></caption>
<thead>
<tr>
<th scope="col">Title</th>
<th scope="col">Score</th>
</tr>
</thead>
<tbody>
<?php foreach ($assignments->round_1 as $item): ?>
<tr>
<th scope="row"><a href="/docs/<?= $item->hash ?>"><?= $item->title ?></a></th>
<td><?= $item->score ?? "N/A" ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
<?php if ($assignments->round_2): ?>
<div role="region" aria-labelledby="round-2-assignments-caption" tabindex="0">
<table>
<caption id="round-2-assignments-caption">Round Two Assignments for <?= $game->name ?></caption>
<thead>
<tr>
<th scope="col">Title</th>
<th scope="col">Score</th>
</tr>
</thead>
<tbody>
<?php foreach ($assignments->round_2 as $item): ?>
<tr>
<th scope="row"><a href="/docs/<?= $item->hash ?>"><?= $item->title ?></a></th>
<td><?= $item->score ?? "N/A" ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
<?php if ($assignments->round_3): ?>
<div role="region" aria-labelledby="round-3-assignments-caption" tabindex="0">
<table>
<caption id="round-3-assignments-caption">Round Three Assignments for <?= $game->name ?></caption>
<thead>
<tr>
<th scope="col">Title</th>
<th scope="col">Score</th>
</tr>
</thead>
<tbody>
<?php foreach ($assignments->round_3 as $item): ?>
<tr>
<th scope="row"><a href="/docs/<?= $item->hash ?>"><?= $item->title ?></a></th>
<td><?= $item->score ?? "N/A" ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</section>