-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcheckview.php
132 lines (131 loc) · 4.09 KB
/
checkview.php
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
<?php
/**
* This view allows checking deck states
*
* @package mod-flashcard
* @category mod
* @author Gustav Delius
* @contributors Valery Fremaux
* @version Moodle 2.0
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
// security
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page.
}
echo $out;
/// get available decks for user and calculate deck state
if (flashcard_initialize($flashcard, $USER->id)) {
$decks = flashcard_get_deck_status($flashcard);
} else {
if (has_capability('mod/flashcard:manage', $context)) {
$url = "view.php?id={$cm->id}&view=edit";
} else {
$url = "{$CFG->wwwroot}/course/view.php?id={$course->id}";
}
notice(get_string('nocards', 'flashcard'), $url);
}
?>
<center>
<table width="90%" cellspacing="10">
<tr>
<th>
<?php print_string('difficultcards',
'flashcard') ?>
</th>
<?php
if ($flashcard->decks >= 3) {
?>
<th>
<?php print_string('mediumeffortcards', 'flashcard') ?>
</th>
<?php
}
?>
<th>
<?php print_string('easycards', 'flashcard') ?>
</th>
<?php
if ($flashcard->decks >= 4) {
?>
<th>
<?php print_string('trivialcards', 'flashcard') ?>
</th>
<?php
}
?>
</tr>
<tr valign="top">
<td>
<?php
print_string('cardsindeck', 'flashcard', $decks->decks[0]->count);
echo "<br/>";
if ($decks->decks[0]->count == 0) {
flashcard_print_deck($cm, 0);
} else {
if ($decks->decks[0]->reactivate) {
flashcard_print_deck($cm, 1);
} else {
flashcard_print_deck($cm, -1);
}
}
?>
</td>
<td>
<?php
print_string('cardsindeck', 'flashcard', $decks->decks[1]->count);
echo "<br/>";
if ($decks->decks[1]->count == 0) {
flashcard_print_deck($cm, 0);
} else {
if ($decks->decks[1]->reactivate) {
flashcard_print_deck($cm, 2);
} else {
flashcard_print_deck($cm, -2);
}
}
?>
</td>
<?php
if ($flashcard->decks >= 3) {
?>
<td>
<?php
print_string('cardsindeck', 'flashcard', $decks->decks[2]->count);
echo "<br/>";
if ($decks->decks[2]->count == 0) {
flashcard_print_deck($cm, 0);
} else {
if ($decks->decks[2]->reactivate) {
flashcard_print_deck($cm, 3);
} else {
flashcard_print_deck($cm, -3);
}
}
?>
</td>
<?php
}
if ($flashcard->decks >= 4) {
?>
<td>
<?php
print_string('cardsindeck', 'flashcard', $decks->decks[3]->count);
echo "<br/>";
if ($decks->decks[3]->count == 0) {
flashcard_print_deck($cm, 0);
} else {
if ($decks->decks[3]->reactivate) {
flashcard_print_deck($cm, 4);
} else {
flashcard_print_deck($cm, -4);
}
}
?>
</td>
<?php
}
?>
</tr>
</table>
</center>