2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
16 define('AT_INCLUDE_PATH', '../../../include/');
17 require (AT_INCLUDE_PATH.'vitals.inc.php');
18 authenticate(AT_PRIV_GRADEBOOK);
20 function print_row($grade_scale_id, $scale_name, $value, $created_date, $post_grade_scale_id, $print_radio_button=true)
23 <tr onmousedown="document.form['m<?php echo $grade_scale_id; ?>'].checked = true; rowselect(this);" id="r_<?php echo $grade_scale_id; ?>">
25 if ($print_radio_button)
28 <td width="10"><input type="radio" name="grade_scale_id" value="<?php echo $grade_scale_id; ?>" id="m<?php echo $grade_scale_id; ?>" <?php if ($grade_scale_id==$post_grade_scale_id) echo 'checked'; ?> /></td>
29 <td><label for="m<?php echo $grade_scale_id; ?>"><?php echo $scale_name; ?></label></td>
35 <td><?php echo $scale_name; ?></td>
39 <td><?php echo $value; ?></td>
40 <td><?php echo $created_date; ?></td>
45 if (isset($_POST['remove'], $_POST['grade_scale_id']))
47 header('Location: grade_scale_delete.php?grade_scale_id='.$_POST['grade_scale_id']);
50 else if (isset($_POST['edit'], $_POST['grade_scale_id']))
52 header('Location: grade_scale_edit.php?grade_scale_id='.$_POST['grade_scale_id']);
55 else if (!empty($_POST) && !isset($_POST['grade_scale_id'])) {
56 $msg->addError('NO_ITEM_SELECTED');
59 require(AT_INCLUDE_PATH.'header.inc.php');
61 <div class="toolcontainer">
62 <form name="form" method="post" action="mods/_standard/gradebook/grade_scale.php">
64 <h3 align="center"><?php echo _AT('custom_grade_scale'); ?></h3>
66 <table summary="" class="data" rules="cols" align="center" style="width: 90%;">
70 <th scope="col"> </th>
71 <th scope="col"><?php echo _AT('name'); ?></th>
72 <th scope="col"><?php echo _AT('grade_scale'); ?></th>
73 <th scope="col"><?php echo _AT('created_date'); ?></th>
79 <div class="row buttons">
80 <input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" />
81 <input type="submit" name="remove" value="<?php echo _AT('remove'); ?>" />
92 $sql = "SELECT g.*, d.* from ".TABLE_PREFIX."grade_scales g, ".TABLE_PREFIX."grade_scales_detail d WHERE g.member_id= ".$_SESSION["member_id"]." AND g.grade_scale_id = d.grade_scale_id ORDER BY g.grade_scale_id, d.percentage_to desc";
94 $result = mysql_query($sql, $db) or die(mysql_error());
96 if (mysql_num_rows($result) == 0)
100 <td colspan="5"><?php echo _AT('none_found'); ?></td>
106 $prev_row['grade_scale_id'] = 0;
107 while ($row = mysql_fetch_assoc($result))
109 if ($row['grade_scale_id'] <> $prev_row['grade_scale_id'])
112 if ($prev_row['grade_scale_id'] <> 0) print_row($prev_row['grade_scale_id'], $prev_row['scale_name'], $whole_scale_value, $prev_row['created_date'], $_POST['grade_scale_id']);
114 // initialize next $whole_scale_value
115 $whole_scale_value = $row['scale_value'] . ' = ' . $row['percentage_from'] . ' to ' . $row['percentage_to'] . '%';
120 $whole_scale_value .= '<br />'.$row['scale_value'] . ' = ' . $row['percentage_from'] . ' to ' . $row['percentage_to'] . '%';
124 if ($prev_row['grade_scale_id'] <> 0) print_row($prev_row['grade_scale_id'], $prev_row['scale_name'], $whole_scale_value, $prev_row['created_date'], $_POST['grade_scale_id']);
132 <h3 align="center"><?php echo _AT('preset_grade_scale'); ?></h3>
133 <table summary="" class="data" rules="cols" align="center" style="width: 90%;">
136 <th scope="col"><?php echo _AT('name'); ?></th>
137 <th scope="col"><?php echo _AT('grade_scale'); ?></th>
138 <th scope="col"><?php echo _AT('created_date'); ?></th>
145 // print preset scale table
146 $sql = "SELECT g.*, d.* from ".TABLE_PREFIX."grade_scales g, ".TABLE_PREFIX."grade_scales_detail d WHERE g.member_id= 0 AND g.grade_scale_id = d.grade_scale_id ORDER BY g.grade_scale_id, d.percentage_to desc";
148 $result = mysql_query($sql, $db) or die(mysql_error());
150 if (mysql_num_rows($result) == 0)
154 <td colspan="5"><?php echo _AT('none_found'); ?></td>
160 $prev_row['grade_scale_id'] = 0;
161 while ($row = mysql_fetch_assoc($result))
163 if ($row['grade_scale_id'] <> $prev_row['grade_scale_id'])
166 if ($prev_row['grade_scale_id'] <> 0) print_row($prev_row['grade_scale_id'], $prev_row['scale_name'], $whole_scale_value, $prev_row['created_date'], $_POST['grade_scale_id'], false);
168 // initialize next $whole_scale_value
169 $whole_scale_value = $row['scale_value'] . ' = ' . $row['percentage_from'] . ' to ' . $row['percentage_to'] . '%';
174 $whole_scale_value .= '<br />'.$row['scale_value'] . ' = ' . $row['percentage_from'] . ' to ' . $row['percentage_to'] . '%';
178 if ($prev_row['grade_scale_id'] <> 0) print_row($prev_row['grade_scale_id'], $prev_row['scale_name'], $whole_scale_value, $prev_row['created_date'], $_POST['grade_scale_id'], false);
185 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>