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 if (isset($_POST['remove'], $_POST['gradebook_test_id']))
\r
23 header('Location: gradebook_delete_tests.php?gradebook_test_id='.$_POST['gradebook_test_id']);
\r
26 else if (isset($_POST['edit'], $_POST['gradebook_test_id']))
\r
28 header('Location: gradebook_edit_tests.php?gradebook_test_id='.$_POST['gradebook_test_id']);
\r
31 else if (!empty($_POST) && !isset($_POST['gradebook_test_id'])) {
\r
32 $msg->addError('NO_ITEM_SELECTED');
\r
35 require(AT_INCLUDE_PATH.'header.inc.php');
\r
39 <form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
\r
41 <table summary="" class="data" rules="cols" align="center" style="width: 70%;">
\r
45 <th scope="col"> </th>
\r
46 <th scope="col"><?php echo _AT('name'); ?></th>
\r
47 <th scope="col"><?php echo _AT('grade_scale'); ?></th>
\r
48 <th scope="col"><?php echo _AT('type'); ?></th>
\r
54 <div class="row buttons">
\r
55 <input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" />
\r
56 <input type="submit" name="remove" value="<?php echo _AT('remove'); ?>" />
\r
64 $sql = "(SELECT g.gradebook_test_id, type, t.title, grade_scale_id".
\r
65 " FROM ".TABLE_PREFIX."gradebook_tests g, ".TABLE_PREFIX."tests t".
\r
66 " WHERE g.type='ATutor Test'".
\r
67 " AND g.id = t.test_id".
\r
68 " AND t.course_id=".$_SESSION["course_id"].")".
\r
69 " UNION (SELECT g.gradebook_test_id, g.type, a.title, grade_scale_id".
\r
70 " FROM ".TABLE_PREFIX."gradebook_tests g, ".TABLE_PREFIX."assignments a".
\r
71 " WHERE g.type='ATutor Assignment'".
\r
72 " AND g.id = a.assignment_id".
\r
73 " AND a.course_id=".$_SESSION["course_id"].")".
\r
74 " UNION (SELECT gradebook_test_id, type, title, grade_scale_id".
\r
75 " FROM ".TABLE_PREFIX."gradebook_tests".
\r
76 " WHERE course_id=".$_SESSION["course_id"].")".
\r
77 " ORDER BY type, title";
\r
78 $result = mysql_query($sql, $db) or die(mysql_error());
\r
80 if (mysql_num_rows($result) == 0)
\r
84 <td colspan="5"><?php echo _AT('none_found'); ?></td>
\r
90 // Initialize scale content array
\r
91 $scale_content[0] = _AT("raw_final_score");
\r
92 $sql_scale_ids = "SELECT grade_scale_id from ".TABLE_PREFIX."grade_scales g";
\r
93 $result_scale_ids = mysql_query($sql_scale_ids, $db) or die(mysql_error());
\r
95 while ($row_scale_ids = mysql_fetch_assoc($result_scale_ids))
\r
97 $sql_detail = "SELECT * from ".TABLE_PREFIX."grade_scales_detail d WHERE d.grade_scale_id = ".$row_scale_ids["grade_scale_id"]." ORDER BY d.percentage_to desc";
\r
98 $result_detail = mysql_query($sql_detail, $db) or die(mysql_error());
\r
100 $whole_scale_value = "";
\r
102 while ($row_detail = mysql_fetch_assoc($result_detail))
\r
104 $whole_scale_value .= $row_detail['scale_value'] . ' = ' . $row_detail['percentage_from'] . ' to ' . $row_detail['percentage_to'] . '%<br>';
\r
107 if ($whole_scale_value <> '') $scale_content[$row_scale_ids["grade_scale_id"]] = $whole_scale_value;
\r
109 // End of initialize scale content array
\r
111 while ($row = mysql_fetch_assoc($result))
\r
114 <tr onmousedown="document.form['m<?php echo $row["gradebook_test_id"]; ?>'].checked = true; rowselect(this);" id="r_<?php echo $row["gradebook_test_id"]; ?>">
\r
115 <td width="10"><input type="radio" name="gradebook_test_id" value="<?php echo $row["gradebook_test_id"]; ?>" id="m<?php echo $row["gradebook_test_id"]; ?>" <?php if ($row["gradebook_test_id"]==$_POST['gradebook_test_id']) echo 'checked'; ?> /></td>
\r
116 <td><label for="m<?php echo $row["gradebook_test_id"]; ?>"><?php echo $row["title"]; ?></label></td>
\r
117 <td><?php echo $scale_content[$row["grade_scale_id"]]; ?></td>
\r
118 <td><?php echo $row["type"]; ?></td>
\r
129 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>
\r