forked from France-ioi/bebras-tasks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
repartition.html
107 lines (104 loc) · 4 KB
/
repartition.html
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
<!doctype html>
<html ng-app="admin">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script class="module" type="text/javascript" src="modules/ext/jquery/1.7/jquery.min.js" id="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="demo_files/angular.min.js"></script>
<script src="demo_files/ui-bootstrap-tpls-0.5.0.min.js" type="text/javascript"></script>
<link href="demo_files/bootstrap-combined.min.css" rel="stylesheet">
<script src="demo_files/mainCtrl.js" type="text/javascript"></script>
<script class="module" type="text/javascript" src="modules/pemFioi/beav-1.0.js" id="http://www.france-ioi.org/modules/pemFioi/beav-1.0.js"></script>
</head>
<script type="text/javascript" src="tasks_2014.js"></script>
<script class="" type="text/javascript">
// TODO: better factorize the code with demo_2014.html (and other years demo).
var show_order = true;
$(document).ready(function() {
var items = [];
var target = "";
for (var iLevel = 0; iLevel < nbLevels; iLevel++) {
items[iLevel] = [];
}
for (var iTask = 0; iTask < tasks.length; iTask++) {
var task = tasks[iTask];
var short_code = extractShortCode(task.code);
/*
var title = task.title;
if (task.options != null && task.options.hasOwnProperty('difficulty')) {
title += " [" + task.options.difficulty + "]";
}
*/
target = getLinkTask(task.code, task.options);
var dev = "";
if (task.hasOwnProperty("dev")) {
dev = " ";
}
var rowCore = dev + " <a href='" + target + "'>" + /*short_code + " " + */ task.title + "</a>";
$("#levels_all").append(row);
for (var iLevel = 0; iLevel < nbLevels; iLevel++) {
var order = task.levels[iLevel];
if (order != 0) {
var sOrder = "" + order;
if (show_order) {
if (iLevel > 0 && iLevel < nbLevels-1
&& task.levels[iLevel-1] == 0) {
sOrder = "<b>" + sOrder + "</b>";
}
if (iLevel < nbLevels-1 && iLevel >= 0
&& task.levels[iLevel+1] == 0) {
sOrder = "<u>" + sOrder + "</u>";
}
sOrder = "<small>[" + sOrder + "]</small> ";
}
var row = sOrder + rowCore;
items[iLevel].push({order: order, label: row})
}
}
}
for (var iLevel = 0; iLevel < nbLevels; iLevel++) {
var curGroup = -1;
Beav.Array.stableSort(items[iLevel], function(a, b) {return a.order - b.order});
for (var iItem = 0; iItem < items[iLevel].length; iItem++) {
var item = items[iLevel][iItem];
var margin = "0em";
var group = Math.floor(item.order / 10);
if (group != curGroup) {
curGroup = group;
margin = "0.7em";
}
$("#levels_" + iLevel).append("<div style='margin-top:" + margin + "'>" + item.label + "</div>");
}
}
});
</script>
<style>
#tasks {
margin-left: 1em;
border-collapse: collapse;
}
#tasks td {
vertical-align: top;
width: 14em;
border: 1px solid black;
padding: 0.2em;
}
</style>
<body ng-controller="MainCtrl">
<table id="tasks">
<tr>
<td>Tous</td>
<td>6ème/5ème</td>
<td>4ème/3ème</td>
<td>Seconde</td>
<td>1ère/Terminale</td>
</tr>
<tr>
<td id="levels_4"></td>
<td id="levels_0"></td>
<td id="levels_1"></td>
<td id="levels_2"></td>
<td id="levels_3"></td>
</tr>
</table>
</body>
</html>