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