Skip to content

Commit

Permalink
replace mysql with queryDB()
Browse files Browse the repository at this point in the history
  • Loading branch information
atutorlangs committed Sep 28, 2013
1 parent afb9c13 commit 7a1adfe
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions mods/_standard/gradebook/gradebook_edit_tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

if (!$msg->containsErrors())
{
$sql = "UPDATE ".TABLE_PREFIX."gradebook_tests SET ";
$sql = "UPDATE %sgradebook_tests SET ";

if (isset($_POST["title"])) $sql .= "title = '".$_POST["title"]. "', ";
if ($_POST["has_due_date"] == 'true')
Expand All @@ -58,35 +58,32 @@
}
else
$sql .= "due_date = '', ";
$sql .= "grade_scale_id=".$_POST["selected_grade_scale_id"]." WHERE gradebook_test_id = ". $_REQUEST["gradebook_test_id"];
$result = mysql_query($sql, $db) or die(mysql_error());

$sql .= "grade_scale_id=%d WHERE gradebook_test_id = %d";
$result = queryDB($sql, array(TABLE_PREFIX, $_POST["selected_grade_scale_id"], $_REQUEST["gradebook_test_id"]));

$msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
header('Location: gradebook_tests.php');
exit;
}
}

$sql = "SELECT * FROM ".TABLE_PREFIX."gradebook_tests WHERE gradebook_test_id=" . $_REQUEST["gradebook_test_id"];
$result = mysql_query($sql, $db) or die(mysql_error());

$sql = "(SELECT g.gradebook_test_id, g.type, t.title, DATE_FORMAT(end_date, '%Y-%m-%d %H:%i:00') AS due_date, g.grade_scale_id".
" FROM ".TABLE_PREFIX."gradebook_tests g, ".TABLE_PREFIX."tests t".
$sql = "(SELECT g.gradebook_test_id, g.type, t.title, DATE_FORMAT(end_date, '%%Y-%%m-%%d %%H:%%i:00') AS due_date, g.grade_scale_id".
" FROM %sgradebook_tests g, %stests t".
" WHERE g.type='ATutor Test'".
" AND g.id = t.test_id".
" AND g.gradebook_test_id=".$_GET['gradebook_test_id'].")".
" UNION (SELECT g.gradebook_test_id, g.type, a.title, DATE_FORMAT(date_due, '%Y-%m-%d %H:%i:00') AS due_date, g.grade_scale_id".
" FROM ".TABLE_PREFIX."gradebook_tests g, ".TABLE_PREFIX."assignments a".
" AND g.gradebook_test_id=%d)".
" UNION (SELECT g.gradebook_test_id, g.type, a.title, DATE_FORMAT(date_due, '%%Y-%%m-%%d %%H:%%i:00') AS due_date, g.grade_scale_id".
" FROM %sgradebook_tests g, %sassignments a".
" WHERE g.type='ATutor Assignment'".
" AND g.id = a.assignment_id".
" AND g.gradebook_test_id=".$_GET['gradebook_test_id'].")".
" UNION (SELECT gradebook_test_id, type, title, DATE_FORMAT(due_date, '%Y-%m-%d %H:%i:00') AS due_date,grade_scale_id ".
" FROM ".TABLE_PREFIX."gradebook_tests".
" AND g.gradebook_test_id=%d)".
" UNION (SELECT gradebook_test_id, type, title, DATE_FORMAT(due_date, '%%Y-%%m-%%d %%H:%%i:00') AS due_date,grade_scale_id ".
" FROM %sgradebook_tests".
" WHERE type='External'".
" AND gradebook_test_id=".$_GET['gradebook_test_id'].")";
$result = mysql_query($sql, $db) or die(mysql_error());
$row_this = mysql_fetch_assoc($result);
" AND gradebook_test_id=%d)";
$row_this = queryDB($sql, array(TABLE_PREFIX, TABLE_PREFIX, $_GET['gradebook_test_id'],TABLE_PREFIX, TABLE_PREFIX, $_GET['gradebook_test_id'], TABLE_PREFIX, $_GET['gradebook_test_id']), TRUE);


if ($row_this["type"] == "External")
{
Expand Down

0 comments on commit 7a1adfe

Please sign in to comment.