2 /************************************************************************/
\r
4 /************************************************************************/
\r
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/
\r
6 /* Adaptive Technology Resource Centre / University of Toronto */
\r
7 /* http://atutor.ca */
\r
9 /* This program is free software. You can redistribute it and/or */
\r
10 /* modify it under the terms of the GNU General Public License */
\r
11 /* as published by the Free Software Foundation. */
\r
12 /************************************************************************/
\r
13 // $Id: grade_scale.php 7208 2008-05-28 16:07:24Z cindy $
\r
15 $page = 'gradebook';
\r
17 define('AT_INCLUDE_PATH', '../../include/');
\r
18 require (AT_INCLUDE_PATH.'vitals.inc.php');
\r
19 authenticate(AT_PRIV_GRADEBOOK);
\r
21 function print_row($grade_scale_id, $scale_name, $value, $created_date, $post_grade_scale_id, $print_radio_button=true)
\r
24 <tr onmousedown="document.form['m<?php echo $grade_scale_id; ?>'].checked = true; rowselect(this);" id="r_<?php echo $grade_scale_id; ?>">
\r
26 if ($print_radio_button)
\r
29 <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>
\r
30 <td><label for="m<?php echo $grade_scale_id; ?>"><?php echo $scale_name; ?></label></td>
\r
36 <td><?php echo $scale_name; ?></td>
\r
40 <td><?php echo $value; ?></td>
\r
41 <td><?php echo $created_date; ?></td>
\r
46 if (isset($_POST['remove'], $_POST['grade_scale_id']))
\r
48 header('Location: grade_scale_delete.php?grade_scale_id='.$_POST['grade_scale_id']);
\r
51 else if (isset($_POST['edit'], $_POST['grade_scale_id']))
\r
53 header('Location: grade_scale_edit.php?grade_scale_id='.$_POST['grade_scale_id']);
\r
56 else if (!empty($_POST) && !isset($_POST['grade_scale_id'])) {
\r
57 $msg->addError('NO_ITEM_SELECTED');
\r
60 require(AT_INCLUDE_PATH.'header.inc.php');
\r
63 <form name="form" method="post" action="<?php echo 'mods/gradebook/grade_scale.php'; ?>">
\r
65 <h3 align="center"><?php echo _AT('custom_grade_scale'); ?></h3>
\r
67 <table summary="" class="data" rules="cols" align="center" style="width: 70%;">
\r
71 <th scope="col"> </th>
\r
72 <th scope="col"><?php echo _AT('name'); ?></th>
\r
73 <th scope="col"><?php echo _AT('grade_scale'); ?></th>
\r
74 <th scope="col"><?php echo _AT('created_date'); ?></th>
\r
80 <div class="row buttons">
\r
81 <input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" />
\r
82 <input type="submit" name="remove" value="<?php echo _AT('remove'); ?>" />
\r
87 <td colspan="5"></td>
\r
93 $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";
\r
95 $result = mysql_query($sql, $db) or die(mysql_error());
\r
97 if (mysql_num_rows($result) == 0)
\r
101 <td colspan="5"><?php echo _AT('none_found'); ?></td>
\r
107 $prev_row['grade_scale_id'] = 0;
\r
108 while ($row = mysql_fetch_assoc($result))
\r
110 if ($row['grade_scale_id'] <> $prev_row['grade_scale_id'])
\r
113 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']);
\r
115 // initialize next $whole_scale_value
\r
116 $whole_scale_value = $row['scale_value'] . ' = ' . $row['percentage_from'] . ' to ' . $row['percentage_to'] . '%';
\r
121 $whole_scale_value .= '<br />'.$row['scale_value'] . ' = ' . $row['percentage_from'] . ' to ' . $row['percentage_to'] . '%';
\r
125 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']);
\r
133 <h3 align="center"><?php echo _AT('preset_grade_scale'); ?></h3>
\r
134 <table summary="" class="data" rules="cols" align="center" style="width: 70%;">
\r
137 <th scope="col"><?php echo _AT('name'); ?></th>
\r
138 <th scope="col"><?php echo _AT('grade_scale'); ?></th>
\r
139 <th scope="col"><?php echo _AT('created_date'); ?></th>
\r
146 // print preset scale table
\r
147 $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";
\r
149 $result = mysql_query($sql, $db) or die(mysql_error());
\r
151 if (mysql_num_rows($result) == 0)
\r
155 <td colspan="5"><?php echo _AT('none_found'); ?></td>
\r
161 $prev_row['grade_scale_id'] = 0;
\r
162 while ($row = mysql_fetch_assoc($result))
\r
164 if ($row['grade_scale_id'] <> $prev_row['grade_scale_id'])
\r
167 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);
\r
169 // initialize next $whole_scale_value
\r
170 $whole_scale_value = $row['scale_value'] . ' = ' . $row['percentage_from'] . ' to ' . $row['percentage_to'] . '%';
\r
175 $whole_scale_value .= '<br />'.$row['scale_value'] . ' = ' . $row['percentage_from'] . ' to ' . $row['percentage_to'] . '%';
\r
179 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);
\r
186 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>
\r