2 /****************************************************************************/
\r
4 /****************************************************************************/
\r
5 /* Copyright (c) 2002-2010 */
\r
6 /* Inclusive Design Institute */
\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
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['submit_no'])) {
\r
22 $msg->addFeedback('CANCELLED');
\r
23 header('Location: gradebook_tests.php');
\r
25 } else if (isset($_POST['submit_yes'])) {
\r
26 /* delete has been confirmed, delete this category */
\r
27 $gradebook_test_id = intval($_POST['gradebook_test_id']);
\r
29 $sql = "DELETE FROM ".TABLE_PREFIX."gradebook_tests WHERE gradebook_test_id=$gradebook_test_id";
\r
30 $result = mysql_query($sql, $db) or die(mysql_error());
\r
32 $sql = "DELETE FROM ".TABLE_PREFIX."gradebook_detail WHERE gradebook_test_id=$gradebook_test_id";
\r
33 $result = mysql_query($sql, $db) or die(mysql_error());
\r
35 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
\r
36 header('Location: gradebook_tests.php');
\r
40 require(AT_INCLUDE_PATH.'header.inc.php');
\r
42 $_GET['gradebook_test_id'] = intval($_GET['gradebook_test_id']);
\r
44 $sql = "(SELECT g.gradebook_test_id, t.title".
\r
45 " FROM ".TABLE_PREFIX."gradebook_tests g, ".TABLE_PREFIX."tests t".
\r
46 " WHERE g.type='ATutor Test'".
\r
47 " AND g.id = t.test_id".
\r
48 " AND g.gradebook_test_id=".$_GET['gradebook_test_id'].")".
\r
49 " UNION (SELECT g.gradebook_test_id, a.title".
\r
50 " FROM ".TABLE_PREFIX."gradebook_tests g, ".TABLE_PREFIX."assignments a".
\r
51 " WHERE g.type='ATutor Assignment'".
\r
52 " AND g.id = a.assignment_id".
\r
53 " AND g.gradebook_test_id=".$_GET['gradebook_test_id'].")".
\r
54 " UNION (SELECT gradebook_test_id, title ".
\r
55 " FROM ".TABLE_PREFIX."gradebook_tests".
\r
56 " WHERE type='External'".
\r
57 " AND gradebook_test_id=".$_GET['gradebook_test_id'].")";
\r
59 $result = mysql_query($sql,$db) or die(mysql_error());
\r
61 if (mysql_num_rows($result) == 0) {
\r
62 $msg->printErrors('ITEM_NOT_FOUND');
\r
64 $row = mysql_fetch_assoc($result);
\r
66 $hidden_vars['title']= $row["title"];
\r
67 $hidden_vars['gradebook_test_id'] = $row['gradebook_test_id'];
\r
69 $confirm = array('DELETE_TEST_FROM_GRADEBOOK', $row["title"]);
\r
70 $msg->addConfirm($confirm, $hidden_vars);
\r
72 $msg->printConfirm();
\r
75 require(AT_INCLUDE_PATH.'footer.inc.php');
\r