Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

We can now chose to only see useful steps. Issue #14 done.

  • Loading branch information...
commit d84ce8bae1c4637384797ec81af54d192f261130 1 parent c363c7c
@spydemon authored
Showing with 22 additions and 1 deletion.
  1. +3 −1 libs/problems.php
  2. +5 −0 style.css
  3. +14 −0 views/problems.php
View
4 libs/problems.php
@@ -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);
View
5 style.css
@@ -263,3 +263,8 @@ p {
margin: 0px;
margin-left: 2px;
}
+
+.toggleText {
+ font-size: 0.7em;
+ text-align: right;
+}
View
14 views/problems.php
@@ -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>
Please sign in to comment.
Something went wrong with that request. Please try again.