/
index.tt
62 lines (62 loc) · 2.5 KB
/
index.tt
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
<h1>SCHS Kinza 2015/16</h1>
<p>Welcome to the Streatham and Clapham High School Kinza programme for
2015/16.</p>
[% IF error -%]
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<strong>Error:</strong> [% error %]
</div>
[% END -%]
<p>On this site, you can choose your Kinza courses for the coming year.</p>
[% IF session.email -%]
[% IF student.verify -%]
<p>You need to verify your email address before using this site.</p>
<p>To verify your email address, click the link in the email we sent you.</p>
<p>If you haven't received your email, please
<a href="/resend">click here</a> and we will resend it.</p>
[% ELSIF student.locked -%]
<p>You have already selected your options. Your selections are:</p>
<ul>
[% FOREACH a IN student.sorted_attendances -%]
<li>[% a.presentation.term.name %] - [% a.presentation.course.title %]</li>
[% END -%]
</ul>
[% ELSE -%]
<p>Here are the options available to [% student.form.year.name %]:</p>
<form method="POST" action="/save">
<p><input type="submit" value="Save"></p>
<table width="100%" class="table table-striped table-bordered table-hover table-condensed">
<thead>
<th width="33%">Course</th>
[% FOREACH t IN terms -%]
<th width="22%">[% t.name %]</th>
[% END -%]
</thead>
[% SET year = student.form.year;
FOREACH c IN year.get_allowed_courses -%]
<tr>
<td>[% c.title %][% IF c.description %]<br><span class="small">[% c.description %]</span>[% END %]</td>
[% SET total_terms = terms.size;
SET skip_terms = 0;
FOREACH t IN terms;
IF ! skip_terms; THEN;
SET p = term_course.${t.id}.${c.id};
IF p; THEN -%]
<td class="option"[% IF p.number_of_terms > 1; THEN %] colspan=[% p.number_of_terms; END %] title="[% t.name %]"><input type="radio" class="C[% c.id %][% FOREACH i IN [1 .. p.number_of_terms]; SET id = t.id+loop.index; ' T' _ id; END %]" name="T[% t.seq %]" value="[% p.id %]"[% IF choices.${p.id} %] checked[% ELSIF p.full %] disabled[% END %]></td>
[% SET skip_terms = p.number_of_terms - 1;
ELSE -%]
<td class="option" title="[% t.name %]"> </td>
[% END;
ELSE;
SET skip_terms = skip_terms - 1;
END;
END -%]
</tr>
[% END -%]
</table>
</form>
[% END -%]
[% ELSE -%]
<p>But first you need to <a href="/register">register</a> or
<a href="/login">log in</a>.</p>
[% END -%]