MDL-9506 Refactored grade_tree::get_tree by doing the following:
[moodle-pu.git] / grade / exceptions.html
blob494f43362fa6fc084d833f1edce6408d6ce8c6f3
1 <script type="text/javascript">
2 //<![CDATA[
4 <?php
5 // javascript objects for excluded students
6 foreach ($listmembers as $grade_itemid => $listmember) {
7 echo "grade_item$grade_itemid = new Object();\n";
8 $useridstring = "grade_item$grade_itemid.userid = new Array(";
9 $usernamestring = "grade_item$grade_itemid.username = new Array(";
10 $max = count($listmember);
11 $count = 0;
12 foreach ($listmember as $userid => $username) {
13 $count++;
14 $useridstring .= "\"$userid\"";
15 $usernamestring .= "\"$username\"";
16 if ($count < $max) {
17 $useridstring .= ', ';
18 $usernamestring .= ', ';
21 $useridstring .= ");\n";
22 $usernamestring .= ");\n";
24 echo $useridstring;
25 echo $usernamestring;
28 // javascript objects for included students
29 foreach ($nonmembers as $grade_itemid => $listmember) {
30 echo "grade_item_inc$grade_itemid = new Object();\n";
31 $useridstring = "grade_item_inc$grade_itemid.userid = new Array(";
32 $usernamestring = "grade_item_inc$grade_itemid.username = new Array(";
33 $max = count($listmember);
34 $count = 0;
35 foreach ($listmember as $userid => $username) {
36 $count++;
37 $useridstring .= "\"$userid\"";
38 $usernamestring .= "\"$username\"";
39 if ($count < $max) {
40 $useridstring .= ', ';
41 $usernamestring .= ', ';
44 $useridstring .= ");\n";
45 $usernamestring .= ");\n";
47 echo $useridstring;
48 echo $usernamestring;
52 function updategrade_item() {
53 getElementById('form1').grade_itemid.value = getElementById('form2').grade_items.value;
54 getElementById('form3').grade_itemid.value = getElementById('form2').grade_items.value;
58 function updateMembers(selectgrade_item) {
59 eval('grade_item=grade_item'+selectgrade_item.value);
61 username = grade_item.username;
62 userid = grade_item.userid;
64 getElementById('form3')['members[]'].length = username.length;
66 for (i=0;i<username.length;i++) {
67 getElementById('form3')['members[]'].options[i].value = userid[i];
68 getElementById('form3')['members[]'].options[i].text = username[i];
71 eval('grade_item_inc=grade_item_inc'+selectgrade_item.value);
73 username = grade_item_inc.username;
74 userid = grade_item_inc.userid;
76 getElementById('form1')['nonmembers[]'].length = username.length;
78 for (i=0;i<username.length;i++) {
79 getElementById('form1')['nonmembers[]'].options[i].value = userid[i];
80 getElementById('form1')['nonmembers[]'].options[i].text = username[i];
83 updategrade_item();
86 // end hiding script -->
87 </script>
91 <table border="0" cellspacing="2" cellpadding="5" align="center" class="generalbox">
92 <tr>
93 <td colspan="3" class="header">
94 <?php
95 print get_string('gradeexceptions','grades');
96 helpbutton('exceptions',get_string('gradeexceptionshelp','grades'), 'grade');
98 </td>
99 </tr>
100 <tr>
101 <td width="33%" align="center" class="generaltableheader"><?php p($strgradeitemnonmembers) ?></td>
102 <td width="33%" align="center" class="generaltableheader"><?php p($strgradeitems) ?></td>
103 <td width="33%" align="center" class="generaltableheader"><?php p($strgradeitemmembersselected) ?></td>
104 </tr>
105 <tr align="center" valign="top">
106 <td class="generalboxcontent">
107 <form id="form1" method="post" action="exceptions.php">
108 <input type="hidden" name="id" value="<?php p($course->id) ?>" />
109 <input type="hidden" name="grade_itemid" value="<?php p($selectedgrade_item) ?>" />
110 <input type="hidden" name="action" value="excepts" />
111 <input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>"/>
112 <select name="nonmembers[]" size="15" multiple="multiple">
113 <?php
114 if (!empty($nonmembers[$selectedgrade_item])) {
115 foreach ($nonmembers[$selectedgrade_item] as $id => $nonmembername) {
116 echo "<option value=\"$id\">$nonmembername</option>";
120 </select>
122 <input type="submit" name="nonmembersadd" value="<?php p($strgradeitemaddusers) ?>"
123 onclick="updategrade_item()" />
124 </p>
125 </form>
126 </td>
127 <td class="generalboxcontent">
128 <form id="form2" method="post" action="grade_items.php">
129 <input type="hidden" name="id" value="<?php p($course->id) ?>" />
130 <input type="hidden" name="action" value="excepts" />
131 <input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>"/>
132 <select name="grade_items" size="15" onchange="updateMembers(this)">
133 <?php
134 if (!empty($listgrade_items)) {
135 foreach ($listgrade_items as $id => $listgrade_item) {
136 $selected = '';
137 if ($id == $selectedgrade_item) {
138 $selected = 'selected="selected"';
140 echo "<option $selected value=\"$id\">$listgrade_item</option>";
144 </select>
145 </form>
146 </td>
149 <td class="generalboxcontent">
150 <form id="form3" method="post" action="exceptions.php">
151 <input type="hidden" name="id" value="<?php p($course->id) ?>" />
152 <input type="hidden" name="grade_itemid" value="<?php p($selectedgrade_item) ?>" />
153 <input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>"/>
154 <input type="hidden" name="action" value="excepts" />
155 <select name="members[]" size="15" multiple="multiple">
156 <?php
157 if (!empty($listmembers[$selectedgrade_item])) {
158 foreach ($listmembers[$selectedgrade_item] as $id => $membername) {
159 echo "<option value=\"$id\">$membername</option>";
163 </select>
165 <input type="submit" name="membersremove" value="<?php p($strgradeitemremovemembers) ?>"
166 onclick="updategrade_item()" />
167 </p>
168 </form>
169 </td>
170 </tr>
171 </table>
172 <script type="text/javascript">
173 <!-- Begin
174 <?php
175 echo 'updateMembers('.$selectedgrade_item.');';
177 //]]>
178 </script>