forked from kanemura1206/maspen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.html
178 lines (157 loc) · 6.45 KB
/
exceptions.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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<script language="JavaScript" type="text/javascript">
<!-- Begin
<?php
// javascript objects for excluded students
foreach ($listmembers as $grade_itemid => $listmember) {
echo "grade_item$grade_itemid = new Object();\n";
$useridstring = "grade_item$grade_itemid.userid = new Array(";
$usernamestring = "grade_item$grade_itemid.username = new Array(";
$max = count($listmember);
$count = 0;
foreach ($listmember as $userid => $username) {
$count++;
$useridstring .= "\"$userid\"";
$usernamestring .= "\"$username\"";
if ($count < $max) {
$useridstring .= ', ';
$usernamestring .= ', ';
}
}
$useridstring .= ");\n";
$usernamestring .= ");\n";
echo $useridstring;
echo $usernamestring;
}
// javascript objects for included students
foreach ($nonmembers as $grade_itemid => $listmember) {
echo "grade_item_inc$grade_itemid = new Object();\n";
$useridstring = "grade_item_inc$grade_itemid.userid = new Array(";
$usernamestring = "grade_item_inc$grade_itemid.username = new Array(";
$max = count($listmember);
$count = 0;
foreach ($listmember as $userid => $username) {
$count++;
$useridstring .= "\"$userid\"";
$usernamestring .= "\"$username\"";
if ($count < $max) {
$useridstring .= ', ';
$usernamestring .= ', ';
}
}
$useridstring .= ");\n";
$usernamestring .= ");\n";
echo $useridstring;
echo $usernamestring;
}
?>
function updategrade_item() {
document.form1.grade_itemid.value = document.form2.grade_items.value;
document.form3.grade_itemid.value = document.form2.grade_items.value;
}
function updateMembers(selectgrade_item) {
eval('grade_item=grade_item'+selectgrade_item.value);
username = grade_item.username;
userid = grade_item.userid;
document.form3['members[]'].length = username.length;
for (i=0;i<username.length;i++) {
document.form3['members[]'].options[i].value = userid[i];
document.form3['members[]'].options[i].text = username[i];
}
eval('grade_item_inc=grade_item_inc'+selectgrade_item.value);
username = grade_item_inc.username;
userid = grade_item_inc.userid;
document.form1['nonmembers[]'].length = username.length;
for (i=0;i<username.length;i++) {
document.form1['nonmembers[]'].options[i].value = userid[i];
document.form1['nonmembers[]'].options[i].text = username[i];
}
updategrade_item();
}
// end hiding script -->
</script>
<table border="0" cellspacing="2" cellpadding="5" align="center" class="generalbox">
<tr>
<th colspan="3" class="header">
<?php
print get_string('gradeexceptions','grades');
helpbutton('exceptions',get_string('gradeexceptionshelp','grades'), 'grade');
?>
</th>
</tr>
<tr>
<td width="33%" align="center" class="generaltableheader"><?php p($strgradeitemnonmembers) ?></td>
<td width="33%" align="center" class="generaltableheader"><?php p($strgradeitems) ?></td>
<td width="33%" align="center" class="generaltableheader"><?php p($strgradeitemmembersselected) ?></td>
</tr>
<tr align="center" valign="top">
<td class="generalboxcontent">
<form name="form1" id="form1" method="post" action="exceptions.php">
<input type="hidden" name="id" value="<?php p($course->id) ?>" />
<input type="hidden" name="grade_itemid" value="<?php p($selectedgrade_item) ?>" />
<input type="hidden" name="action" value="excepts" />
<input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>"/>
<select name="nonmembers[]" size="15" multiple="multiple">
<?php
if (!empty($nonmembers[$selectedgrade_item])) {
foreach ($nonmembers[$selectedgrade_item] as $id => $nonmembername) {
echo "<option value=\"$id\">$nonmembername</option>";
}
}
?>
</select>
<p>
<input type="submit" name="nonmembersadd" value="<?php p($strgradeitemaddusers) ?>"
onclick="updategrade_item()" />
</p>
</form>
</td>
<td class="generalboxcontent">
<form name="form2" id="form2" method="post" action="grade_items.php">
<input type="hidden" name="id" value="<?php p($course->id) ?>" />
<input type="hidden" name="action" value="excepts" />
<input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>"/>
<select name="grade_items" size="15" onchange="updateMembers(this)">
<?php
if (!empty($listgrade_items)) {
foreach ($listgrade_items as $id => $listgrade_item) {
$selected = '';
if ($id == $selectedgrade_item) {
$selected = 'selected="selected"';
}
echo "<option $selected value=\"$id\">$listgrade_item</option>";
}
}
?>
</select>
</form>
</td>
<td class="generalboxcontent">
<form name="form3" id="form3" method="post" action="exceptions.php">
<input type="hidden" name="id" value="<?php p($course->id) ?>" />
<input type="hidden" name="grade_itemid" value="<?php p($selectedgrade_item) ?>" />
<input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>"/>
<input type="hidden" name="action" value="excepts" />
<select name="members[]" size="15" multiple="multiple">
<?php
if (!empty($listmembers[$selectedgrade_item])) {
foreach ($listmembers[$selectedgrade_item] as $id => $membername) {
echo "<option value=\"$id\">$membername</option>";
}
}
?>
</select>
<p>
<input type="submit" name="membersremove" value="<?php p($strgradeitemremovemembers) ?>"
onclick="updategrade_item()" />
</p>
</form>
</td>
</tr>
</table>
<script language="JavaScript">
<!-- Begin
<?php
echo 'updateMembers('.$selectedgrade_item.');';
?>
// end hiding script -->
</script>