exam_templates.xml
6.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="exam_question_page" name="Exam / Test / Quiz Questions">
<t t-call="website.layout">
<form action="/exam/results" method="post" class="form-horizontal mt32" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<div class="wrap">
<div class="container">
<div class="mt16 mb16">
<h1 class="text-center">
<t t-esc="exam.name"/>
</h1>
</div>
<t t-set="question_index" t-value="0"/>
<t t-foreach="questions" t-as="question_result">
<t t-set="question" t-value="question_result.question_id"/>
<t t-set="question_index" t-value="question_index+1"/>
<div class="form-group">
<div>
<t t-if="question.question_type == 'multi_choice'">
<h2>
<t t-esc="question_index"/>)
<t t-raw="question.question.replace('<p>','').replace('</p>','')"/>
<t t-if="question.num_correct > 1">
<span>(select<t t-esc="question.num_correct"/>)
</span>
</t>
</h2>
<t t-foreach="question.question_options" t-as="option">
<t t-if="question.num_correct == 1">
<input type="radio" t-attf-name="question#{question.id}"
t-attf-value="#{option.id}" required="True"/>
<t t-esc="option.option"/>
<br/>
</t>
<t t-if="question.num_correct > 1">
<input type="checkbox"
t-attf-name="question#{question.id}option#{option.id}"
t-attf-value="#{option.id}"/>
<t t-esc="option.option"/>
<br/>
</t>
</t>
</t>
<t t-if="question.question_type == 'fill_blank'">
<script>
window.onload = function() {
$('input[type="text"]').keydown(resizeInput)
};
function resizeInput() {
$(this).attr('size', $(this).val().length);
}
</script>
<h2>
<t t-esc="question_index"/>)
<t t-raw="question.question_rendered"/>
</h2>
</t>
</div>
</div>
</t>
<div class="form-group">
<div class="col-md-7 col-sm-8">
<input type="hidden" name="token" t-attf-value="#{token}"/>
<button class="btn btn-primary btn-lg">Finish</button>
</div>
</div>
</div>
</div>
</form>
</t>
</template>
<template id="exam_results" name="Exam / Test / Quiz Results">
<t t-call="website.layout">
<div class="wrap">
<div class="container">
<div class="mt16 mb16">
<h1 class="text-center">Results</h1>
</div>
<div class="mt16 mb16">
<h2 class="text-center text-center">
<t t-esc="correct_count"/>
/
<t t-esc="question_count"/>
<br/>
<t t-esc="percent"/>%
</h2>
<t t-if="exam_result.exam_id.show_correct_questions == True">
<style>
td, th {
padding: 5px;
}
</style>
<table>
<tr>
<th>Question</th>
<th>Correct</th>
</tr>
<t t-foreach="exam_result.results" t-as="question_result">
<tr>
<td>
<t t-esc="question_result.question.question"/>
</td>
<td>
<t t-if="question_result.correct == True">
<span style="color:green;">Correct</span>
</t>
<t t-if="question_result.correct == False">
<span style="color:red;">Incorrect</span>
</t>
</td>
</tr>
</t>
</table>
</t>
</div>
</div>
</div>
</t>
</template>
</data>
</openerp>