<!-- Question 1 -->
<check if="{{ @questions[0].enabled == '1' }}">
<true>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3" style="margin-bottom:10px;">
<div class="card <check if="{{ @questions[0].answer == @user[0].answer0 }}"><true>text-white bg-success</true></check> <check if="{{ @user[0].answer0 == '' }}"><true>text-dark bg-light</true></check> <check if="{{ @questions[0].answer != @user[0].answer0 }}"><true>text-white bg-danger</true></check>">
<a href="#" data-toggle="collapse" data-target="#collapse{{ @questions[0].id }}" aria-expanded="true" class="<check if="{{ @user[0].answer0 == '' }}"><true>text-dark</true><false>text-white</false></check>">
<header class="card-header p-2">
<div class="row">
<div class="col text-left"><b>Vos - {{ @questions[0].id }}</b></div>
</div>
</header>
</a>
<div class="collapse hide" id="collapse{{ @questions[0].id }}" style="">
<div class="card-body p-2">
<check if="{{ @SESSION.lvl=='1' }}"><true><div>{{ @questions[0].easy }}</div></true></check>
<check if="{{ @SESSION.lvl=='2' }}"><true><div>{{ @questions[0].normal }}</div></true></check>
<check if="{{ @SESSION.lvl=='3' }}"><true><div>{{ @questions[0].hard }}</div></true></check>
</div>
<div class="card-footer p-2">
<check if="{{ @questions[0].answer == @user[0].answer0 }}">
<true>Het antwoord <b>{{ @user[0].answer0 }}</b> is goed.</true>
<false>
<form role="form" method="POST" enctype="multipart/form-data" action="/app/checkanswer">
<div class="input-group p-0 m-0">
<input type="text" name="answer0" class="form-control" placeholder="Antwoord" value="{{ @user[0].answer0 }}" onkeyup="this.value = this.value.toLowerCase();">
<div class="input-group-append">
<input type="hidden" name="update" value="update" />
<input type="hidden" name="id" value="{{ @user[0].id }}" />
<button class="btn btn-primary" type="submit" >Controlleer</button>
</div>
</div>
</form>
</false>
</check>
</div>
</div> <!-- End Collapse .// -->
</div> <!-- End Card .// -->
</div>
</true>
</check>
<!-- Question 2 -->
<check if="{{ @questions[1].enabled == '1' }}">
<true>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3" style="margin-bottom:10px;">
<div class="card <check if="{{ @questions[1].answer == @user[0].answer1 }}"><true>text-white bg-success</true></check> <check if="{{ @user[0].answer1 == '' }}"><true>text-dark bg-light</true></check> <check if="{{ @questions[1].answer != @user[0].answer1 }}"><true>text-white bg-danger</true></check>">
<a href="#" data-toggle="collapse" data-target="#collapse{{ @questions[1].id }}" aria-expanded="true" class="<check if="{{ @user[0].answer1 == '' }}"><true>text-dark</true><false>text-white</false></check>">
<header class="card-header p-2">
<div class="row">
<div class="col text-left"><b>Vos - {{ @questions[1].id }}</b></div>
</div>
</header>
</a>
<div class="collapse hide" id="collapse{{ @questions[1].id }}" style="">
<div class="card-body p-2">
<check if="{{ @SESSION.lvl=='1' }}"><true><div>{{ @questions[1].easy }}</div></true></check>
<check if="{{ @SESSION.lvl=='2' }}"><true><div>{{ @questions[1].normal }}</div></true></check>
<check if="{{ @SESSION.lvl=='3' }}"><true><div>{{ @questions[1].hard }}</div></true></check>
</div>
<div class="card-footer p-2">
<check if="{{ @questions[1].answer == @user[0].answer1 }}">
<true>Het antwoord <b>{{ @user[0].answer1 }}</b> is goed.</true>
<false>
<form role="form" method="POST" enctype="multipart/form-data" action="/app/checkanswer">
<div class="input-group p-0 m-0">
<input type="text" name="answer1" class="form-control" placeholder="Antwoord" value="{{ @user[0].answer1 }}" onkeyup="this.value = this.value.toLowerCase();">
<div class="input-group-append">
<input type="hidden" name="update" value="update" />
<input type="hidden" name="id" value="{{ @user[0].id }}" />
<button class="btn btn-primary" type="submit" >Controlleer</button>
</div>
</div>
</form>
</false>
</check>
</div>
</div> <!-- End Collapse .// -->
</div> <!-- End Card .// -->
</div>
</true>
</check>
--
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-framework...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-framework...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/f3-framework/07bb0f7f-7ded-46f1-a385-b67fdd4720ac%40googlegroups.com.
<repeat group="{{ @questions }}" value="{{ @question }}">
<check if="{{ @question.enabled == '1' }}">
//work your magic here
</check>
</repeat>
{{ @question.question }} and {{ @user[0].answer1 }}
{{ @question.question }} and {{ @user[0].answer2 }}
{{ @question.question }} and {{ @user[0].answer3 }}
questions:
id | question | correct_answer
-----------------------------------------------------
1 | Who discovered relativity? | Albert Einstein
2 | Who discovered quantum physics? | Max Planck
3 | Who discovered radioactivity? | Marie Curie
users:
id | email | name
-------------------------------------------
1 | goodstudent@example.com | Good Student
2 | badstudent@example.com | Bad Student
user_answers:
id | uid | qid | answer
----------------------------
1 | 1 | 1 | Albert Einstein
2 | 1 | 2 | Max Planck
3 | 1 | 3 | Marie Curie
4 | 2 | 1 | Donald Duck
5 | 2 | 2 | Walter White
6 | 2 | 3 | Radio Gaga
SELECT q.*,u.name,a.answer FROM questions AS q
LEFT JOIN user_answers AS a ON q.id=a.qid
LEFT JOIN users AS u ON a.uid=u.id
WHERE a.uid=1
id | question | correct_answer | name | answer
1 | Who discovered relativity? | Albert Einstein | Good Student | Albert Einstein
2 | Who discovered quantum physics? | Max Planck | Good Student | Max Planck
3 | Who discovered radioactivity? | Marie Curie | Good Student | Marie Curie
WHERE a.uid = '1'