Skip to content

Commit

Permalink
feat: added dynamic exercises show for manage exercise page
Browse files Browse the repository at this point in the history
  • Loading branch information
EthannSchneider committed Sep 26, 2024
1 parent 26a80e3 commit f21ab7a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 22 deletions.
4 changes: 4 additions & 0 deletions src/controllers/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@ function takeAnExercises()

function manageExercises()
{
$buildingExercises = exercises::getExercises(Status::Building);
$answeringExercises = exercises::getExercises(Status::Answering);
$closeExercises = exercises::getExercises(Status::Closed);

include VIEW_DIR . '/manage_an_exercise.php';
}
54 changes: 32 additions & 22 deletions src/views/manage_an_exercise.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@
</thead>

<tbody>
<tr>
<td>hello</td>
<td>
<a title="Be ready for answers" rel="nofollow" data-method="put" href="/exercises/68?exercise%5Bstatus%5D=answering"><i class="fa fa-comment"></i></a>
<a title="Manage fields" href="/exercises/68/fields"><i class="fa fa-edit"></i></a>
<a data-confirm="Are you sure?" title="Destroy" rel="nofollow" data-method="delete" href="/exercises/68"><i class="fa fa-trash"></i></a>
</td>
</tr>
<?php foreach ($buildingExercises as $exercise): ?>
<tr>
<td><?= $exercise->getTitle() ?></td>
<td>
<a title="Be ready for answers" rel="nofollow" data-method="put"
href="/exercises/<?= $exercise->getId() ?>?exercise%5Bstatus%5D=answering"><i class="fa fa-comment"></i></a>
<a title="Manage fields" href="/exercises/<?= $exercise->getId() ?>/fields"><i class="fa fa-edit"></i></a>
<a data-confirm="Are you sure?" title="Destroy" rel="nofollow" data-method="delete"
href="/exercises/<?= $exercise->getId() ?>"><i class="fa fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</section>
Expand All @@ -47,13 +51,16 @@
</thead>

<tbody>
<tr>
<td>&lt;h1&gt;test&lt;/h1&gt;</td>
<td>
<a title="Show results" href="/exercises/74/results"><i class="fa fa-chart-bar"></i></a>
<a title="Close" rel="nofollow" data-method="put" href="/exercises/74?exercise%5Bstatus%5D=closed"><i class="fa fa-minus-circle"></i></a>
</td>
</tr>
<?php foreach ($answeringExercises as $exercise): ?>
<tr>
<td><?= $exercise->getTitle() ?></td>
<td>
<a title="Show results" href="/exercises/<?= $exercise->getId() ?>/results"><i class="fa fa-chart-bar"></i></a>
<a title="Close" rel="nofollow" data-method="put" href="/exercises/<?= $exercise->getId() ?>?exercise%5Bstatus%5D=closed"><i
class="fa fa-minus-circle"></i></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</section>
Expand All @@ -69,13 +76,16 @@
</thead>

<tbody>
<tr>
<td>bbbbbbbbbbbbb</td>
<td>
<a title="Show results" href="/exercises/78/results"><i class="fa fa-chart-bar"></i></a>
<a data-confirm="Are you sure?" title="Destroy" rel="nofollow" data-method="delete" href="/exercises/78"><i class="fa fa-trash"></i></a>
</td>
</tr>
<?php foreach ($closeExercises as $exercise): ?>
<tr>
<td><?= $exercise->getTitle() ?></td>
<td>
<a title="Show results" href="/exercises/<?= $exercise->getId() ?>/results"><i class="fa fa-chart-bar"></i></a>
<a data-confirm="Are you sure?" title="Destroy" rel="nofollow" data-method="delete"
href="/exercises/<?= $exercise->getId() ?>"><i class="fa fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</section>
Expand Down

0 comments on commit f21ab7a

Please sign in to comment.