Skip to content

Commit

Permalink
We can now chose to only see useful steps. Issue #14 done.
Browse files Browse the repository at this point in the history
  • Loading branch information
spydemon committed Jul 3, 2012
1 parent c363c7c commit d84ce8b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libs/problems.php
Expand Up @@ -93,7 +93,9 @@ function displayProblem($id, PDO $db) {
$i = 0;
foreach($steps as $step) {
$i += 1;
viewStep($step['action'], $step['reaction'], $step['useful'], $i, $step['id']);
//We check if user wants to see all steps or only useful ones.
if ((isset($_GET['onlyUseful']) && $step['useful']) || (!isset($_GET['onlyUseful'])))
viewStep($step['action'], $step['reaction'], $step['useful'], $i, $step['id']);
}
//The "add step" button
viewAddStepButton($id);
Expand Down
5 changes: 5 additions & 0 deletions style.css
Expand Up @@ -263,3 +263,8 @@ p {
margin: 0px;
margin-left: 2px;
}

.toggleText {
font-size: 0.7em;
text-align: right;
}
14 changes: 14 additions & 0 deletions views/problems.php
Expand Up @@ -98,6 +98,20 @@ function viewProblem($title, $symptoms, $solved, $date, $category_title, array $
<td id="dateProblem">Last update: <strong><?php echo $date;?></strong></td>
<td id="catProblem">In category: <strong><?php echo $category_title;?></strong></td>
</tr></table>
<?php
//Toggle into the mode which allow only to show useful steps and it which allow all steps.
if (isset($_GET['onlyUseful'])) {
$toggleText = "Show all steps for this problem.";
$toggleLink = NULL;
}
else {
$toggleText = "Show only useful steps for this problem.";
$toggleLink = "&amp;onlyUseful";
}
?>
<div class="toggleText">
<a href="index.php?type=viewPb&amp;pb=<?php echo $id.$toggleLink ?>"><?php echo $toggleText ?></a>
</div>
<p>
<?php echo decodeVar($symptoms); ?>
</p>
Expand Down

0 comments on commit d84ce8b

Please sign in to comment.