aimmath-commit Mailing List for AiM Assessment in Mathematics (Page 6)
Brought to you by:
gustav_delius,
npstrick
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
(73) |
Aug
(96) |
Sep
(240) |
Oct
(34) |
Nov
(12) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(31) |
Feb
(6) |
Mar
(17) |
Apr
(6) |
May
(5) |
Jun
|
Jul
|
Aug
(2) |
Sep
(2) |
Oct
(19) |
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
(14) |
Apr
(33) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <gus...@us...> - 2004-01-11 14:08:10
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv10816 Modified Files: aimpage.php config.html deleteserver.php editgrade.php lib.php mod.html pdfgen.php saveconfig.php servers.php setseed.php subjectpage.php view.php Log Message: brought tables in line with Moodle coding guidlines Index: aimpage.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/aimpage.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** aimpage.php 16 Nov 2003 18:38:23 -0000 1.19 --- aimpage.php 11 Jan 2004 14:08:06 -0000 1.20 *************** *** 50,57 **** } } ! if (!$subject = get_record("math_assignment_subject", "course", $course->id)) { error(get_string("noaccess", "math_assignment")); } ! if (!$server = get_record("math_assignment_server", "id", $subject->server)) { error(get_string("noaccess", "math_assignment")); } --- 50,57 ---- } } ! if (!$subject = get_record("math_assignment_subjects", "course", $course->id)) { error(get_string("noaccess", "math_assignment")); } ! if (!$server = get_record("math_assignment_servers", "id", $subject->server)) { error(get_string("noaccess", "math_assignment")); } *************** *** 119,124 **** else { // Do Quiz // get student seed if appropriate ! if (record_exists("math_assignment_seed", "assignment", $math_assignment->id)) { ! if (!$seeddata = get_record("math_assignment_seed", "assignment", $math_assignment->id, "student", $USER->id)) { // no seed has been assigned to student yet, so ask // Print the page header --- 119,124 ---- else { // Do Quiz // get student seed if appropriate ! if (record_exists("math_assignment_seeds", "assignment", $math_assignment->id)) { ! if (!$seeddata = get_record("math_assignment_seeds", "assignment", $math_assignment->id, "userid", $USER->id)) { // no seed has been assigned to student yet, so ask // Print the page header Index: config.html =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/config.html,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** config.html 25 Sep 2003 22:14:09 -0000 1.6 --- config.html 11 Jan 2004 14:08:06 -0000 1.7 *************** *** 84,88 **** // get aim server $options = array(); ! if ($servers = get_records("math_assignment_server", "", "", "name ASC")) { foreach ($servers as $server) { $options[$server->id] = $server->name; --- 84,88 ---- // get aim server $options = array(); ! if ($servers = get_records("math_assignment_servers", "", "", "name ASC")) { foreach ($servers as $server) { $options[$server->id] = $server->name; *************** *** 91,95 **** foreach ($courses as $course) { ! if (!$subject = get_record("math_assignment_subject", "course", $course->id)) { $subject->name = ""; $subject->server = 0; --- 91,95 ---- foreach ($courses as $course) { ! if (!$subject = get_record("math_assignment_subjects", "course", $course->id)) { $subject->name = ""; $subject->server = 0; *************** *** 133,137 **** $courseids = "$course->id"; } ! $db->Execute("DELETE FROM `{$CFG->prefix}math_assignment_subject` WHERE `course` NOT IN ($courseids)"); ?> --- 133,137 ---- $courseids = "$course->id"; } ! $db->Execute("DELETE FROM `{$CFG->prefix}math_assignment_subjects` WHERE `course` NOT IN ($courseids)"); ?> Index: deleteserver.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/deleteserver.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** deleteserver.php 23 Sep 2003 17:53:10 -0000 1.2 --- deleteserver.php 11 Jan 2004 14:08:06 -0000 1.3 *************** *** 20,33 **** if ($newserver && $newserver != $id) { // change subjects using this server to use new server ! if (!$db->Execute("UPDATE `{$CFG->prefix}math_assignment_subject` SET `server` = $newserver WHERE `server` = $id")) error(get_string("failed", "math_assignment"), "servers.php"); } else { // delete subjects for this server ! if (!delete_records("math_assignment_subject", "server", $id)) error(get_string("failed", "math_assignment"), "servers.php"); } // delete the server ! if (!delete_records("math_assignment_server", "id", $id)) { error(get_string("failed", "math_assignment"), "servers.php"); } --- 20,33 ---- if ($newserver && $newserver != $id) { // change subjects using this server to use new server ! if (!$db->Execute("UPDATE `{$CFG->prefix}math_assignment_subjects` SET `server` = $newserver WHERE `server` = $id")) error(get_string("failed", "math_assignment"), "servers.php"); } else { // delete subjects for this server ! if (!delete_records("math_assignment_subjects", "server", $id)) error(get_string("failed", "math_assignment"), "servers.php"); } // delete the server ! if (!delete_records("math_assignment_servers", "id", $id)) { error(get_string("failed", "math_assignment"), "servers.php"); } *************** *** 37,39 **** redirect("servers.php", get_string("changessaved"), 1); ! ?> \ No newline at end of file --- 37,39 ---- redirect("servers.php", get_string("changessaved"), 1); ! ?> Index: editgrade.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/editgrade.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** editgrade.php 16 Nov 2003 18:38:23 -0000 1.4 --- editgrade.php 11 Jan 2004 14:08:06 -0000 1.5 *************** *** 35,39 **** if ($resetseed) { ! delete_records("math_assignment_seed", "student", $userid, "assignment", $math_assignment->id); } --- 35,39 ---- if ($resetseed) { ! delete_records("math_assignment_seeds", "userid", $userid, "assignment", $math_assignment->id); } *************** *** 156,160 **** <?php ! if ($seedinfo = get_field("math_assignment_seed", "seed", "assignment", $id, "student", $userid)) { ?> <tr valign="top"> --- 156,160 ---- <?php ! if ($seedinfo = get_field("math_assignment_seeds", "seed", "assignment", $id, "userid", $userid)) { ?> <tr valign="top"> Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** lib.php 11 Jan 2004 13:15:33 -0000 1.44 --- lib.php 11 Jan 2004 14:08:06 -0000 1.45 *************** *** 524,529 **** /// returns an array with all the quiz names ! $subject = get_record("math_assignment_subject", "course", $course); ! $server = get_record("math_assignment_server", "id", $subject->server); $postdata = ""; --- 524,529 ---- /// returns an array with all the quiz names ! $subject = get_record("math_assignment_subjects", "course", $course); ! $server = get_record("math_assignment_servers", "id", $subject->server); $postdata = ""; *************** *** 549,555 **** } ! if (!$subject = get_record("math_assignment_subject", "course", $math_assignment->course)) return false; ! if (!$server = get_record("math_assignment_server", "id", $subject->server)) return false; --- 549,555 ---- } ! if (!$subject = get_record("math_assignment_subjects", "course", $math_assignment->course)) return false; ! if (!$server = get_record("math_assignment_servers", "id", $subject->server)) return false; *************** *** 590,599 **** if (is_null($subject)) { ! if (!$subject = get_record("math_assignment_subject", "course", $math_assignment->course)) return false; $server = null; } if (is_null($server)) { ! if (!$server = get_record("math_assignment_server", "id", $subject->server)) return false; } --- 590,599 ---- if (is_null($subject)) { ! if (!$subject = get_record("math_assignment_subjects", "course", $math_assignment->course)) return false; $server = null; } if (is_null($server)) { ! if (!$server = get_record("math_assignment_servers", "id", $subject->server)) return false; } *************** *** 1084,1093 **** // if ($showaim && $math_assignment->aimquiz) { // // lookup subject ! // if (! $subject = get_record("math_assignment_subject", "course", $course->id)) { // $subject->server = 0; // $subject->name = "Unknown"; // } // // lookup server ! // if (! $server = get_record("math_assignment_server", "id", $subject->server)) { // $server->name = "Unknown"; // $server->address = "unknown"; --- 1084,1093 ---- // if ($showaim && $math_assignment->aimquiz) { // // lookup subject ! // if (! $subject = get_record("math_assignment_subjects", "course", $course->id)) { // $subject->server = 0; // $subject->name = "Unknown"; // } // // lookup server ! // if (! $server = get_record("math_assignment_servers", "id", $subject->server)) { // $server->name = "Unknown"; // $server->address = "unknown"; Index: mod.html =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/mod.html,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** mod.html 31 Oct 2003 14:05:59 -0000 1.25 --- mod.html 11 Jan 2004 14:08:06 -0000 1.26 *************** *** 54,58 **** // get aimsubject from database ! if (!$aimsubject = get_field("math_assignment_subject", "name", "course", $form->course)) $aimsubject = ""; --- 54,58 ---- // get aimsubject from database ! if (!$aimsubject = get_field("math_assignment_subjects", "name", "course", $form->course)) $aimsubject = ""; Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** pdfgen.php 16 Nov 2003 18:38:23 -0000 1.24 --- pdfgen.php 11 Jan 2004 14:08:06 -0000 1.25 *************** *** 43,50 **** if ($math_assignment->aimquiz) { ! if (!$subject = get_record("math_assignment_subject", "course", $course->id)) { error(get_string("noaccess", "math_assignment")); } ! if (!$server = get_record("math_assignment_server", "id", $subject->server)) { error(get_string("noaccess", "math_assignment")); } --- 43,50 ---- if ($math_assignment->aimquiz) { ! if (!$subject = get_record("math_assignment_subjects", "course", $course->id)) { error(get_string("noaccess", "math_assignment")); } ! if (!$server = get_record("math_assignment_servers", "id", $subject->server)) { error(get_string("noaccess", "math_assignment")); } *************** *** 52,57 **** // get student seed if appropriate ! if (isstudent($course->id) and record_exists("math_assignment_seed", "assignment", $math_assignment->id)) { ! if (!$seeddata = get_record("math_assignment_seed", "assignment", $math_assignment->id, "student", $USER->id)) { // no seed has been assigned to student yet, so ask // Print the page header --- 52,57 ---- // get student seed if appropriate ! if (isstudent($course->id) and record_exists("math_assignment_seeds", "assignment", $math_assignment->id)) { ! if (!$seeddata = get_record("math_assignment_seeds", "assignment", $math_assignment->id, "userid", $USER->id)) { // no seed has been assigned to student yet, so ask // Print the page header *************** *** 98,109 **** if ($printcopies > 0) { $newseed->assignment = $math_assignment->id; ! $newseed->student = NULL; for ($i = 1; $i <= $printcopies; $i++) { $newseed->seed = mt_rand (10000000,99999999); // make sure seed hasn't already been used ! while (get_record("math_assignment_seed", "assignment", $newseed->assignment, "seed", $newseed->seed)) { $newseed->seed = mt_rand (10000000,99999999); } ! if (!insert_record("math_assignment_seed", $newseed, $returnid=false)) { error("Couldn't add $i seed $newseed->seed to database"); } --- 98,109 ---- if ($printcopies > 0) { $newseed->assignment = $math_assignment->id; ! $newseed->userid = NULL; for ($i = 1; $i <= $printcopies; $i++) { $newseed->seed = mt_rand (10000000,99999999); // make sure seed hasn't already been used ! while (get_record("math_assignment_seeds", "assignment", $newseed->assignment, "seed", $newseed->seed)) { $newseed->seed = mt_rand (10000000,99999999); } ! if (!insert_record("math_assignment_seeds", $newseed, $returnid=false)) { error("Couldn't add $i seed $newseed->seed to database"); } Index: saveconfig.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/saveconfig.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** saveconfig.php 26 Sep 2003 11:27:40 -0000 1.4 --- saveconfig.php 11 Jan 2004 14:08:06 -0000 1.5 *************** *** 37,45 **** if ($subject->server) { $subject->course = $course; ! if (!$db->Execute("REPLACE `{$CFG->prefix}math_assignment_subject` SET `course` = '$subject->course', `name` = '$subject->name', `server` = '$subject->server', `password` = '$subject->password'")) $result = false; } else ! delete_records("math_assignment_subject", "course", $subject->course); } break; --- 37,45 ---- if ($subject->server) { $subject->course = $course; ! if (!$db->Execute("REPLACE `{$CFG->prefix}math_assignment_subjects` SET `course` = '$subject->course', `name` = '$subject->name', `server` = '$subject->server', `password` = '$subject->password'")) $result = false; } else ! delete_records("math_assignment_subjects", "course", $subject->course); } break; *************** *** 48,53 **** if ($subject->server) { $subject->course = $course; ! if (!insert_record("math_assignment_subject", $subject, false)) { ! if (!update_record("math_assignment_subject", $subject, false)) $result = false; } --- 48,53 ---- if ($subject->server) { $subject->course = $course; ! if (!insert_record("math_assignment_subjects", $subject, false)) { ! if (!update_record("math_assignment_subjects", $subject, false)) $result = false; } *************** *** 62,64 **** redirect("$CFG->wwwroot/$CFG->admin/modules.php", get_string("changessaved"), 1); ! ?> \ No newline at end of file --- 62,64 ---- redirect("$CFG->wwwroot/$CFG->admin/modules.php", get_string("changessaved"), 1); ! ?> Index: servers.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/servers.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** servers.php 23 Sep 2003 17:53:11 -0000 1.4 --- servers.php 11 Jan 2004 14:08:06 -0000 1.5 *************** *** 39,43 **** echo "<form name=\"form\" action=\"deleteserver.php\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"id\" value=\"$id\" />\n"; ! if ($server = get_record("math_assignment_server", "id", $id)) echo "<p align=\"center\">$server->name ($server->address)</p>"; if ($depends = get_server_depends($server, false)) { --- 39,43 ---- echo "<form name=\"form\" action=\"deleteserver.php\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"id\" value=\"$id\" />\n"; ! if ($server = get_record("math_assignment_servers", "id", $id)) echo "<p align=\"center\">$server->name ($server->address)</p>"; if ($depends = get_server_depends($server, false)) { *************** *** 54,58 **** echo "<p align=\"center\"><b>" . get_string("replacementserver", "math_assignment") . " :</b> "; $options = array(); ! if ($servers = get_records("math_assignment_server", "", "", "name ASC")) { foreach ($servers as $server) { if ($server->id != $id) --- 54,58 ---- echo "<p align=\"center\"><b>" . get_string("replacementserver", "math_assignment") . " :</b> "; $options = array(); ! if ($servers = get_records("math_assignment_servers", "", "", "name ASC")) { foreach ($servers as $server) { if ($server->id != $id) *************** *** 80,84 **** if (!math_assignment_check_name($name) || !math_assignment_check_name($address)) error(get_string("invalid", "math_assignment"), "servers.php"); ! if (!update_record("math_assignment_server", $server)) error(get_string("failed", "math_assignment"), "servers.php"); } --- 80,84 ---- if (!math_assignment_check_name($name) || !math_assignment_check_name($address)) error(get_string("invalid", "math_assignment"), "servers.php"); ! if (!update_record("math_assignment_servers", $server)) error(get_string("failed", "math_assignment"), "servers.php"); } *************** *** 89,93 **** if (!math_assignment_check_name($name) || !math_assignment_check_name($address)) error(get_string("invalid", "math_assignment"), "servers.php"); ! if (!insert_record("math_assignment_server", $server)) error(get_string("failed", "math_assignment"), "servers.php"); } --- 89,93 ---- if (!math_assignment_check_name($name) || !math_assignment_check_name($address)) error(get_string("invalid", "math_assignment"), "servers.php"); ! if (!insert_record("math_assignment_servers", $server)) error(get_string("failed", "math_assignment"), "servers.php"); } *************** *** 121,125 **** if (isset($id)) { ! if (!$server = get_record("math_assignment_server", "id", $id)) { $server->name = ""; $server->address = ""; --- 121,125 ---- if (isset($id)) { ! if (!$server = get_record("math_assignment_servers", "id", $id)) { $server->name = ""; $server->address = ""; *************** *** 127,131 **** } } ! else if ($servers = get_records("math_assignment_server", "", "", "name ASC")) { $table->head = array($strname, $straddress, $strpassword, $strdepends, $stredit, $strdelete); $table->width = array("*", "*", "*", "*", "*", "*"); --- 127,131 ---- } } ! else if ($servers = get_records("math_assignment_servers", "", "", "name ASC")) { $table->head = array($strname, $straddress, $strpassword, $strdepends, $stredit, $strdelete); $table->width = array("*", "*", "*", "*", "*", "*"); *************** *** 194,199 **** if ($justcount) ! return count_records("math_assignment_subject", "server", $server->id); ! return get_records_sql("SELECT s.course, c.shortname, c.fullname, s.name FROM {$CFG->prefix}math_assignment_subject s, {$CFG->prefix}course c WHERE c.id = s.course AND s.server = $server->id"); } --- 194,199 ---- if ($justcount) ! return count_records("math_assignment_subjects", "server", $server->id); ! return get_records_sql("SELECT s.course, c.shortname, c.fullname, s.name FROM {$CFG->prefix}math_assignment_subjects s, {$CFG->prefix}course c WHERE c.id = s.course AND s.server = $server->id"); } Index: setseed.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/setseed.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** setseed.php 16 Nov 2003 18:38:23 -0000 1.5 --- setseed.php 11 Jan 2004 14:08:06 -0000 1.6 *************** *** 22,30 **** } ! if (! $subject = get_record("math_assignment_subject", "course", $math_assignment->course)) { error("AiM subject is misconfigured"); } ! if (! $server = get_record("math_assignment_server", "id", $subject->server)) { error("AiM subject is misconfigured"); } --- 22,30 ---- } ! if (! $subject = get_record("math_assignment_subjects", "course", $math_assignment->course)) { error("AiM subject is misconfigured"); } ! if (! $server = get_record("math_assignment_servers", "id", $subject->server)) { error("AiM subject is misconfigured"); } *************** *** 59,82 **** $sheetid = mt_rand (10000000,99999999); // make sure seed hasn't already been used ! while (get_record("math_assignment_seed", "assignment", $assignment, "seed", $sheetid)) { $sheetid = mt_rand (10000000,99999999); } $seeddata->seed = $sheetid; ! $seeddata->student = $student; $seeddata->assignment = $assignment; ! if (!insert_record("math_assignment_seed", $seeddata, $returnid=false)) { error("Couldn't add seed $newseed->seed to database"); } } else { // check if given sheetid is valid ! if (record_exists("math_assignment_seed", "assignment", $assignment, "student", $student)) { error("You already entered an ID for this assignment. The system should not have brought you to this page."); } ! if (!$seed = get_record("math_assignment_seed", "assignment", $assignment, "seed", $sheetid)) { // The ID number does not exist notice(get_string("idinvalid", "math_assignment", $sheetid)); } // ID number is valid ! if (isset($seed->student)) { // but this ID number was already entered by a // different student --- 59,82 ---- $sheetid = mt_rand (10000000,99999999); // make sure seed hasn't already been used ! while (get_record("math_assignment_seeds", "assignment", $assignment, "seed", $sheetid)) { $sheetid = mt_rand (10000000,99999999); } $seeddata->seed = $sheetid; ! $seeddata->userid = $student; $seeddata->assignment = $assignment; ! if (!insert_record("math_assignment_seeds", $seeddata, $returnid=false)) { error("Couldn't add seed $newseed->seed to database"); } } else { // check if given sheetid is valid ! if (record_exists("math_assignment_seeds", "assignment", $assignment, "userid", $student)) { error("You already entered an ID for this assignment. The system should not have brought you to this page."); } ! if (!$seed = get_record("math_assignment_seeds", "assignment", $assignment, "seed", $sheetid)) { // The ID number does not exist notice(get_string("idinvalid", "math_assignment", $sheetid)); } // ID number is valid ! if (isset($seed->userid)) { // but this ID number was already entered by a // different student *************** *** 86,90 **** // Everything is o.k., so assign seed to student ! if (!set_field("math_assignment_seed", "student", $student, "assignment", $assignment, "seed", $sheetid)) { error("Problem writing to seed database table"); } --- 86,90 ---- // Everything is o.k., so assign seed to student ! if (!set_field("math_assignment_seeds", "userid", $student, "assignment", $assignment, "seed", $sheetid)) { error("Problem writing to seed database table"); } Index: subjectpage.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/subjectpage.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** subjectpage.php 16 Nov 2003 18:38:23 -0000 1.3 --- subjectpage.php 11 Jan 2004 14:08:06 -0000 1.4 *************** *** 14,22 **** } ! if (!$subject = get_record("math_assignment_subject", "course", $id)) { error("This page should not be shown unless a subject has been assigned to the course"); } ! if (!$server = get_record("math_assignment_server", "id", $subject->server)) { error("The server belonging to his subject is not set up correctly"); } --- 14,22 ---- } ! if (!$subject = get_record("math_assignment_subjects", "course", $id)) { error("This page should not be shown unless a subject has been assigned to the course"); } ! if (!$server = get_record("math_assignment_servers", "id", $subject->server)) { error("The server belonging to his subject is not set up correctly"); } Index: view.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/view.php,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** view.php 11 Jan 2004 13:21:22 -0000 1.25 --- view.php 11 Jan 2004 14:08:06 -0000 1.26 *************** *** 326,331 **** if ($isteacher) { $zonelink = ""; ! if ($subject = get_record("math_assignment_subject", "course", $course->id)) { ! if ($server = get_record("math_assignment_server", "id", $subject->server)) $zonelink = $server->password; } --- 326,331 ---- if ($isteacher) { $zonelink = ""; ! if ($subject = get_record("math_assignment_subjects", "course", $course->id)) { ! if ($server = get_record("math_assignment_servers", "id", $subject->server)) $zonelink = $server->password; } |
From: <gus...@us...> - 2004-01-11 13:21:25
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv3086a Modified Files: view.php Log Message: Also non-editing teachers are allowed to publish grades. Grade is printed as grade/maxgrade. Index: view.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/view.php,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** view.php 16 Nov 2003 18:38:23 -0000 1.24 --- view.php 11 Jan 2004 13:21:22 -0000 1.25 *************** *** 285,292 **** if ($hasaim) echo "$strpaper "; echo "$strgrade :</b> "; ! if ($math_assignment->papersheetsreturned) ! echo "$grade->papergrade / $math_assignment->papergrade"; ! else print_string("notmarked", "math_assignment"); echo "<br />"; } --- 285,297 ---- if ($hasaim) echo "$strpaper "; echo "$strgrade :</b> "; ! if ($math_assignment->papersheetsreturned) { ! if ($grade->aimgrade >= 0) { ! echo "$grade->papergrade / $math_assignment->papergrade"; ! } else { ! print_string("notattempted", "math_assignment"); ! } ! } else { print_string("notmarked", "math_assignment"); + } echo "<br />"; } *************** *** 420,424 **** echo "<center>The grades have not yet been finalized</center>"; } ! if (!$math_assignment->papersheetsreturned and (!empty($USER->teacheredit[$course->id]) or isadmin())) { echo "<table border=\"0\" align=\"center\"><tr><td>"; $options = array("id"=>$cm->id); --- 425,429 ---- echo "<center>The grades have not yet been finalized</center>"; } ! if (!$math_assignment->papersheetsreturned and (!empty($USER->teacher[$course->id]) or isadmin())) { echo "<table border=\"0\" align=\"center\"><tr><td>"; $options = array("id"=>$cm->id); |
From: <gus...@us...> - 2004-01-11 13:18:22
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv2606 Modified Files: updatepapergrades.php Log Message: When a grade entered by hand is larger than the maximum it is nevertheless entered into the table and only a warning is generated. After saving grades one is returned to grades table. Index: updatepapergrades.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/updatepapergrades.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** updatepapergrades.php 10 Nov 2003 12:15:30 -0000 1.4 --- updatepapergrades.php 11 Jan 2004 13:18:17 -0000 1.5 *************** *** 39,43 **** } if ($grade > $math_assignment->papergrade) { - $grade = $math_assignment->papergrade; $warning = 2; } --- 39,42 ---- *************** *** 77,80 **** $delay = 15; } ! redirect("$CFG->wwwroot/mod/math_assignment/view.php?q=$math_assignment->id", $strnotice, $delay); ?> --- 76,79 ---- $delay = 15; } ! redirect("$CFG->wwwroot/mod/math_assignment/view.php?q=$math_assignment->id&showgrades=true", $strnotice, $delay); ?> |
From: <gus...@us...> - 2004-01-11 13:15:36
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv2210 Modified Files: lib.php Log Message: now gradestable also contains the average grade in the class. When a math_assignment is deleted the corresponding grades are not deleted. Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** lib.php 16 Nov 2003 18:38:23 -0000 1.43 --- lib.php 11 Jan 2004 13:15:33 -0000 1.44 *************** *** 145,149 **** /// Given an ID of an instance of this module, /// this function will permanently delete the instance ! /// and any data that depends on it. $result = true; --- 145,151 ---- /// Given an ID of an instance of this module, /// this function will permanently delete the instance ! /// but not the grades associated with it. ! /// This should be changed and the module and its grades should be ! /// moved to separate tables instead of being deleted. $result = true; *************** *** 153,160 **** } - if (! delete_records("math_assignment_grades", "assignment", "$id")) { - $result = false; - } - return $result; } --- 155,158 ---- *************** *** 255,261 **** } // If there is only an aim quiz dont display grades until after due date ! else if ($math_assignment->papergrade <= 0 and $math_assignment->timedue > time()) { ! return false; ! } else { $return->maxgrade = $math_assignment->papergrade+ $math_assignment->aimgrade; $return->grades = math_assignment_get_grades($math_assignment, "id", "asc"); --- 253,260 ---- } // If there is only an aim quiz dont display grades until after due date ! // This actually turned out to be a nuisance so I am commenting this out ! //else if ($math_assignment->papergrade <= 0 and $math_assignment->timedue > time()) { ! // return false; ! //} else { $return->maxgrade = $math_assignment->papergrade+ $math_assignment->aimgrade; $return->grades = math_assignment_get_grades($math_assignment, "id", "asc"); *************** *** 263,267 **** array_walk($return->grades, create_function('&$val','$val = $val->totalgrade;')); return $return; ! } } --- 262,266 ---- array_walk($return->grades, create_function('&$val','$val = $val->totalgrade;')); return $return; ! //} } *************** *** 1010,1013 **** --- 1009,1013 ---- $strgrade = get_string("grade"); $stropen = get_string("open", "math_assignment"); + $straverage = get_string("average", "math_assignment"); if (! $math_assignments = get_all_instances_in_course("math_assignment", $course)) { *************** *** 1053,1067 **** if ($course->format == "weeks") { ! $table->head = array ($strweek, $strname, $strtimedue, $strproblems, $strsolutions, "$strpaper $strgrade", "$strcomputer $strgrade", "$strtotal $strgrade"); ! $table->align = array ("CENTER", "LEFT", "LEFT", "LEFT", "LEFT", "CENTER", "CENTER", "CENTER"); ! $table->width = array (10, "*", "*", "*", "*", "*", "*", "*"); } else if ($course->format == "topics") { ! $table->head = array ($strtopic, $strname, $strtimedue, $strproblems, $strsolutions, "$strpaper $strgrade", "$strcomputer $strgrade", "$strtotal $strgrade"); ! $table->align = array ("CENTER", "LEFT", "LEFT", "LEFT", "LEFT", "CENTER", "CENTER", "CENTER"); ! $table->width = array (10, "*", "*", "*", "*", "*", "*", "*"); } else { ! $table->head = array ($strname, $strtimedue, $strproblems, $strsolutions, "$strpaper $strgrade", "$strcomputer $strgrade", "$strtotal $strgrade"); ! $table->align = array ("LEFT", "LEFT", "LEFT", "LEFT", "CENTER", "CENTER", "CENTER"); ! $table->width = array ("*", "*", "*", "*", "*", "*", "*"); } } --- 1053,1067 ---- if ($course->format == "weeks") { ! $table->head = array ($strweek, $strname, $strtimedue, $strproblems, $strsolutions, "$strpaper $strgrade", "$strcomputer $strgrade", "$strtotal $strgrade", $straverage); ! $table->align = array ("CENTER", "LEFT", "LEFT", "LEFT", "LEFT", "CENTER", "CENTER", "CENTER", "CENTER"); ! $table->width = array (10, "*", "*", "*", "*", "*", "*", "*", "*"); } else if ($course->format == "topics") { ! $table->head = array ($strtopic, $strname, $strtimedue, $strproblems, $strsolutions, "$strpaper $strgrade", "$strcomputer $strgrade", "$strtotal $strgrade", $straverage); ! $table->align = array ("CENTER", "LEFT", "LEFT", "LEFT", "LEFT", "CENTER", "CENTER", "CENTER", "CENTER"); ! $table->width = array (10, "*", "*", "*", "*", "*", "*", "*", "*"); } else { ! $table->head = array ($strname, $strtimedue, $strproblems, $strsolutions, "$strpaper $strgrade", "$strcomputer $strgrade", "$strtotal $strgrade", $straverage); ! $table->align = array ("LEFT", "LEFT", "LEFT", "LEFT", "CENTER", "CENTER", "CENTER", "CENTER"); ! $table->width = array ("*", "*", "*", "*", "*", "*", "*", "*"); } } *************** *** 1117,1128 **** if ($math_assignment->papergrade > 0) { if (!$math_assignment->papersheetsreturned) { ! $papergrade = get_string("notpublished", "math_assignment"); } else if ($grade->papergrade >= 0) { ! $papergrade = "<b>$grade->papergrade / $math_assignment->papergrade</b>"; } else if ($grade->papergrade = -1) { ! $papergrade = "<b>-- / $math_assignment->papergrade</b>"; } if ($math_assignment->timedue > time()) { ! $papergrade = $stropen; } } --- 1117,1128 ---- if ($math_assignment->papergrade > 0) { if (!$math_assignment->papersheetsreturned) { ! $papergrade = get_string("notpublished", "math_assignment"); } else if ($grade->papergrade >= 0) { ! $papergrade = "<b>$grade->papergrade / $math_assignment->papergrade</b>"; } else if ($grade->papergrade = -1) { ! $papergrade = "<b>-- / $math_assignment->papergrade</b>"; } if ($math_assignment->timedue > time()) { ! $papergrade = $stropen; } } *************** *** 1132,1145 **** if ($math_assignment->aimgrade > 0) { if ($grade->aimgrade >= 0) { ! $aimgrade = "<b>$grade->aimgrade / $math_assignment->aimgrade</b>"; } else { ! $aimgrade = "<b>-- / $math_assignment->aimgrade</b>"; } // show aimgrade in grey if quiz has not closed yet if ($math_assignment->timedue > time()) { ! $aimgrade = "<span style=\"color: silver \">$aimgrade</span>"; } if ($grade->aimoverride > AIMOVR_RESET) { ! $aimgrade .= " (" . get_string("gradeoverride", "math_assignment") . ")"; } } --- 1132,1145 ---- if ($math_assignment->aimgrade > 0) { if ($grade->aimgrade >= 0) { ! $aimgrade = "<b>$grade->aimgrade / $math_assignment->aimgrade</b>"; } else { ! $aimgrade = "<b>-- / $math_assignment->aimgrade</b>"; } // show aimgrade in grey if quiz has not closed yet if ($math_assignment->timedue > time()) { ! $aimgrade = "<span style=\"color: silver \">$aimgrade</span>"; } if ($grade->aimoverride > AIMOVR_RESET) { ! $aimgrade .= " (" . get_string("gradeoverride", "math_assignment") . ")"; } } *************** *** 1151,1154 **** --- 1151,1164 ---- $maxgrade = $math_assignment->papergrade + $math_assignment->aimgrade; $totalgrade = "<b>$totalgrade / $maxgrade</b>"; + $gr = get_record_sql(" + SELECT avg(least(greatest(papergrade,0), $math_assignment->papergrade) + +least(greatest(aimgrade,0), $math_assignment->aimgrade)) + AS average + FROM {$CFG->prefix}math_assignment_grades + WHERE assignment = '$math_assignment->id' + AND (papergrade >= 0 OR aimgrade >= 0)" + ); + $average = strval(round($gr->average)) . "/$maxgrade"; + // Don't show a total grade if there is an unpublished paper grade if ($math_assignment->timedue > time() or ($math_assignment->papergrade > 0 and !$math_assignment->papersheetsreturned)) { *************** *** 1163,1174 **** if ($solurl) { if ($timenow > $math_assignment->timedue) ! $solutions = "<a href=\"$solurl\" target=\"solutions\">$strviewsolutions</a>"; else ! $solutions = ""; } else $solutions = ""; ! array_push($row, userdate($math_assignment->timedue, "", 99, false), $proburl ? "<a href=\"$proburl\" target=\"problems\">$strviewproblems</a>" : "", $solutions, $papergrade, $aimgrade, $totalgrade); $table->data[] = $row; } --- 1173,1184 ---- if ($solurl) { if ($timenow > $math_assignment->timedue) ! $solutions = "<a href=\"$solurl\" target=\"solutions\">$strviewsolutions</a>"; else ! $solutions = ""; } else $solutions = ""; ! array_push($row, userdate($math_assignment->timedue, "", 99, false), $proburl ? "<a href=\"$proburl\" target=\"problems\">$strviewproblems</a>" : "", $solutions, $papergrade, $aimgrade, $totalgrade, $average); $table->data[] = $row; } |
From: <gr...@us...> - 2004-01-09 08:19:23
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv13231 Modified Files: Matrix.mpl Log Message: Enhanced `aim/Matrix/EqnArray` so that if one gives a list of variables as an additional argument, the equations are typeset so that those variables line up in columns. Also, `aim/Matrix/Test` now gives correct entries a green background (previously, just the incorrect entries were given a red background). - GG Index: Matrix.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Matrix.mpl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Matrix.mpl 25 Aug 2003 21:47:19 -0000 1.3 --- Matrix.mpl 9 Jan 2004 08:19:20 -0000 1.4 *************** *** 19,25 **** @`aim/Matrix/EqnArray`(u = v)@ returns a string of LaTeX code for an @eqnarray*@ environment displaying the equation @u = v@. ", proc(e::({vector,list} = {vector,list})) ! local u,v,i,s; u := convert(lhs(e),list); v := convert(rhs(e),list); --- 19,34 ---- @`aim/Matrix/EqnArray`(u = v)@ returns a string of LaTeX code for an @eqnarray*@ environment displaying the equation @u = v@. + A list of variables may optionally be given as second argument, + and if included @u = v@ is treated as a system of linear equations + and is typeset so that the variables with their coefficients line + up nicely in columns. ", proc(e::({vector,list} = {vector,list})) ! local u,v,i,s,vars,c,j,leading; ! if nargs = 2 then ! vars := args[2]; ! else ! vars := []; ! fi; u := convert(lhs(e),list); v := convert(rhs(e),list); *************** *** 27,35 **** ERROR(__("Unequal dimensions in vector equation")); fi; ! s := "<latex>\\begin{eqnarray*}\n"; for i from 1 to nops(u) do ! s := s,`aim/LaTeX`(u[i])," &= ",`aim/LaTeX`(v[i])," \\\\\n"; od; ! s := cat(s,"\\end{eqnarray*}</latex>\n"); RETURN(s); end --- 36,68 ---- ERROR(__("Unequal dimensions in vector equation")); fi; ! s := "<latex>\\[\\begin{array}{", ! `if`(evalb(nops(vars) > 1), cat("rc"$(nops(vars) - 1)), ""), "rcl}\n"; for i from 1 to nops(u) do ! if vars = [] then ! s := s, `aim/LaTeX`(u[i]); ! else ! leading := true; ! for j from 1 to nops(vars) do ! c := coeff(u[i], vars[j]); ! if j > 1 then ! if is(c = 0) or leading then ! s := s, " & & "; ! else ! s := s, `if`(evalb(c < 0), " &-& ", " &+& "); ! c := abs(c); ! fi; ! fi; ! s := s, NiceCoeff(c, vars[j], "lterm"); ! if is(c <> 0) then ! leading := false; ! fi; ! od; ! if leading then ! s := s, " 0 "; ! fi; ! fi; ! s := s, " &=& ",`aim/LaTeX`(v[i])," \\\\\n"; od; ! s := cat(s,"\\end{array}\\]</latex>\n"); RETURN(s); end *************** *** 330,334 **** feedback := ! __("The entries shown in red are incorrect."),"\n<br/>\n"; if type([B],[matrix]) then --- 363,367 ---- feedback := ! __("Correct/incorrect entries are shown with green/red backgrounds, respectively."),"\n<br/>\n"; if type([B],[matrix]) then *************** *** 342,346 **** feedback := feedback,"<td bgcolor='red'>"; else ! feedback := feedback,"<td>"; fi; feedback := feedback,"<latex>$$",`aim/LaTeX`(A0[i,j]),"$$</latex>\n </td>"; --- 375,379 ---- feedback := feedback,"<td bgcolor='red'>"; else ! feedback := feedback,"<td bgcolor='LightGreen'>"; fi; feedback := feedback,"<latex>$$",`aim/LaTeX`(A0[i,j]),"$$</latex>\n </td>"; *************** *** 358,362 **** feedback := feedback,"<td bgcolor='red'>"; else ! feedback := feedback,"<td>"; fi; feedback := feedback,"<latex>$$",`aim/LaTeX`(A0[i]),"$$</latex></td></tr>\n"; --- 391,395 ---- feedback := feedback,"<td bgcolor='red'>"; else ! feedback := feedback,"<td bgcolor='LightGreen'>"; fi; feedback := feedback,"<latex>$$",`aim/LaTeX`(A0[i]),"$$</latex></td></tr>\n"; |
From: <gr...@us...> - 2004-01-09 08:09:02
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv12408 Modified Files: Util1.mpl Log Message: Added NiceSqrt, NiceCoeff, NiceCoeffs and improvements to NiceFrac. - GG Index: Util1.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Util1.mpl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Util1.mpl 25 Aug 2003 21:47:19 -0000 1.2 --- Util1.mpl 9 Jan 2004 08:09:00 -0000 1.3 *************** *** 153,156 **** --- 153,179 ---- `Package/Assign`( + NiceSqrt::string, + "Returns @x@ in a nice form with respect to square roots, + which means ``as is'' if @x@ is not a real constant or + its square is not an integer. ", + proc(x) + local sqrx, x_; + if not type([x], [realcons]) then + `aim/LaTeX`(x); + else + sqrx := x^2; + x_ := (simplify @ expand @ combine)(x); + if not type(sqrx, integer) or type(x_, integer) then + `aim/LaTeX`(x_); + elif type(x_, `^`) then + cat("\\sqrt{ }", `aim/LaTeX`(op(1, x_))); + else + cat(`aim/LaTeX`(op(1, x_)), " \\sqrt{ }", `aim/LaTeX`(op([2, 1], x_))); + fi; + fi; + end + ): + + `Package/Assign`( NiceFrac::string, "Return a nicely formatted rendition of the fraction @n@/@d@ as a *************** *** 160,174 **** <dd>if present, @n@/@d@ is treated as a term in a larger expression, i.e. if @n@/@d@ = 0 then an empty string is returned or otherwise ! the operational sign (+ or -) is prepended;</dd> <dt>@\"coef\"@ (or @\"coeff\"@)</dt> <dd>if present, @n@/@d@ is treated as the coefficient of a term, i.e. if @n@/@d@ = 1 or -1 then only an operational sign is returned (+, in the former case, or - otherwise); in any case, as with ! @\"term\"@ an operational sign is prepended;</dd> <dt>@\"lcoef\"@ (or @\"lcoeff\"@)</dt> <dd>if present, @n@/@d@ is treated as the coefficient of a leading term, i.e. if @n@/@d@ = -1 then only the operational sign - is returned, ! and if @n@/@d@ = 1 a null string is returned; in any case, an ! operational sign is prepended only if @n@/@d@ is negative;</dd> <dt>@\"nocancel\"@</dt> <dd>if present, @n@/@d@ is not cancelled to lowest terms;</dd> --- 183,201 ---- <dd>if present, @n@/@d@ is treated as a term in a larger expression, i.e. if @n@/@d@ = 0 then an empty string is returned or otherwise ! a binary operational sign (+ or -) is included;</dd> ! <dt>@\"lterm\"@</dt> ! <dd>if present, @n@/@d@ is treated as a term in a larger expression, ! i.e. if @n@/@d@ = 0 then an empty string is returned or if negative ! a unary - is included;</dd> <dt>@\"coef\"@ (or @\"coeff\"@)</dt> <dd>if present, @n@/@d@ is treated as the coefficient of a term, i.e. if @n@/@d@ = 1 or -1 then only an operational sign is returned (+, in the former case, or - otherwise); in any case, as with ! @\"term\"@ an operational sign is included;</dd> <dt>@\"lcoef\"@ (or @\"lcoeff\"@)</dt> <dd>if present, @n@/@d@ is treated as the coefficient of a leading term, i.e. if @n@/@d@ = -1 then only the operational sign - is returned, ! and if @n@/@d@ = 1 a null string is returned; in any case, a ! operational sign (unary -) is included only if @n@/@d@ is negative;</dd> <dt>@\"nocancel\"@</dt> <dd>if present, @n@/@d@ is not cancelled to lowest terms;</dd> *************** *** 180,184 **** </dl>", proc(n, d) ! local x, n_, d_, sign_, term, coef, lcoef, nocancel, textstyle; if nargs = 1 or type(args[2], string) then d_ := 1; --- 207,211 ---- </dl>", proc(n, d) ! local x, n_, d_, sign_, term, lterm, coef, lcoef, nocancel, textstyle; if nargs = 1 or type(args[2], string) then d_ := 1; *************** *** 187,190 **** --- 214,218 ---- fi; term := member("term", [args]); + lterm := member("lterm", [args]); coef := member("coef", [args]) or member("coeff", [args]); lcoef := member("lcoef", [args]) or member("lcoeff", [args]); *************** *** 202,211 **** fi; ! if not nocancel and term and x = 0 then return ""; elif not nocancel and (coef or lcoef) and x = 1 then return sign_; elif not nocancel and denom(x) = 1 then ! return cat(sign_, `aim/LaTeX`(x)); else if nocancel then --- 230,239 ---- fi; ! if not nocancel and (term or lterm) and x = 0 then return ""; elif not nocancel and (coef or lcoef) and x = 1 then return sign_; elif not nocancel and denom(x) = 1 then ! return cat(sign_, NiceSqrt(x)); else if nocancel then *************** *** 216,227 **** fi; if textstyle then ! return cat(sign_, `aim/LaTeX`(n_), "/", `if`(evalb(nops(d_) = 1), "", "("), `aim/LaTeX`(d_), `if`(evalb(nops(d_) = 1), "", ")")); else ! return cat(sign_, "\\frac{", `aim/LaTeX`(n_), "}{", `aim/LaTeX`(d_), "}"); fi; fi; end ): --- 244,339 ---- fi; if textstyle then ! return cat(sign_, NiceSqrt(n_), "/", `if`(evalb(nops(d_) = 1), "", "("), `aim/LaTeX`(d_), `if`(evalb(nops(d_) = 1), "", ")")); else ! return cat(sign_, "\\frac{", NiceSqrt(n_), "}{", `aim/LaTeX`(d_), "}"); fi; fi; + end + ): + + `Package/Assign`( + NiceCoeff::string, + "Returns a nicely formatted rendition of @c x@ as a LaTeX string, + where @c@ is rendered using #NiceFrac#. It accepts the following + optional arguments + <dl> + <dt>@\"term\"@</dt> + <dd>if present, @c@ is treated as a term in a larger expression, + i.e. if @c@ = 0 then an empty string is returned or otherwise + a binary operational sign (+ or -) is included;</dd> + <dt>@\"lterm\"@</dt> + <dd>if present, @c@ is treated as the coefficient of a leading term, + i.e. like @\"term\"@ except an operational sign only occurs + if @c@ is negative;</dd> + <dt>@\"textstyle\"@</dt> + <dd>if present, @c@ is formatted in textstyle, i.e. using / between + numerator and denominator, and a multiplication . on the line + is inserted (by default, @c@ is formatted in displaystyle, i.e. in + @\\frac{..}{..}@ form);</dd> + <dt>@\"cdot\"@</dt> + <dd>if present, a \\cdot is inserted after a non-trivial coefficient.</dd> + </dl>", + proc(c, x) + local term, lterm, textstyle, cdot, fracargs; + term := member("term", [args]); + lterm := member("lterm", [args]); + textstyle := member("textstyle", [args]); + cdot := member("cdot", [args]); + + if c = 0 then + return `if`(evalb(term or lterm), "", "0"); + fi; + + fracargs := `if`(term, "coef", NULL), `if`(lterm, "lcoef", NULL); + if not textstyle or denom(c) = 1 then + return cat(NiceFrac(c, fracargs), + `if`(evalb(cdot and abs(c) <> 1)," {\\cdot} ", " "), `aim/LaTeX`(x)); + else + return cat(NiceFrac(c, fracargs, "textstyle"), " . ", `aim/LaTeX`(x)); + fi; + end + ): + + `Package/Assign`( + NiceCoeffs::string, + "For a sequence of arguments @c1, x1, c2, x2, ...@ + returns a nicely formatted rendition of @c1 x1 + c2 x2 + ...@ + as a LaTeX string, where the @ci@ are rendered using #NiceFrac#. + It accepts the optional argument @\"textstyle\"@ and + if present, @c@ is formatted in textstyle, i.e. using / between + numerator and denominator, and a multiplication . on the line + is inserted (by default, @c@ is formatted in displaystyle, i.e. in + @\\frac{..}{..}@ form). It also accepts the optional argument @\"cdot\"@ + and inserts a \\cdot after a nontrivial coefficient if @\"textstyle\"@ + is not used. If the number of non-string arguments is odd + the last non-string argument is treated as a constant coefficient.", + proc() + local passargs, args_, nargs_, i, expr; + passargs, args_ := selectremove(x -> member(x, {"textstyle", "cdot"}), + [args]); + nargs_ := nargs - nops(passargs); + passargs := op(passargs); + i := 1; + while i <= nargs_ and args_[i] = 0 do + i := i + 2; + od; + if nargs_ < i then + return 0; + elif nargs_ = i then + return NiceFrac(args_[i], passargs); + fi; + expr := NiceCoeff(args_[i], args_[i + 1], "lterm", passargs); + i := i + 2; + while i < nargs_ do + expr := expr, " ", NiceCoeff(args_[i], args_[i + 1], "term", passargs); + i := i + 2; + od; + if nargs_ = i then + expr := expr, " ", NiceFrac(args_[i], "term", passargs); + fi; + return cat(expr); end ): |
From: <gr...@us...> - 2004-01-09 07:57:35
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv10977 Modified Files: Trig.mpl Log Message: Now deals with the unusual case where there are no solutions. - GG Index: Trig.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Trig.mpl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Trig.mpl 13 Sep 2003 18:11:25 -0000 1.3 --- Trig.mpl 9 Jan 2004 07:57:32 -0000 1.4 *************** *** 88,92 **** --- 88,105 ---- eq, interval, rightans := op(Q); + rightans := sort(rightans, evalb @ `<` @ evalf); llim, rlim := op(interval); + + if nops(ans) = 0 then + if nops(rightans) = 0 then + RETURN([1, "", __("Correct: no solutions"), [], []]); + else + RETURN([0, + __("You claimed that there were no solutions, when in fact + there are solutions. "), + __("Incorrect: gave no solutions"), + [], []]); + fi; + fi; feedback := NULL; |
From: <gr...@us...> - 2004-01-09 06:47:05
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv32762 Modified Files: TextQuestion.mpl Log Message: For answers of type string, AIM now states that: No validation is possible with this question. Your answer exactly as you typed it is: Also some [] were added in arguments to the type function, e.g. type(rawans,reqtype) became type([rawans],[reqtype]). This is to prevent AIM running into problems when the student (incorrectly) enters a sequence. - GG Index: TextQuestion.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/TextQuestion.mpl,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TextQuestion.mpl 22 Oct 2003 02:30:36 -0000 1.10 --- TextQuestion.mpl 9 Jan 2004 06:47:00 -0000 1.11 *************** *** 369,378 **** else if attempt['Answer'] <> NULL then ! # KM if type([attempt['Answer']],[string]) then html := cat( ! __("Your last answer was: \n"), "<br/><pre>", attempt['Answer'], --- 369,379 ---- else if attempt['Answer'] <> NULL then ! # KM & GG if type([attempt['Answer']],[string]) then html := cat( ! __("No validation is possible with this question. \n"), ! __("Your last answer, exactly as you typed it, was: \n"), "<br/><pre>", attempt['Answer'], *************** *** 478,482 **** # check that the string matches the required type in the case # where the user has specified a subtype of type string ! if (not(type(rawans,reqtype))) then attempt['ValidationNote'] := __("wrong type"); attempt['ValidationMessage'] := --- 479,483 ---- # check that the string matches the required type in the case # where the user has specified a subtype of type string ! if (not(type([rawans],[reqtype]))) then attempt['ValidationNote'] := __("wrong type"); attempt['ValidationMessage'] := *************** *** 676,680 **** # Check if the answer has the right type. ! if (not(type(ans,reqtype))) then attempt['ValidationNote'] := __("wrong type"); attempt['ValidationMessage'] := --- 677,681 ---- # Check if the answer has the right type. ! if (not(type([ans],[reqtype]))) then attempt['ValidationNote'] := __("wrong type"); attempt['ValidationMessage'] := |
From: <gr...@us...> - 2004-01-09 06:12:40
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv28906 Modified Files: Zone.mpl Log Message: When there are >9 subjects, the index.html and admin.html pages now set the subjects in columns of at most 9 subjects in a column. - GG Index: Zone.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Zone.mpl,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Zone.mpl 26 Aug 2003 21:31:48 -0000 1.5 --- Zone.mpl 9 Jan 2004 06:12:37 -0000 1.6 *************** *** 165,169 **** # optional subjname_::string) ! local subjname,subjects,subjecttable,subj,c; subjects := this['Subjects']; --- 165,169 ---- # optional subjname_::string) ! local subjname,subjects,subjecttable,subj,c,i,row,nrows,ncols,subjectrows; subjects := this['Subjects']; *************** *** 181,184 **** --- 181,193 ---- subjecttable := `new/HTML/Table`([]); + #The number 9 in the next line is the maximum number of + #subjects in a column ... it can be changed to any reasonable + #integer >= 1. It should probably be a global constant set in + #Config.mpl + ncols := ceil(nops(subjects)/9); + nrows := ceil(nops(subjects)/ncols); + subjectrows := Array(0..nrows - 1, i -> "tr"); + row := 0; + for subj in subjects do if subj['Name'] = subjname then *************** *** 188,197 **** fi; ! subjecttable['AddContents', ! ["tr", ["td", [["inputradio","name" = "SubjectName","value" = subj['Name'],c]]], ["td", ! subj['Title']]]]; od; --- 197,210 ---- fi; ! subjectrows[row] := subjectrows[row], ["td", [["inputradio","name" = "SubjectName","value" = subj['Name'],c]]], ["td", ! subj['Title']]; ! row := (row + 1) mod nrows; ! od; ! ! for row from 0 to nrows - 1 do ! subjecttable['AddContents',[subjectrows[row]]]; od; |
From: <gr...@us...> - 2004-01-09 05:13:33
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv21663 Modified Files: Functions.mpl Log Message: Added some enhancements. There is now `aim/Functions/ID/HasAsymptote` and a facility for including one's own properties for a function in `aim/Functions/ID/CheckList`. - GG Index: Functions.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Functions.mpl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Functions.mpl 25 Aug 2003 21:47:19 -0000 1.3 --- Functions.mpl 9 Jan 2004 05:13:30 -0000 1.4 *************** *** 172,175 **** --- 172,196 ---- `Package/Assign`( + `aim/Functions/ID/HasAsymptote`, + "If @f@ has an asymptote at @x = a@ but @g@ does not (or <em>vice-versa</em>) + then return an explanatory message; otherwise return the empty string. + ", + proc(f,g,a) + `aim/Functions/ID/Check`(f,g, + proc(h,a) + type(limit(h, x = a, left), infinity) or + type(limit(h, x = a, right), infinity) + end, + proc(A,B,a) + sprintf( + "The function $%s$ has an asymptote at + $x = %s$, but the function $%s$ does not.", + A,`aim/LaTeX`(a),B); + end, + a) + end + ): + + `Package/Assign`( `aim/Functions/ID/Positive`, "If @f@ is positive at @x = a@ but @g@ is not (or <em>vice-versa</em>) *************** *** 366,370 **** other arguments). The argument @msg@ accepts two string parameters @A@ and @B@ (assumed to be descriptions of functions), and returns ! a string explaining that @A@ has the required property aand @B@ does not (always that way around). If the @chk@ function uses extra arguments, then the @msg@ function should accept them as well. --- 387,391 ---- other arguments). The argument @msg@ accepts two string parameters @A@ and @B@ (assumed to be descriptions of functions), and returns ! a string explaining that @A@ has the required property and @B@ does not (always that way around). If the @chk@ function uses extra arguments, then the @msg@ function should accept them as well. *************** *** 406,423 **** procedure will first check whether @f@ and @g@ take the value @2@ at @x = 1@, then whether @f@ and @g@ are continuous at @x = 0@, then ! whether @f@ and @g@ are bounded above on <b>R</b>. The procedure ! returns a string explaining the first discrepancy that it encounters ! between @f@ and @g@, or the empty string if it finds no discrepancy. ", proc(f,g,chklist) ! local c,p,m; ! for c in chklist do ! p := eval(cat(`aim/Functions/ID/`,c[1])); ! m := p(f,g,op(c[2..-1])); ! if m <> "" then RETURN(m); fi; od; ! RETURN(""); end ): --- 427,474 ---- procedure will first check whether @f@ and @g@ take the value @2@ at @x = 1@, then whether @f@ and @g@ are continuous at @x = 0@, then ! whether @f@ and @g@ are bounded above on <b>R</b>. If the optional ! 4th argument @mkvector@ is included, it should be a list of partial ! marks, one for each test in @chklist@, that should sum to 1. ! The procedure returns a string explaining the first discrepancy that ! it encounters between @f@ and @g@, or the empty string if it finds ! no discrepancy. If the procedure is called with the optional argument ! @mkvector@, then a mark which is the sum of the values assigned to ! each test passed is also returned. To take account of one-off special ! properties that a function may be required to have, @chklist@ may also ! contain an entry @['My',chk,msg]@ where @chk@ and @msg@ are functions ! conforming to the criteria of #`aim/Functions/ID/Check`#, i.e. @chk@ ! takes a function as argument and returns a boolean, and @msg@ takes two ! arguments (strings that represent @f@ and @g@) and returns a string ! explaining a discrepancy between @f@ and @g@ (in relation to @chk@). ", proc(f,g,chklist) ! local c,p,m,msg,mk,i,mkvector; ! msg := ""; ! mk := NULL; ! ! if nargs > 3 then ! mkvector := args[4]; ! mk := 0; ! fi; ! ! for i to nops(chklist) do ! c := chklist[i]; ! if c[1] = 'My' then ! m := (rcurry(`aim/Functions/ID/Check`, c[2], c[3]))(f, g); ! else ! p := eval(cat(`aim/Functions/ID/`,c[1])); ! m := p(f,g,op(c[2..-1])); ! fi; ! if m <> "" and nargs = 3 then ! return m; ! elif m = "" then ! mk := mk + mkvector[i]; ! elif msg = "" then ! msg := m; ! fi; od; ! return msg, mk; end ): |
From: <mo...@us...> - 2003-12-20 21:43:00
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple In directory sc8-pr-cvs1:/tmp/cvs-serv24342 Modified Files: Random.mpl Log Message: A bug fix in `Nice/Trinomial`() Index: Random.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/Random.mpl,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Random.mpl 15 Oct 2003 15:37:22 -0000 1.12 --- Random.mpl 20 Dec 2003 21:42:57 -0000 1.13 *************** *** 466,485 **** `Package/Assign`( `Nice/Binomial`::InertExpr, ! "Produces a \"nice\" binomial from its arguments (which is more complicated than it sounds). If one looks through the problems assigned in a typical calculus or precalc book, one will notice that there are certain rules that authors tend to follow when designing \"nice\" questions. This procedure attempts to produce a \"nice\" random binomial in @x@ that is a sum of a monomial in @x@ and a constant term in a random order. The defaults for the degree of the monomial and the two coefficients can be overriden by supplying the appropriate arguments. The argument @x@ is mandatory and can be any algebraic expression or Inert Expression.", ! proc(_x,deg,arange,brange) ! local n,a,b,nr,ar,br,i,x; - x:=Rand(_x); # defaults ! nr:=[1,[1..3]]; ar:=[-3..-1,1..3]; br:=[-3..-1,1..3]; # overriden ! if nargs>1 then nr:=deg fi; if nargs>2 then ar:=arange fi; if nargs>3 then br:=brange fi; ! ! n:=Rand(nr); # don't let them both be negative --- 466,488 ---- `Package/Assign`( `Nice/Binomial`::InertExpr, ! "Produces a \"nice\" binomial from its arguments (which is more complicated than it sounds). If one looks through the problems assigned in a typical calculus or precalc book, one will notice that there are certain rules that authors tend to follow when designing \"nice\" questions. This procedure attempts to produce a \"nice\" random binomial of the form @a*x^n+b*y^m@ where @a:=Rand(arange)@, @b:=Rand(brange)@, @x:=Rand(_x)@, @y:=Rand(_y)@, @n:=Rand(deg)@, and @m:=Rand(ydeg)@. Only the argument @x@ is mandatory. Both @x@ and @y@ can be any any algebraic expression or Inert Expression.", ! proc(_x,deg,arange,brange,_y,ydeg) ! local n,a,b,ar,br,i,x,y,m; # defaults ! # x:=x; ! n:=Rand([1,[1..3]]); ar:=[-3..-1,1..3]; br:=[-3..-1,1..3]; + y:=1; + m:=1; # overriden ! if nargs>0 then x:=Rand(_x) fi; ! if nargs>1 then n:=Rand(deg) fi; if nargs>2 then ar:=arange fi; if nargs>3 then br:=brange fi; ! if nargs>4 then y:=Rand(_y) fi; ! if nargs>5 then m:=Rand(ydeg) fi; # don't let them both be negative *************** *** 498,502 **** if type(b,algebraic) then b:=abs(b): break ! elif type(b,algebraic) then a:=abs(a): break fi --- 501,505 ---- if type(b,algebraic) then b:=abs(b): break ! elif type(a,algebraic) then a:=abs(a): break fi *************** *** 507,518 **** od: ! # if its degree 1 you can use both coefficients ! if n=1 then if `aim/StartsNegative`(a) then ! return Plus(b,Times(a,x)); elif `aim/StartsNegative`(b) then ! return Plus(Times(a,x),b); else ! return Plus(Rand(Permute(Times(a,x),b))); fi; # otherwise we only use one coefficient unless its overriden --- 510,521 ---- od: ! # if both are degree 1 you can use both coefficients ! if n=1 and m=1 then if `aim/StartsNegative`(a) then ! return Plus(Times(b,y),Times(a,x)); elif `aim/StartsNegative`(b) then ! return Plus(Times(a,x),Times(b,y)); else ! return Plus(Rand(Permute(Times(a,x),Times(b,y)))); fi; # otherwise we only use one coefficient unless its overriden *************** *** 522,526 **** # overridden... use b if nargs>3 then ! return Plus(b,Times(a,ToThe(x,n))); # default.. don't use b else --- 525,529 ---- # overridden... use b if nargs>3 then ! return Plus(Times(b,ToThe(y,m)),Times(a,ToThe(x,n))); # default.. don't use b else *************** *** 531,535 **** # overridden... use both if nargs>3 then ! return Plus(Times(a,ToThe(x,n)),b); # only a was overidden, so ignore b elif nargs=3 then --- 534,538 ---- # overridden... use both if nargs>3 then ! return Plus(Times(a,ToThe(x,n)),Times(b,ToThe(y,m))); # only a was overidden, so ignore b elif nargs=3 then *************** *** 543,547 **** # b overridden... use both if nargs>3 then ! return Plus(Rand(Permute(b,Times(a,ToThe(x,n))))); # only a was overidden, so ignore b elif nargs=3 then --- 546,550 ---- # b overridden... use both if nargs>3 then ! return Plus(Rand(Permute(Times(b,ToThe(y,m)),Times(a,ToThe(x,n))))); # only a was overidden, so ignore b elif nargs=3 then *************** *** 549,553 **** # default...use just one in either order else ! return Rand(Plus(Rand(Permute(b,ToThe(x,n)))),Plus(1,Times(a,ToThe(x,n)))); fi fi; --- 552,558 ---- # default...use just one in either order else ! return Rand(Fn(Plus,Permute(b,ToThe(x,n))), ! Plus(1,Times(a,ToThe(x,n))) ! ); fi fi; *************** *** 559,579 **** `Nice/Trinomial`::InertExpr, "Produces a \"nice\" trinomial in @x@. See #Nice/Binomial# for more info.", ! proc(_x,deg,arange,brange,crange) ! local n,m,a,b,c,nr,ar,br,cr,i,typ,x; ! ! x:=Rand(_x); # defaults ! nr:=[1..3]; ar:=[-3..-1,1..3]; br:=[-3..-1,1..3]; cr:=[-3..-1,1..3]; # overriden ! if nargs>1 then nr:=deg fi; if nargs>2 then ar:=arange fi; if nargs>3 then br:=brange fi; if nargs>4 then cr:=crange fi; - m,n:=op(sort(Rand(List([nr],2)))); b:=Rand(br); # don't let both a and c be negative --- 564,591 ---- `Nice/Trinomial`::InertExpr, "Produces a \"nice\" trinomial in @x@. See #Nice/Binomial# for more info.", ! proc(_x,deg,arange,brange,crange,_y,ydeg,_z,zdeg) ! local m,n,p,a,b,c,nr,ar,br,cr,i,typ,x,y,z,xp,yp,zp; # defaults ! # x:=x; ! m:=Rand(1..3); ar:=[-3..-1,1..3]; br:=[-3..-1,1..3]; cr:=[-3..-1,1..3]; + y:=x; + n:=Rand(1..3); + z:=1; + p:=1; # overriden ! if nargs>0 then x:=Rand(_x) fi; ! if nargs>1 then m:=Rand(deg) fi; if nargs>2 then ar:=arange fi; if nargs>3 then br:=brange fi; if nargs>4 then cr:=crange fi; + if nargs>5 then y:=Rand(_y) fi; + if nargs>6 then n:=Rand(ydeg) fi; + if nargs>7 then z:=Rand(_z) fi; + if nargs>8 then p:=Rand(zdeg) fi; b:=Rand(br); # don't let both a and c be negative *************** *** 603,625 **** # three types possible if `aim/StartsNegative`(a) then ! typ=1 elif `aim/StartsNegative`(c) then ! typ=Rand(2,3) else typ:=Rand(1..3) fi; if typ=1 then if nargs<=3 then b:=Rand(-1,1) fi; if nargs<=2 then a:=Rand(-1,1) fi; ! return Plus(c,Times(b,ToThe(x,m)),Times(a,ToThe(x,n))) elif typ=2 then if nargs<=2 then a:=1 fi: if nargs<=4 then c:=Rand(-1,1) fi: ! return Plus(Times(a,ToThe(x,n)),Times(b,ToThe(x,m)),c) else if nargs<=2 then a:=1 fi: if nargs<=3 then b:=Rand(-1,1) fi: ! return Plus(Times(a,ToThe(x,n)),Times(b,ToThe(x,m)),c) fi: end --- 615,641 ---- # three types possible if `aim/StartsNegative`(a) then ! typ:=1 elif `aim/StartsNegative`(c) then ! typ:=Rand(2,3) else typ:=Rand(1..3) fi; + xp:=`if`(m=1,x,ToThe(x,m)); + yp:=`if`(n=1,y,ToThe(y,n)); + zp:=`if`(p=1,z,ToThe(z,p)); + if typ=1 then if nargs<=3 then b:=Rand(-1,1) fi; if nargs<=2 then a:=Rand(-1,1) fi; ! return Plus(Times(c,zp),Times(b,yp),Times(a,xp)) elif typ=2 then if nargs<=2 then a:=1 fi: if nargs<=4 then c:=Rand(-1,1) fi: ! return Plus(Times(a,xp),Times(b,yp),Times(c,zp)) else if nargs<=2 then a:=1 fi: if nargs<=3 then b:=Rand(-1,1) fi: ! return Plus(Times(a,xp),Times(b,yp),Times(c,zp)) fi: end |
From: <mo...@us...> - 2003-12-20 21:42:27
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv24291 Modified Files: Inert.mpl Log Message: Added `Inert/PartialDiffPrime` (for partial derivatives). Index: Inert.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Inert.mpl,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Inert.mpl 23 Oct 2003 02:31:31 -0000 1.9 --- Inert.mpl 20 Dec 2003 21:42:22 -0000 1.10 *************** *** 872,876 **** elif Value(b)=0 then "1" ! elif type(a,negative) or type(a,float) then PercentStringToProc("\\left({%1}\\right)^{%2}")(a,b); else --- 872,876 ---- elif Value(b)=0 then "1" ! elif type(a,negative) or type(a,float) or type(a,fraction) then PercentStringToProc("\\left({%1}\\right)^{%2}")(a,b); else *************** *** 1267,1270 **** --- 1267,1308 ---- "", proc() Apply(`Inert/DiffPrime`,args) end + ): + ################################################################### + `Package/Assign`( + `Inert/PartialDiffPrime`::Inert, + "The Inert partial derivative of a function in prime/subscript notation.", + `new/Inert`( proc() # Map + diff(args[1],args[2..nargs]); + end, + proc(f,x) # TeX + local s,n,a: + n:=nargs-1; + s:=cat(seq(TeX(args[i]),i=2..nargs)); + if type(f,symbol) then + a:=PercentStringToProc("{%1}_{%2}")(f,s); + if n=1 then a:=cat("{",a,"}'") fi: + else + a:=PercentStringToProc("\\left(%1\\,\\right)_{%2}")(f,s); + if n=1 then a:=cat(a,"^'") fi: + fi; + a; + end, + -1, # Nargs + proc() # Domain + evalb(nargs>=2 and + type(args[1],algebraic) and + type(args[2],symbol)) + end, + "PartialDerivative", # Name + false, # Needs parentheses + true, # Provides parentheses + false, # Associative + 0) # Precedence + ): + + `Package/Assign`( + PartialDiffPrime::procedure, + "", + proc() Apply(`Inert/PartialDiffPrime`,args) end ): |
From: <mo...@us...> - 2003-12-20 21:38:56
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv23771 Modified Files: Compile.mpl Log Message: Modified the code for multiquestions so that question parameters defined in the question's header with the <string> flag propagate into the subquestions. Index: Compile.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Compile.mpl,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Compile.mpl 4 Oct 2003 01:21:17 -0000 1.8 --- Compile.mpl 20 Dec 2003 21:38:53 -0000 1.9 *************** *** 179,188 **** nam_::string, level_::integer, ! partlabel_::string ) # KM # DIST global MPROC_,IPROC,IPROCSTRING; global MPROC_,IPROC,IPROCSTRING,Config; ! # END local question,line,flag,text,solstarted,solended, qtype,value,keywords,aimlocals,ansvar, --- 179,191 ---- nam_::string, level_::integer, ! partlabel_::string, ! # KM ! params_::table ! # END KM ) # KM # DIST global MPROC_,IPROC,IPROCSTRING; global MPROC_,IPROC,IPROCSTRING,Config; ! # END KM local question,line,flag,text,solstarted,solended, qtype,value,keywords,aimlocals,ansvar, *************** *** 242,245 **** --- 245,251 ---- if nargs > 2 then level := level_; fi; if nargs > 3 then partlabel := partlabel_; fi; + # KM + if nargs > 4 then params := params_; fi; + # END KM # Check to see if this is a multipart question; if so, hand *************** *** 829,833 **** nam_::string, level_::integer, ! partlabel_::string ) # KM --- 835,842 ---- nam_::string, level_::integer, ! partlabel_::string, ! # KM ! params_::table ! # END KM ) # KM *************** *** 868,871 **** --- 877,883 ---- if nargs > 2 then level := level_; fi; if nargs > 3 then partlabel := partlabel_; fi; + # KM + if nargs > 4 then params := params_; fi; + # END KM flagnum := 0; *************** *** 994,998 **** nam, level + 1, ! sprintf("%s.%d",partlabel,partnum) ); if type([subquestion],[`aim/Question`]) then --- 1006,1013 ---- nam, level + 1, ! sprintf("%s.%d",partlabel,partnum), ! # KM ! params ! # END KM ); if type([subquestion],[`aim/Question`]) then |
From: <mo...@us...> - 2003-11-30 21:33:52
|
Update of /cvsroot/aimmath/AIM/doc In directory sc8-pr-cvs1:/tmp/cvs-serv3848 Modified Files: docmenu.html Log Message: Made it more compact so it fits on one screen without scrolling the frame. Index: docmenu.html =================================================================== RCS file: /cvsroot/aimmath/AIM/doc/docmenu.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** docmenu.html 27 Sep 2003 21:21:23 -0000 1.2 --- docmenu.html 30 Nov 2003 21:33:49 -0000 1.3 *************** *** 6,47 **** </head> <body bgcolor="#C5EFFF"> ! <font size="4" face="san-serif"> Installation: ! </font><font size="2" face="san-serif"> ! <ul> ! <li><a href='install.html' target="main">Installation instructions</a></li> ! <li><a href="WhatsNewInV3.txt" target="main">What is new in version 3.0</a></li> ! </ul> ! <font size="4" face="san-serif"> ! For teachers: ! </font><font size="2" face="san-serif"> ! <ul> ! <li><a href='concepts.html' target="main">Some useful concepts</a></li> ! <li><a href='teacher.html' target="main">Instructions for teachers<br>and administrators</a></li> ! <li><a href='format.html' target="main">AIM Question Syntax</a></li> ! <li><a href='AuthoringPackages.html' target="main">Question Authoring Packages</a></li> ! <li><a href='AuthoringTtH.html' target="main">Authoring tools tutorial</a></li> ! <li><a href='tasks.html' target="main">Tasks for the lecturer</a></li> ! </ul> ! <font size=4 face="san-serif"> For students: ! </font><font size=2 face="san-serif"> ! <ul> ! <li><a href='help.html' target="main">Help for students</a></li> ! </ul> <font size=4 face="san-serif"> ! For administrators<br /> and developers: ! </font><font size=2 face="san-serif"> ! <ul> ! <li><a href='teacher.html' target="main">Instructions for teachers<br>and administrators</a></li> ! <li><a href='files.html' target="main">Files and directories</a></li> ! <li><a href='components.html' target="main">Components of the system</a></li> ! <li><a href='packing.html' target="main">AIM Maple package system</a></li> ! <li><a href='packages.html' target="main">Package list</a></li> ! <li><a href='entries.html' target="main">Index of all package documentation</a></li> ! <li><a href='admindoc.html' target="main">AiM admin pages and actions</a></li> ! <li><a href='todo.html' target="main">Things to do</a></li> ! </ul> </font> </body> </html> --- 6,128 ---- </head> <body bgcolor="#C5EFFF"> ! <table border="0" cellpadding="0" cellspacing="0"> ! <tr> ! <td colspan="2"><font size="4" face="san-serif"> Installation: ! </font></td> ! </tr> ! <tr> ! <td width="10"></td> ! <td><b>-</b> <font size="2" face="san-serif"> <a href='install.html' target="main">Installation instructions</a></font></td> ! </tr> ! <tr> ! <td width="10"></td> ! <td><b>-</b> <font size="2" face="san-serif"><a href="WhatsNewInV3.txt" target="main">What is new in version 3.0</a></font></td> ! </tr> ! <tr> ! <td colspan="2"> ! <font size="2" face="san-serif"> ! <font size="4" face="san-serif"> ! For teachers: ! </font></font></td> ! </tr> ! <tr> ! <td width="10"></td> ! <td><b>-</b> <font size="2" face="san-serif"><a href='concepts.html' target="main">Some useful concepts</a></font></td> ! </tr> ! <tr> ! <td width="10"></td> ! <td><b>-</b> <font size="2" face="san-serif"><a href='teacher.html' target="main">Instructions for teachers</a><br> ! ! <a href='teacher.html' target="main">and administrators</a> ! </font></td> ! </tr> ! <tr> ! <td width="10"></td> ! <td><b>-</b> <font size="2" face="san-serif"><a href='format.html' target="main">AIM Question Syntax</a></font></td> ! </tr> ! <tr> ! <td width="10"></td> ! <td><b>-</b> <font size="2" face="san-serif"><a href='AuthoringPackages.html' target="main">Question Authoring Packages</a></font></td> ! </tr> ! <tr> ! <td width="10"></td> ! <td><b>-</b> <font size="2" face="san-serif"><a href='AuthoringTtH.html' target="main">Authoring tools tutorial</a></font></td> ! </tr> ! <tr> ! <td width="10"></td> ! <td><b>-</b> <font size="2" face="san-serif"><a href='tasks.html' target="main">Tasks for the lecturer</a></font></td> ! </tr> ! <tr> ! <td colspan="2"><font size=4 face="san-serif"> For students: ! </font></td> ! </tr> ! <tr> ! <td width="10"></td> ! <td><b>-</b> <font size=2 face="san-serif"><a href='help.html' target="main">Help for students</a></font></td> ! </tr> ! <tr> ! <td colspan="2"> ! <font size="2" face="san-serif"> <font size=4 face="san-serif"> ! For administrators<br> ! and developers: ! </font></font></td> ! </tr> ! <tr> ! <td width="10"></td> ! <td><b>-</b> <font size=2 face="san-serif"> ! <a href='teacher.html' target="main">Instructions for teachers</a><br> ! ! <a href='teacher.html' target="main">and administrators</a> ! </font> ! </td> ! </tr> ! <tr> ! <td width="10"></td> ! <td><b>-</b> <font size=2 face="san-serif"><a href='files.html' target="main">Files and directories</a> ! </font> ! </td> ! </tr> ! <tr> ! <td width="10"></td> ! <td><b>-</b> <font size=2 face="san-serif"><a href='components.html' target="main">Components of the system</a> ! </font> ! </td> ! </tr> ! <tr> ! <td width="10"></td> ! <td><b>-</b> <font size=2 face="san-serif"><a href='packing.html' target="main">AIM Maple package system</a> </font> + </td> + </tr> + <tr> + <td width="10"></td> + <td><b>-</b> <font size=2 face="san-serif"><a href='packages.html' target="main">Package list</a> + </font> + </td> + </tr> + <tr> + <td width="10"></td> + <td><b>-</b> <font size=2 face="san-serif"><a href='entries.html' target="main">Index of all package<br> + </a> + <a href="entries.html">documentation</a> + </font> + </td> + </tr> + <tr> + <td width="10"></td> + <td><b>-</b> <font size=2 face="san-serif"><a href='admindoc.html' target="main">AiM admin pages and actions</a> + </font> + </td> + </tr> + <tr> + <td width="10"></td> + <td><b>-</b> <font size=2 face="san-serif"><a href='todo.html' target="main">Things to do</a> + </font> + </td> + </tr> + </table> </body> </html> |
From: <gus...@us...> - 2003-11-16 18:40:19
|
Update of /cvsroot/aimmath/moodle/lang/en In directory sc8-pr-cvs1:/tmp/cvs-serv8098/lang/en Modified Files: math_assignment.php Log Message: Index: math_assignment.php =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/math_assignment.php,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** math_assignment.php 10 Nov 2003 12:16:02 -0000 1.24 --- math_assignment.php 16 Nov 2003 18:39:35 -0000 1.25 *************** *** 9,13 **** $string['addnewserver'] = "Add New Server"; $string['address'] = "Address"; ! $string['adminlinks'] = "Admin Links"; $string['adminonly'] = "You must be an administrator to use this page."; $string['aimdisplay'] = "Display AiM Details For"; --- 9,13 ---- $string['addnewserver'] = "Add New Server"; $string['address'] = "Address"; ! $string['adminlinks'] = "AiM administration links"; $string['adminonly'] = "You must be an administrator to use this page."; $string['aimdisplay'] = "Display AiM Details For"; *************** *** 26,29 **** --- 26,30 ---- $string['comment'] = "Comment"; $string['commented'] = "Commented"; + $string['commentrequired'] = "You have to fill in the Comment field when you override the AiM grade."; $string['coursesettings'] = "Course Settings"; $string['defaultemailhost'] = "Default Email Host"; *************** *** 55,59 **** $string['grademultiplier'] = "Grade Multiplier"; $string['gradeoverride'] = "set by teacher"; ! $string['gradeoverridemsg'] = "Since the teacher has modified your grades, attempting the assignment will not change them. However you can still view the AiM assignment page for reference."; $string['guestsno'] = "Sorry, guests can not view or attempt assignments"; $string['hidegradestable'] = "Hide grades table"; --- 56,60 ---- $string['grademultiplier'] = "Grade Multiplier"; $string['gradeoverride'] = "set by teacher"; ! $string['gradeoverridemsg'] = "Since the teacher has modified your grades, entering further answers to the assignment will not change the grade. However you can still view the AiM assignment page for reference."; $string['guestsno'] = "Sorry, guests can not view or attempt assignments"; $string['hidegradestable'] = "Hide grades table"; *************** *** 104,107 **** --- 105,111 ---- $string['reviewresults'] = "Review Results"; $string['secretaryemail'] = "Secretary Email Address"; + $string['seed'] = "Problem sheet ID"; + $string['seedreset'] = "Reset ID"; + $string['seedwarning'] = "Are you quite sure that you want to be assigned a new random problem sheet? If you already received a problem sheet then you should click on No because otherwise you will not be able to use any results you already obtained for the versions of the problems on that sheet."; $string['serverinuse'] = "Error : Can not delete server as one or more assignments depend on it."; $string['singlequestion'] = "single question"; *************** *** 113,123 **** $string['studentnotattempted'] = "The student has not attempted this assignment."; $string['timedue'] = "Due Date and Time"; ! $string['tryquiz'] = "Try AiM Assignment"; $string['uploadnew'] = "upload new file"; $string['useuploaded'] = "Choose uploaded file"; $string['view'] = "View"; ! $string['viewproblems'] = "View Problems"; ! $string['viewquiz'] = "View AiM Assignment"; ! $string['viewsolutions'] = "View Solutions"; $string['zoneadmin'] = "AiM Zone Administration"; $string['zonepassword'] = "Zone Admin Password"; --- 117,127 ---- $string['studentnotattempted'] = "The student has not attempted this assignment."; $string['timedue'] = "Due Date and Time"; ! $string['tryquiz'] = "Teacher's view of AiM Assignment"; $string['uploadnew'] = "upload new file"; $string['useuploaded'] = "Choose uploaded file"; $string['view'] = "View"; ! $string['viewproblems'] = "Show typeset problem sheet"; ! $string['viewquiz'] = "Complete AiM Assignment"; ! $string['viewsolutions'] = "Show typeset solution sheet"; $string['zoneadmin'] = "AiM Zone Administration"; $string['zonepassword'] = "Zone Admin Password"; |
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv7888/mod/math_assignment Modified Files: aimpage.php editgrade.php index.php lib.php pdfgen.php setseed.php subjectpage.php view.php Added Files: seed.html Log Message: --- NEW FILE: seed.html --- <?php echo "<form action=\"setseed.php\" method=\"GET\">\n"; echo get_string("enterid", "math_assignment"); echo "<input type=\"text\" name=\"sheetid\" size=\"8\" maxlength=\"8\" />\n"; echo "<input type=\"hidden\" name=\"assignment\" value=\"$math_assignment->id\" />\n"; echo "<input type=\"submit\" value=\"Submit\"><br />"; echo "</form>"; echo "<form action=\"setseed.php\" method=\"GET\">\n"; echo get_string("generateid", "math_assignment"); echo "<input type=\"hidden\" name=\"sheetid\" value=\"-1\" />\n"; echo "<input type=\"hidden\" name=\"assignment\" value=\"$math_assignment->id\" />\n"; echo "<input type=\"submit\" value=\"Generate new problems\"><br />"; echo "</form>"; ?> Index: aimpage.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/aimpage.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** aimpage.php 2 Nov 2003 15:45:30 -0000 1.18 --- aimpage.php 16 Nov 2003 18:38:23 -0000 1.19 *************** *** 85,89 **** $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); - $postdata = math_assignment_add_arg_to_url_data($postdata, "KeepQuestionOrder", "true"); } else if ($isteacher and strcasecmp($aimaction, "source") == 0) { // load the edit source page --- 85,88 ---- *************** *** 95,99 **** else if ($isteacher and strcasecmp($aimaction, "subject") == 0) { // load the edit subject page $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","admin/Subject"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "ShowHiddenQuizzes"); $postdata = math_assignment_add_arg_to_url_data($postdata, "ShowHiddenQuizzes", "true"); $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); --- 94,98 ---- else if ($isteacher and strcasecmp($aimaction, "subject") == 0) { // load the edit subject page $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","admin/Subject"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "LoadSubjectOptions"); $postdata = math_assignment_add_arg_to_url_data($postdata, "ShowHiddenQuizzes", "true"); $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); *************** *** 106,110 **** else if ($isteacher and strcasecmp($aimaction, "analyse") == 0) { // load the analyse quiz page $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","analyze/Quiz"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "AnalyzeQuiz"); $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); --- 105,109 ---- else if ($isteacher and strcasecmp($aimaction, "analyse") == 0) { // load the analyse quiz page $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","analyze/Quiz"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "ReanalyzeQuiz"); $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); *************** *** 310,314 **** if (isteacher($course->id)) { if ($adminlinks = math_assignment_get_admin_links($cm, $math_assignment, $server->password, "center")) { - print_heading(get_string("administration")); echo $adminlinks; } --- 309,312 ---- Index: editgrade.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/editgrade.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** editgrade.php 10 Nov 2003 12:15:29 -0000 1.3 --- editgrade.php 16 Nov 2003 18:38:23 -0000 1.4 *************** *** 53,57 **** unset($err); if (isset($grade) && isset($comment)) { - $comment= stripslashes($comment); $grade = trim($grade); if ($grade == "-") { // reset override (clear grade) --- 53,56 ---- *************** *** 70,83 **** $gradeobj->aimgrade = $grade; } ! else $err = 2; // invalid entry if (!isset($err)) { $err = math_assignment_update_grades($gradeobj) ? 0 : 1; ! if (!$err) ! redirect("view.php?id=$cm->id", get_string("changessaved") . "\n" . get_string("delaymessage", "math_assignment", format_time($CFG->maxeditingtime)), 2); } } ! else $err = 0; /// Print the page header --- 69,88 ---- $gradeobj->aimgrade = $grade; } ! else if ($grade >= 0 && !$comment) { // comment is required ! $err = 3; ! } else { $err = 2; // invalid entry + } if (!isset($err)) { $err = math_assignment_update_grades($gradeobj) ? 0 : 1; ! if (!$err) { ! redirect("view.php?id=$cm->id", get_string("changessaved") . "\n" . ! get_string("delaymessage", "math_assignment", format_time($CFG->maxeditingtime)), 2); ! } } } ! else { $err = 0; + } /// Print the page header *************** *** 124,132 **** $strnewgrade = get_string("newgrade", "math_assignment"); $strcomment = get_string("comment", "math_assignment"); ! ! if ($err == 1) notify(get_string("failed", "math_assignment")); ! else if ($err == 2) notify(get_string("invalid", "math_assignment")); print_heading_with_help($streditgrade, "editgrade", "math_assignment"); --- 129,142 ---- $strnewgrade = get_string("newgrade", "math_assignment"); $strcomment = get_string("comment", "math_assignment"); ! $strseed = get_string("seed", "math_assignment"); ! $strseedreset = get_string("seedreset", "math_assignment"); ! ! if ($err == 1) { notify(get_string("failed", "math_assignment")); ! } else if ($err == 2) { notify(get_string("invalid", "math_assignment")); + } else if ($err == 3) { + notify(get_string("commentrequired", "math_assignment")); + } print_heading_with_help($streditgrade, "editgrade", "math_assignment"); *************** *** 154,159 **** echo "$seedinfo "; ! echo " <a href=\"editgrade.php?id=$id&userid=$userid&resetseed=true\">Reset seed</a> "; ! helpbutton ("resetseed", $strresetseed, "math_assignment"); ?></p> </td> --- 164,169 ---- echo "$seedinfo "; ! echo " <a href=\"editgrade.php?id=$id&userid=$userid&resetseed=true\">$strseedreset</a> "; ! helpbutton ("resetseed", $strseedreset, "math_assignment"); ?></p> </td> *************** *** 174,178 **** } echo " "; - helpbutton ("editgrade_old", $stroldgrade, "math_assignment"); ?></p> </td> --- 184,187 ---- *************** *** 182,193 **** <td align="right"><p><b><?php echo $strnewgrade; ?>:</b></p></td> <td> ! <input type="text" name="grade" size="20" maxlength="20" value="<?php if ($gradeobj->aimoverride > AIMOVR_RESET) echo max($gradeobj->aimgrade, 0);?>" /> / <?php echo "$math_assignment->aimgrade "; helpbutton ("editgrade_new", $strnewgrade, "math_assignment"); ?> </td> </tr> <tr valign="top"> ! <td align="right"><p><b><?php echo $strcomment; ?>:</b></p></td> <td> ! <textarea name="comment" rows="8" cols="80" wrap="virtual"><?php p($gradeobj->aimcomment); ?></textarea> <?php helpbutton ("editgrade_comment", $strcomment, "math_assignment"); ?> </td> </tr> --- 191,206 ---- <td align="right"><p><b><?php echo $strnewgrade; ?>:</b></p></td> <td> ! <input type="text" name="grade" size="3" maxlength="20" ! value="<?php if ($gradeobj->aimoverride > AIMOVR_RESET) echo max($gradeobj->aimgrade, 0);?>" /> ! / <?php echo "$math_assignment->aimgrade "; ?> </td> </tr> <tr valign="top"> ! <td align="right"><p> ! <?php helpbutton ("editgrade_comment", $strcomment, "math_assignment"); ?> ! <b><?php echo $strcomment; ?>:</b></p></td> <td> ! <textarea name="comment" rows="8" cols="80" wrap="virtual"><?php p($gradeobj->aimcomment); ?></textarea> </td> </tr> Index: index.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/index.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** index.php 2 Nov 2003 15:45:30 -0000 1.9 --- index.php 16 Nov 2003 18:38:23 -0000 1.10 *************** *** 40,217 **** die; } - /* - - /// Print the list of instances - - $timenow = time(); - $strweek = get_string("week"); - $strtopic = get_string("topic"); - $strname = get_string("name"); - $strtimedue = get_string("timedue", "math_assignment"); - $strproblems = get_string("problems", "math_assignment"); - $strsolutions = get_string("solutions", "math_assignment"); - $strviewproblems = get_string("viewproblems", "math_assignment"); - $strviewsolutions = get_string("viewsolutions", "math_assignment"); - $strpaper = get_string("paper", "math_assignment"); - $strcomputer = get_string("computer", "math_assignment"); - $strtotal = get_string("total"); - $strgrade = get_string("grade"); - $stropen = get_string("open", "math_assignment"); - - if (isteacher($course->id)) { - $teacher = true; - - if ($CFG->math_assignment_aim_display == 0) - $showaim = false; - else if ($CFG->math_assignment_aim_display == 1) - $showaim = isadmin(); - else - $showaim = true; - - if ($showaim) { - $straimsubject = get_string("aimsubject", "math_assignment"); - $strserver = get_string("aimserver", "math_assignment"); - } - - if ($course->format == "weeks") { - $table->head = array ($strweek, $strname, $strtimedue, $strproblems, $strsolutions); - $table->align = array ("CENTER", "LEFT","LEFT","LEFT","LEFT"); - $table->width = array (10, "*","*","*","*"); - } else if ($course->format == "topics") { - $table->head = array ($strtopic, $strname, $strtimedue, $strproblems, $strsolutions); - $table->align = array ("CENTER", "LEFT","LEFT","LEFT","LEFT"); - $table->width = array (10, "*","*","*","*"); - } else { - $table->head = array ($strname, $strtimedue, $strproblems, $strsolutions); - $table->align = array ("LEFT","LEFT","LEFT","LEFT"); - $table->width = array ("*","*","*","*"); - } - if ($showaim) { - array_push($table->head, $straimsubject, $strserver); - array_push($table->align, "LEFT", "LEFT"); - array_push($table->width, "*", "*"); - } - } - else { - $teacher = false; - - if ($course->format == "weeks") { - $table->head = array ($strweek, $strname, $strtimedue, $strproblems, $strsolutions, "$strpaper $strgrade", "$strcomputer $strgrade", "$strtotal $strgrade"); - $table->align = array ("CENTER", "LEFT", "LEFT", "LEFT", "LEFT", "CENTER", "CENTER", "CENTER"); - $table->width = array (10, "*", "*", "*", "*", "*", "*", "*"); - } else if ($course->format == "topics") { - $table->head = array ($strtopic, $strname, $strtimedue, $strproblems, $strsolutions, "$strpaper $strgrade", "$strcomputer $strgrade", "$strtotal $strgrade"); - $table->align = array ("CENTER", "LEFT", "LEFT", "LEFT", "LEFT", "CENTER", "CENTER", "CENTER"); - $table->width = array (10, "*", "*", "*", "*", "*", "*", "*"); - } else { - $table->head = array ($strname, $strtimedue, $strproblems, $strsolutions, "$strpaper $strgrade", "$strcomputer $strgrade", "$strtotal $strgrade"); - $table->align = array ("LEFT", "LEFT", "LEFT", "LEFT", "CENTER", "CENTER", "CENTER"); - $table->width = array ("*", "*", "*", "*", "*", "*", "*"); - } - } - - foreach ($math_assignments as $math_assignment) { - if (!$math_assignment->visible) { - //Show dimmed if the mod is hidden - $link = "<a class=\"dimmed\" href=\"view.php?id=$math_assignment->coursemodule\">$math_assignment->name</a>"; - } - else { - //Show normal if the mod is visible - $link = "<a href=\"view.php?id=$math_assignment->coursemodule\">$math_assignment->name</a>"; - } - - math_assignment_get_file_urls($math_assignment, $proburl, $solurl); - $proburl = htmlspecialchars($proburl); - $solurl = htmlspecialchars($solurl); - if ($teacher) { - if ($showaim && $math_assignment->aimquiz) { - // lookup subject - if (! $subject = get_record("math_assignment_subject", "course", $course->id)) { - $subject->server = 0; - $subject->name = "Unknown"; - } - // lookup server - if (! $server = get_record("math_assignment_server", "id", $subject->server)) { - $server->name = "Unknown"; - $server->address = "unknown"; - } - } - if ($course->format == "weeks" or $course->format == "topics") { - $row = array ($math_assignment->section, $link); - } else { - $row = array ($link); - } - array_push($row, userdate($math_assignment->timedue, "", 99, false), $proburl ? "<a href=\"$proburl\" target=\"problems\">$strviewproblems</a>" : "", $solurl ? "<a href=\"$solurl\" target=\"solutions\">$strviewsolutions</a>" : ""); - if ($showaim) { - if ($math_assignment->aimquiz) - array_push($row, $subject->name, "$server->name ($server->address)"); - else - array_push($row, "", ""); - } - $table->data[] = $row; - } - else if ($math_assignment->visible) { - if (!$grade = get_record("math_assignment_grades", "assignment", $math_assignment->id, "userid", $USER->id)) { - $grade->papergrade = -1; - $grade->aimgrade = -1; - $grade->aimoverride = AIMOVR_OFF; - $grade->aimcomment = ""; - } - if ($math_assignment->papergrade > 0) { - if (!$math_assignment->papersheetsreturned) { - $papergrade = get_string("notpublished", "math_assignment"); - } else if ($grade->papergrade >= 0) { - $papergrade = "$grade->papergrade / $math_assignment->papergrade"; - } else if ($grade->papergrade = -1) { - $papergrade = "-- / $math_assignment->papergrade"; - } - if ($math_assignment->timedue > time()) { - $papergrade = $stropen; - } - } - else { - $papergrade = ""; - } - if ($math_assignment->aimgrade > 0) { - if ($grade->aimgrade >= 0) { - $aimgrade = "$grade->aimgrade / $math_assignment->aimgrade"; - } else { - $aimgrade = "-- / $math_assignment->aimgrade"; - } - if ($math_assignment->timedue > time()) { - $aimgrade = $stropen; - } - if ($grade->aimoverride > AIMOVR_RESET) { - $aimgrade .= " (" . get_string("gradeoverride", "math_assignment") . ")"; - } - } - else { - $aimgrade = ""; - } - - $totalgrade = math_assignment_total_grade($math_assignment, $grade); - $maxgrade = $math_assignment->papergrade + $math_assignment->aimgrade; - $totalgrade = "$totalgrade / $maxgrade"; - // Don't show a total grade if there is an unpublished paper grade - if ($math_assignment->papergrade > 0 and !$math_assignment->papersheetsreturned) { - $totalgrade = ""; - } - if ($course->format == "weeks" or $course->format == "topics") - $row = array ($math_assignment->section, $link); - else - $row = array ($link); - if ($solurl) { - if ($timenow > $math_assignment->timedue) - $solutions = "<a href=\"$solurl\" target=\"solutions\">$strviewsolutions</a>"; - else - $solutions = ""; - } - else - $solutions = ""; - array_push($row, userdate($math_assignment->timedue, "", 99, false), $proburl ? "<a href=\"$proburl\" target=\"problems\">$strviewproblems</a>" : "", $solutions, $papergrade, $aimgrade, $totalgrade); - $table->data[] = $row; - } - } - */ print_heading($strmath_assignments); --- 40,43 ---- Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** lib.php 10 Nov 2003 12:15:29 -0000 1.42 --- lib.php 16 Nov 2003 18:38:23 -0000 1.43 *************** *** 359,365 **** $strviewproblems = get_string("viewproblems", "math_assignment"); $return .= "<a href=\"$proburl\" target=\"problems\">$strviewproblems</a>"; - //$return .= math_assignment_help_button("viewproblems", $strviewproblems, false); } ! if (($solurl) and ($math_assignment->solutiontime < time())) { if (isset($return)) $return .= "<br />\n"; --- 359,364 ---- $strviewproblems = get_string("viewproblems", "math_assignment"); $return .= "<a href=\"$proburl\" target=\"problems\">$strviewproblems</a>"; } ! if (($solurl) and ($math_assignment->solutiontime < time()) && isstudent($math_assignment->course)) { if (isset($return)) $return .= "<br />\n"; *************** *** 370,374 **** $strviewsolutions = get_string("viewsolutions", "math_assignment"); $return .= "<a href=\"$solurl\" target=\"solutions\">$strviewsolutions</a>"; - //$return .= math_assignment_help_button("viewsolutions", $strviewsolutions, false); } else if(($solurl) && isteacher($math_assignment->course)) { --- 369,372 ---- *************** *** 381,385 **** $strviewsolutions = get_string("viewsolutions", "math_assignment"); $return .= "<a href=\"$solurl\" target=\"solutions\">$strviewsolutions</a>"; - $return .= math_assignment_help_button("viewsolutionsteacher", $strviewsolutions, false); } if (isset($return)) { --- 379,382 ---- *************** *** 397,405 **** $filelinks = math_assignment_get_file_links($math_assignment, ""); if ($math_assignment->aimquiz) { ! $return = "<p align=\"$align\">$filelinks"; if ($filelinks) ! $return .= "<br />\n"; // View Quiz ! $return .= "<a href=\"aimpage.php?id=$cm->id\">" . get_string("viewquiz", "math_assignment") . "</a><br />\n"; // Analyse Results $stranalyseresults = get_string("analyseresults", "math_assignment"); --- 394,403 ---- $filelinks = math_assignment_get_file_links($math_assignment, ""); if ($math_assignment->aimquiz) { ! $return = "<table width=\"100%\" align=\"$align\"><tr><td>"; if ($filelinks) ! $return .= "$filelinks<br />\n"; // View Quiz ! $return .= "<a href=\"aimpage.php?id=$cm->id\">" . get_string("viewquiz", "math_assignment") . "</a></td>\n"; ! $return .= "<td align=\"right\"><b>" . get_string("adminlinks", "math_assignment") . "</b><br />"; // Analyse Results $stranalyseresults = get_string("analyseresults", "math_assignment"); *************** *** 407,415 **** $return .= math_assignment_help_button("analyze_quiz", $stranalyseresults, false); $return .= "<br />\n"; - // Try Quiz - $strtryquiz = get_string("tryquiz", "math_assignment"); - $return .= "<a href=\"aimpage.php?id=$cm->id&aimaction=try\">$strtryquiz</a>"; - $return .= math_assignment_help_button("try_quiz", $strtryquiz, false); - $return .= "<br />\n"; // Edit Quiz $streditquiz = get_string("editquiz", "math_assignment"); --- 405,408 ---- *************** *** 417,425 **** $return .= math_assignment_help_button("admin_quiz", $streditquiz, false); $return .= "<br />\n"; // Browse Source /*$strbrowsesource = get_string("browsesource", "math_assignment"); $return .= "<a href=\"aimpage.php?id=$cm->id&aimaction=source\">$strbrowsesource</a>"; $return .= math_assignment_help_button("admin_sourcedir", $strbrowsesource, false); ! $return .= "<br />\n";*/ // Edit Subject $streditsubject = get_string("editsubject", "math_assignment"); --- 410,423 ---- $return .= math_assignment_help_button("admin_quiz", $streditquiz, false); $return .= "<br />\n"; + // Try Quiz + $strtryquiz = get_string("tryquiz", "math_assignment"); + $return .= "<a href=\"aimpage.php?id=$cm->id&aimaction=try\">$strtryquiz</a>"; + $return .= math_assignment_help_button("try_quiz", $strtryquiz, false); + $return .= "<br />\n"; // Browse Source /*$strbrowsesource = get_string("browsesource", "math_assignment"); $return .= "<a href=\"aimpage.php?id=$cm->id&aimaction=source\">$strbrowsesource</a>"; $return .= math_assignment_help_button("admin_sourcedir", $strbrowsesource, false); ! $return .= "<br />\n"; // Edit Subject $streditsubject = get_string("editsubject", "math_assignment"); *************** *** 432,441 **** $return .= "<a href=\"aimpage.php?id=$cm->id&aimaction=zoneadmin\">$strzoneadmin</a>"; $return .= math_assignment_help_button("admin_zoneadmin", $strzoneadmin, false); ! } } else if ($filelinks) ! $return = "<p align=\"$align\">$filelinks"; ! if (!empty($return)) ! $return .= "</p>\n"; return $return; } --- 430,439 ---- $return .= "<a href=\"aimpage.php?id=$cm->id&aimaction=zoneadmin\">$strzoneadmin</a>"; $return .= math_assignment_help_button("admin_zoneadmin", $strzoneadmin, false); ! }*/ ! $return .= "</td></table>\n"; } else if ($filelinks) ! $return = "<p align=\"$align\">$filelinks</p>\n"; ! return $return; } *************** *** 676,680 **** $unwanted = array(">Download<",">Browse source<",">Edit home page<",">Download results<", ">Edit register<",">Student details<",">Hide hidden quizzes<",">Hide hidden questions<", ! ">New Quiz<"); $out = str_replace($unwanted,"><",$out); --- 674,678 ---- $unwanted = array(">Download<",">Browse source<",">Edit home page<",">Download results<", ">Edit register<",">Student details<",">Hide hidden quizzes<",">Hide hidden questions<", ! ">New Quiz<", ">Email<"); $out = str_replace($unwanted,"><",$out); *************** *** 1072,1081 **** $link = "<b>$math_assignment->name</b>"; if ($showlinks) { ! $link = "<a href=\"$CFG->wwwroot/mod/math_assignment/view.php?id=$math_assignment->coursemodule\">$link</a>"; ! } ! if (!$math_assignment->visible) { ! //Show dimmed if the mod is hidden ! $link = "<span style=\"dimmed\">$link</span>"; } --- 1070,1079 ---- $link = "<b>$math_assignment->name</b>"; + + //Show dimmed if the mod is hidden + $hide = ($math_assignment->visible) ? "" : "class=\"dimmed\""; + if ($showlinks) { ! $link = "<a href=\"$CFG->wwwroot/mod/math_assignment/view.php?id=$math_assignment->coursemodule\" $hide>$link</a>"; } Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** pdfgen.php 10 Nov 2003 12:15:29 -0000 1.23 --- pdfgen.php 16 Nov 2003 18:38:23 -0000 1.24 *************** *** 11,14 **** --- 11,16 ---- optional_variable($seed, 0); // seed to be passed to AiM. 0 means no seed set. // This may be overruled by the student's saved seed. + optional_variable($texmachine, remote); // This determines whether to do the texing + // on a remote machine (manor in my case) or the local machine global $USER; *************** *** 82,87 **** $tempfile = substr(md5(microtime()), 0, 6); } ! $remote = 'ftp://gustav:bek...@ma.../home/gustav/public_html/moodletex/'; ! $textopdf = 'http://manor.york.ac.uk/~gustav/moodletex/index.php'; $errlog = ""; --- 84,95 ---- $tempfile = substr(md5(microtime()), 0, 6); } ! ! if ($texmachine == "remote") { ! $remote = 'ftp://gustav:bek...@ma.../home/gustav/public_html/moodletex/'; ! $textopdf = 'http://manor.york.ac.uk/~gustav/moodletex/index.php'; ! } else { ! $remote = 'moodletex/'; ! $textopdf = 'moodletex/index.php'; ! } $errlog = ""; *************** *** 122,126 **** // $math_assignment and stores it in $tempfile.pdf ! global $CFG, $remote; // if there is an aim quiz load it into $data --- 130,134 ---- // $math_assignment and stores it in $tempfile.pdf ! global $CFG, $remote, $texmachine; // if there is an aim quiz load it into $data *************** *** 244,253 **** fwrite($fp,$latex); fclose($fp); - if (!$conn = ftp_connect("manor.york.ac.uk")) echo "couldn't open ftp connection"; - if (!ftp_login($conn, "gustav", "bekieh++")) echo "couldn't log in"; - if (!ftp_site($conn, "chmod 0744 /home/gustav/public_html/moodletex/{$tempfile}.tex")) echo "couldn't chmod"; - ftp_close($conn); - return $latex; --- 252,263 ---- fwrite($fp,$latex); fclose($fp); + + if ($texmachine == "remote") { + if (!$conn = ftp_connect("manor.york.ac.uk")) echo "couldn't open ftp connection"; + if (!ftp_login($conn, "gustav", "bekieh++")) echo "couldn't log in"; + if (!ftp_site($conn, "chmod 0744 /home/gustav/public_html/moodletex/{$tempfile}.tex")) echo "couldn't chmod"; + ftp_close($conn); + } return $latex; Index: setseed.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/setseed.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** setseed.php 10 Nov 2003 12:15:30 -0000 1.4 --- setseed.php 16 Nov 2003 18:38:23 -0000 1.5 *************** *** 9,12 **** --- 9,14 ---- require_variable($sheetid); require_variable($assignment); + optional_variable($confirm, ""); // student will be asked for confirmation unless confirm=confirmed + optional_variable($forward, $_SERVER["HTTP_REFERER"]); // page to be forwarded to after setting seed. global $USER; $student = $USER->id; *************** *** 46,49 **** --- 48,60 ---- // generate random seed if sheetid = -1 if ($sheetid == -1) { + // first make sure that the students really know what they are doing + if (!$confirm == "confirmed") { + notice_yesno(get_string("seedwarning","math_assignment"), + "setseed.php?sheetid=$sheetid&assignment=$assignment&confirm=confirmed&forward=$forward", + "view.php?q=$assignment" + ); + print_footer(); + die; + } $sheetid = mt_rand (10000000,99999999); // make sure seed hasn't already been used *************** *** 105,109 **** } ! redirect($_SERVER["HTTP_REFERER"]); ?> --- 116,120 ---- } ! redirect($forward); ?> Index: subjectpage.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/subjectpage.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** subjectpage.php 18 Sep 2003 09:48:51 -0000 1.2 --- subjectpage.php 16 Nov 2003 18:38:23 -0000 1.3 *************** *** 25,29 **** if (!isteacher($id)) { ! errpr("Only teachers should be able to view this page"); } --- 25,29 ---- if (!isteacher($id)) { ! error("Only teachers should be able to view this page"); } Index: view.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/view.php,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** view.php 10 Nov 2003 12:15:30 -0000 1.23 --- view.php 16 Nov 2003 18:38:23 -0000 1.24 *************** *** 276,280 **** $totalmax = $math_assignment->papergrade + $math_assignment->aimgrade; ! if (!isteacher()) { if (!$inbox) { print_simple_box_start("center"); --- 276,280 ---- $totalmax = $math_assignment->papergrade + $math_assignment->aimgrade; ! if ($isstudent) { if (!$inbox) { print_simple_box_start("center"); |
From: <gus...@us...> - 2003-11-16 18:39:08
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment/moodletex In directory sc8-pr-cvs1:/tmp/cvs-serv7888/mod/math_assignment/moodletex Added Files: index.php Log Message: --- NEW FILE: index.php --- <?PHP // Generate pdf file from latex // required parameter tempfile should be the name of the latex file // optional parameter printcopies should be present only if problem sheets should be // sent to the printer and is then set to the number of copies required. if (!$tempfile = $_GET['tempfile']) { echo "Filename is missing"; die; } $texcommand = 'pdflatex'; if (isset($_GET['printcopies'])) { $printcopies = $_GET['printcopies']; if ($printcopies < 1 or $printcopies > 200) { error("You can not print $printcopies copies"); } for ($i = 1; $i <= $printcopies; $i++) { // reset time limit for each sheet set_time_limit(10); // $errlog = shell_exec("cd /home/gustav/public_html/moodletex; $texcommand $tempfile$i"); $errlog = shell_exec("$texcommand $tempfile$i"); if (!file_exists("$tempfile$i.pdf")) { echo "There was a problem while compiling the tex source!<br> pdflatex wrote the following log:<br><br> <pre>$errlog</pre>"; die; } // Now we should send the pdf file through ghostview and on to the printer @unlink("$tempfile$i.tex"); @unlink("$tempfile$i.aux"); @unlink("$tempfile$i.log"); } echo "$printcopies pdf sheets have been produced"; die; } if (!file_exists("$tempfile.tex")) { echo "Sorry, I can't produce the pdf output. The specified file does not exist."; die; } /// Now run the tex file through pdflatex // $errlog = shell_exec("cd /home/gustav/public_html/moodletex; $texcommand $tempfile"); $errlog = shell_exec("$texcommand $tempfile"); if (!file_exists("$tempfile.pdf")) { echo "There was a problem while compiling the tex source!<br> pdflatex wrote the following log:<br><br> <pre>$errlog</pre>"; die; } // delete temporary files @unlink("$tempfile.tex"); @unlink("$tempfile.aux"); @unlink("$tempfile.log"); @unlink("$tempfile.mog"); if (isset($images)) { $i = 1; while ($i <= $images) { @unlink("$tempfile$i.jpg"); $i++; } } // Now redirect browser to the new pdf file. if ($texmachine == "remote") { $url = "http://manor.york.ac.uk/~gustav/moodletex/$tempfile.pdf"; } else { $url = "$tempfile.pdf"; } echo "<meta http-equiv=\"refresh\" content=\"0; url=$url\" />"; ?> |
From: <gus...@us...> - 2003-11-16 18:37:59
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment/moodletex In directory sc8-pr-cvs1:/tmp/cvs-serv7659/moodletex Log Message: Directory /cvsroot/aimmath/moodle/mod/math_assignment/moodletex added to the repository |
From: <gus...@us...> - 2003-11-16 14:23:38
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim/admin In directory sc8-pr-cvs1:/tmp/cvs-serv24649/WEB-INF/maple/aim/admin Modified Files: Quiz.mpl Log Message: Fixed the "No value for "PartLabel" supplied following Results link" bug. Index: Quiz.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/admin/Quiz.mpl,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Quiz.mpl 25 Sep 2003 19:37:10 -0000 1.5 --- Quiz.mpl 16 Nov 2003 14:22:53 -0000 1.6 *************** *** 89,93 **** "Show results for question @QuestionName@.", ['LinkText' = __("Results"), ! 'Arguments' = ["QuestionName"], 'Command' = "analyze/Question"]], --- 89,93 ---- "Show results for question @QuestionName@.", ['LinkText' = __("Results"), ! 'Arguments' = ["QuestionName","PartLabel"], 'Command' = "analyze/Question"]], *************** *** 417,421 **** page['ActionLink',"TryRightAnswer",[nam]]], [["td","align" = "left"], ! page['ActionLink',"AnalyzeQuestion",[nam]]], [["td","align" = "left"], page['ActionLink',"ToggleQuestion",[nam],__("Hide")]], --- 417,421 ---- page['ActionLink',"TryRightAnswer",[nam]]], [["td","align" = "left"], ! page['ActionLink',"AnalyzeQuestion",[nam,""]]], [["td","align" = "left"], page['ActionLink',"ToggleQuestion",[nam],__("Hide")]], |
From: <gus...@us...> - 2003-11-14 19:55:55
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv32738/WEB-INF/maple/aim Modified Files: Diff.mpl Log Message: now testing for symbolic equivalence in aim/Diff/Test Index: Diff.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Diff.mpl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Diff.mpl 25 Aug 2003 21:47:19 -0000 1.3 --- Diff.mpl 14 Nov 2003 19:55:51 -0000 1.4 *************** *** 169,173 **** # sometimes an extra simplify is needed ... maybe an eval needed elsewhere? ! if traperror(simplify(simplify(ans - rightans,assume=positive))) = 0 then mark := 1; else --- 169,173 ---- # sometimes an extra simplify is needed ... maybe an eval needed elsewhere? ! if traperror(simplify(simplify(ans - rightans,symbolic),symbolic)) = 0 then mark := 1; else |
From: <gus...@us...> - 2003-11-10 12:16:06
|
Update of /cvsroot/aimmath/moodle/lang/en In directory sc8-pr-cvs1:/tmp/cvs-serv1543/lang/en Modified Files: math_assignment.php Log Message: some minor improvements. Index: math_assignment.php =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/math_assignment.php,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** math_assignment.php 20 Oct 2003 03:13:05 -0000 1.23 --- math_assignment.php 10 Nov 2003 12:16:02 -0000 1.24 *************** *** 38,44 **** $string['editquiz'] = "AiM Quiz Administration"; $string['editsubject'] = "AiM Subject Administration"; ! $string['emailnotice'] = "Email students their marks and let them know that their scripts are ready for collection?\n** Put the scripts in the student pigeon holes first **"; ! $string['emailssent'] = "Emails Sent"; ! $string['emailstudents'] = "Email Students"; $string['enterid'] = "Please enter the ID number from the problem sheet that you received in class: "; $string['externalurl'] = "link to URL"; --- 38,48 ---- $string['editquiz'] = "AiM Quiz Administration"; $string['editsubject'] = "AiM Subject Administration"; ! $string['emailnotice'] = "Moodle can now send an automatic email to the students informing them of their marks.<br />Choose which information the students should be sent regarding their scripts:"; ! $string['emailnotice1'] = "Your script has been marked and placed in the pigeonholes for collection."; ! $string['emailnotice2'] = "Your script has been marked and will soon be placed in the pigeonholes for collection."; ! $string['emailnotice3'] = "Your script has been marked and will be returned to you in the next lecture"; ! $string['emailnotice4'] = "Your script has been marked and will be returned to you by your supervisor in your next tutorial"; ! $string['emailsnotsent'] = "The grades have been published and are now available to the students and other lecturers. No emails have been sent."; ! $string['emailssent'] = "The grades have been published and are now available to the students and other lecturers. Emails have been sent to the students."; $string['enterid'] = "Please enter the ID number from the problem sheet that you received in class: "; $string['externalurl'] = "link to URL"; *************** *** 46,51 **** $string['failedaimsetup'] = "Error : Either the AiM quiz specified could not be loaded (check that you entered the name correctly) or it was found to have a maximum grade of zero. If you are sure that neither case applies then contact the administrator."; $string['failedupload'] = "Error : Could not upload the \$a."; $string['generateid'] = "Alternatively you can generate a new version of the problems. You should only use this option if you did not receive a problem sheet in class. "; - $string['gradeemailmessage'] = "Your script has been marked and placed in the pigeonholes for collection."; $string['gradeemailobtained'] = "You obtained"; $string['grademultiplier'] = "Grade Multiplier"; --- 50,55 ---- $string['failedaimsetup'] = "Error : Either the AiM quiz specified could not be loaded (check that you entered the name correctly) or it was found to have a maximum grade of zero. If you are sure that neither case applies then contact the administrator."; $string['failedupload'] = "Error : Could not upload the \$a."; + $string['finalizegrades'] = "Publish grades"; $string['generateid'] = "Alternatively you can generate a new version of the problems. You should only use this option if you did not receive a problem sheet in class. "; $string['gradeemailobtained'] = "You obtained"; $string['grademultiplier'] = "Grade Multiplier"; *************** *** 53,56 **** --- 57,61 ---- $string['gradeoverridemsg'] = "Since the teacher has modified your grades, attempting the assignment will not change them. However you can still view the AiM assignment page for reference."; $string['guestsno'] = "Sorry, guests can not view or attempt assignments"; + $string['hidegradestable'] = "Hide grades table"; $string['html'] = "HTML"; $string['idinvalid'] = "The problem sheet ID \$a is not valid. You must have mistyped it. Please try again."; *************** *** 63,74 **** $string['invalidpapergrade'] = "Error : Invalid maximum grade entered (for the paper based questions). Set to zero if the assignment has only AiM questions."; $string['latexoutput'] = "Default LaTeX Output Method"; - $string['oldgrade'] = "Current Grade"; - $string['or'] = "OR"; - $string['outputchange'] = "Click here to change to"; - $string['outputcurrent'] = "Moodle is currently using"; - $string['outputfuture'] = "Mathematics will be displayed using"; - $string['outputprobs'] = "Mathematics not displaying correctly?"; - $string['paper'] = "Manual"; - $string['problems'] = "Problem sheet"; $string['marksheet'] = "Mark sheet"; $string['mathdisplay'] = "Displaying Mathematics"; --- 68,71 ---- *************** *** 87,101 **** $string['notattempted'] = "You have not attempted this assignment."; $string['notavailabletostudentsyet'] = "not available to students yet"; ! $string['notmarked'] = "The assignment has not yet been marked."; $string['notteacher'] = "You must be a teacher to use this page."; $string['refresh'] = "Refresh"; $string['replacementserver'] = "Replacement Server"; $string['reset'] = "Reset"; $string['reviewresults'] = "Review Results"; $string['secretaryemail'] = "Secretary Email Address"; $string['serverinuse'] = "Error : Can not delete server as one or more assignments depend on it."; $string['singlequestion'] = "single question"; $string['showsheet'] = "Show sheet"; $string['solutions'] = "Solution sheet"; $string['solutiontime'] = "Solutions available after"; $string['studentnotattempted'] = "The student has not attempted this assignment."; --- 84,113 ---- $string['notattempted'] = "You have not attempted this assignment."; $string['notavailabletostudentsyet'] = "not available to students yet"; ! $string['notmarked'] = "The marks for this assignment have not yet been released."; ! $string['notpublished'] = "marking"; $string['notteacher'] = "You must be a teacher to use this page."; + $string['numaims'] = "\$a AiM page hits"; + $string['oldgrade'] = "Current Grade"; + $string['open'] = "open"; + $string['or'] = "OR"; + $string['outputchange'] = "Click here to change to"; + $string['outputcurrent'] = "Moodle is currently using"; + $string['outputfuture'] = "Mathematics will be displayed using"; + $string['outputprobs'] = "Mathematics not displaying correctly?"; + $string['paper'] = "Manual"; + $string['problems'] = "Problem sheet"; + $string['problemsbrief'] = "Problems"; $string['refresh'] = "Refresh"; $string['replacementserver'] = "Replacement Server"; $string['reset'] = "Reset"; + $string['review'] = "Review"; $string['reviewresults'] = "Review Results"; $string['secretaryemail'] = "Secretary Email Address"; $string['serverinuse'] = "Error : Can not delete server as one or more assignments depend on it."; $string['singlequestion'] = "single question"; + $string['showgradestable'] = "Show grades table"; $string['showsheet'] = "Show sheet"; $string['solutions'] = "Solution sheet"; + $string['solutionsbrief'] = "Solutions"; $string['solutiontime'] = "Solutions available after"; $string['studentnotattempted'] = "The student has not attempted this assignment."; *************** *** 104,107 **** --- 116,120 ---- $string['uploadnew'] = "upload new file"; $string['useuploaded'] = "Choose uploaded file"; + $string['view'] = "View"; $string['viewproblems'] = "View Problems"; $string['viewquiz'] = "View AiM Assignment"; |
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv1453/mod/math_assignment Modified Files: editgrade.php email.php lib.php pdfgen.php setseed.php updatepapergrades.php view.php Log Message: some minor improvements. Index: editgrade.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/editgrade.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** editgrade.php 26 Sep 2003 22:23:23 -0000 1.2 --- editgrade.php 10 Nov 2003 12:15:29 -0000 1.3 *************** *** 9,12 **** --- 9,14 ---- require_variable($id); // quiz id require_variable($userid); // student user id + optional_variable($resetseed, false); // if true the seed for this student is removed from database + // so that next time the student accesses the assignment he/she will have to enter a new one. if (! $site = get_site()) { *************** *** 31,36 **** error(get_string("notteacher", "math_assignment")); } ! if (!$gradeobj = get_record("math_assignment_grades", "assignment", $math_assignment->id, "userid", $userid)) { $gradeobj->assignment = $math_assignment->id; $gradeobj->userid = $userid; --- 33,42 ---- error(get_string("notteacher", "math_assignment")); } + + if ($resetseed) { + delete_records("math_assignment_seed", "student", $userid, "assignment", $math_assignment->id); + } ! if (!$gradeobj = get_record("math_assignment_grades", "assignment", $id, "userid", $userid)) { $gradeobj->assignment = $math_assignment->id; $gradeobj->userid = $userid; *************** *** 112,115 **** --- 118,123 ---- $string->sec = get_string("sec"); $string->secs = get_string("secs"); + $string->year = get_string("year"); + $string->route = get_string("route"); $stroldgrade = get_string("oldgrade", "math_assignment"); *************** *** 136,139 **** --- 144,165 ---- </td> </tr> + + <?php + if ($seedinfo = get_field("math_assignment_seed", "seed", "assignment", $id, "student", $userid)) { + ?> + <tr valign="top"> + <td align="right"><p><b><?php echo $strseed; ?>:</b></p></td> + <td> + <p><?php + + echo "$seedinfo "; + echo " <a href=\"editgrade.php?id=$id&userid=$userid&resetseed=true\">Reset seed</a> "; + helpbutton ("resetseed", $strresetseed, "math_assignment"); + ?></p> + </td> + </tr> + <?php + } + ?> <tr valign="top"> Index: email.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/email.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** email.php 31 Oct 2003 14:05:59 -0000 1.4 --- email.php 10 Nov 2003 12:15:29 -0000 1.5 *************** *** 11,14 **** --- 11,16 ---- optional_variable($email, ""); // send email yes or no optional_variable($message, ""); // message to include in email to student + + global $USER; if (! $site = get_site()) { *************** *** 29,32 **** --- 31,36 ---- require_login($course->id); + + $teacher = $USER; add_to_log($course->id, "math_assignment", "finalise grades", "view.php?id=$cm->id", "$math_assignment->name"); *************** *** 48,52 **** foreach ($students as $student) { // send email to the student ! if (!math_assignment_email_grades($course, $math_assignment, $student, $stremailnotice[$message])) $failed++; } --- 52,56 ---- foreach ($students as $student) { // send email to the student ! if (!math_assignment_email_grades($course, $math_assignment, $student ,$teacher, $stremailnotice[$message])) $failed++; } Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** lib.php 2 Nov 2003 15:45:30 -0000 1.41 --- lib.php 10 Nov 2003 12:15:29 -0000 1.42 *************** *** 168,173 **** if ($logs = get_records_select("log", "userid='$user->id' AND module='math_assig' ! AND action='view' AND ! (info='$math_assignment->id' OR info='$math_assignment->name')", "time ASC")) { $numviews = count($logs); --- 168,173 ---- if ($logs = get_records_select("log", "userid='$user->id' AND module='math_assig' ! AND action='view' AND ! (info='$math_assignment->id' OR info='$math_assignment->name')", "time ASC")) { $numviews = count($logs); *************** *** 188,199 **** if ($logs = get_records_select("log", "userid='$user->id' AND module='math_assig' ! AND action='view' ! AND (info='$math_assignment->id' OR info='$math_assignment->name')", "time ASC")) { $numviews = count($logs); $lastlog = array_pop($logs); $aimlogs = get_records_select("log", "userid='$user->id' AND module='math_assig' ! AND action='aimpage' ! AND (info='$math_assignment->id' OR info='$math_assignment->name')", "time ASC"); $numaims = count($aimlogs); --- 188,199 ---- if ($logs = get_records_select("log", "userid='$user->id' AND module='math_assig' ! AND action='view' ! AND (info='$math_assignment->id' OR info='$math_assignment->name')", "time ASC")) { $numviews = count($logs); $lastlog = array_pop($logs); $aimlogs = get_records_select("log", "userid='$user->id' AND module='math_assig' ! AND action='aimpage' ! AND (info='$math_assignment->id' OR info='$math_assignment->name')", "time ASC"); $numaims = count($aimlogs); *************** *** 559,564 **** // get max grade for the aim quiz $max_grade = math_assignment_get_aim_max_grade($math_assignment, $subject, $server); ! if (!$max_grade) // note that this includes the case where $max_grade is zero ! return false; $math_assignment->aimgrade = $max_grade; --- 559,565 ---- // get max grade for the aim quiz $max_grade = math_assignment_get_aim_max_grade($math_assignment, $subject, $server); ! // I have changed this to allow zero AiM grade ! //if (!$max_grade) // note that this includes the case where $max_grade is zero ! // return false; $math_assignment->aimgrade = $max_grade; *************** *** 713,719 **** '$userid = get_field("user", "id", "username", $matches[1]); $haspicture = get_field("user", "picture", "id", $userid); ! $photo = print_user_picture($userid, 2, $haspicture, true, true); return "<th align=\"left\">Student photo</th><td>$photo</td></tr><tr> ! <th align=\"left\">Student ID</th>\n<td>$matches[1]</td>";' ), $out ); --- 714,720 ---- '$userid = get_field("user", "id", "username", $matches[1]); $haspicture = get_field("user", "picture", "id", $userid); ! $photo = print_user_picture($userid, 1, $haspicture, true, true); return "<th align=\"left\">Student photo</th><td>$photo</td></tr><tr> ! <th align=\"left\">Student ID</th>\n<td>$matches[1]</td>";' ), $out ); *************** *** 838,872 **** if ($students) { foreach ($students as $key => $student) { ! if ($students[$key] = get_record_sql("SELECT firstname, lastname, email, username, mailformat, picture FROM {$CFG->prefix}user WHERE id = '$key' AND deleted = '0'")) { ! $grade = get_record_sql("SELECT papergrade, aimgrade, aimoverride, aimcomment FROM {$CFG->prefix}math_assignment_grades WHERE assignment = '$math_assignment->id' and userid = '$key'"); ! if ($grade) { ! $students[$key]->papergrade = $grade->papergrade; ! $students[$key]->aimgrade = $grade->aimgrade; ! $students[$key]->aimoverride = $grade->aimoverride ; ! $students[$key]->aimcomment = $grade->aimcomment; ! $students[$key]->totalgrade = math_assignment_total_grade($math_assignment, $grade); ! } ! else { ! $students[$key]->papergrade = -1; ! $students[$key]->aimgrade = -1; ! $students[$key]->aimoverride = AIMOVR_OFF ; ! $students[$key]->aimcomment = ""; ! $students[$key]->totalgrade = 0; ! } ! } ! else { ! // assume it failed because deleted was not zero ! unset($students[$key]); ! } } // sort if (strcasecmp($sortdir, "desc") == 0) ! $mult = -1; else ! $mult = 1; if (strcasecmp($sort, "id") == 0) ! uksort($students, create_function('$a, $b', 'return (($a > $b) ? 1 : -1) * ' . $mult . ';')); else ! uasort($students, create_function('$a, $b', 'return (($a->' . $sort . ' > $b->' . $sort . ') ? 1 : -1) * ' . $mult . ';')); } break; --- 839,873 ---- if ($students) { foreach ($students as $key => $student) { ! if ($students[$key] = get_record_sql("SELECT firstname, lastname, email, username, mailformat, picture FROM {$CFG->prefix}user WHERE id = '$key' AND deleted = '0'")) { ! $grade = get_record_sql("SELECT papergrade, aimgrade, aimoverride, aimcomment FROM {$CFG->prefix}math_assignment_grades WHERE assignment = '$math_assignment->id' and userid = '$key'"); ! if ($grade) { ! $students[$key]->papergrade = $grade->papergrade; ! $students[$key]->aimgrade = $grade->aimgrade; ! $students[$key]->aimoverride = $grade->aimoverride ; ! $students[$key]->aimcomment = $grade->aimcomment; ! $students[$key]->totalgrade = math_assignment_total_grade($math_assignment, $grade); ! } ! else { ! $students[$key]->papergrade = -1; ! $students[$key]->aimgrade = -1; ! $students[$key]->aimoverride = AIMOVR_OFF ; ! $students[$key]->aimcomment = ""; ! $students[$key]->totalgrade = 0; ! } ! } ! else { ! // assume it failed because deleted was not zero ! unset($students[$key]); ! } } // sort if (strcasecmp($sortdir, "desc") == 0) ! $mult = -1; else ! $mult = 1; if (strcasecmp($sort, "id") == 0) ! uksort($students, create_function('$a, $b', 'return (($a > $b) ? 1 : -1) * ' . $mult . ';')); else ! uasort($students, create_function('$a, $b', 'return (($a->' . $sort . ' > $b->' . $sort . ') ? 1 : -1) * ' . $mult . ';')); } break; *************** *** 885,901 **** } ! function math_assignment_email_grades($course, $math_assignment, $student, $message="") { /// Function which constructs an email telling the student what their grade is global $CFG; - // send from the main teacher - if (!$teachers = get_records_sql("SELECT u.*,t.role,t.editall FROM {$CFG->prefix}user u, {$CFG->prefix}user_teachers t WHERE t.course = '$course->id' AND t.userid = u.id AND u.deleted = '0' AND t.authority > '0' ORDER BY t.authority ASC")) - return false; - $teacher = reset($teachers); $hasaim = $math_assignment->aimquiz; $papergrade = min(max((int) $student->papergrade, 0), $math_assignment->papergrade); ! if ($hasaim) $aimgrade = min(max((int) $student->aimgrade, 0), $math_assignment->aimgrade); if ($student->mailformat) { // build html email --- 886,902 ---- } ! function math_assignment_email_grades($course, $math_assignment, $student, $teacher, $message="") { /// Function which constructs an email telling the student what their grade is global $CFG; $hasaim = $math_assignment->aimquiz; $papergrade = min(max((int) $student->papergrade, 0), $math_assignment->papergrade); ! if ($hasaim) { $aimgrade = min(max((int) $student->aimgrade, 0), $math_assignment->aimgrade); + } + if (!($student->papergrade >=0 or $student->aimgrade >=0)) { // Don't send email if no work was completed + return true; + } if ($student->mailformat) { // build html email *************** *** 1118,1129 **** if ($math_assignment->papergrade > 0) { if (!$math_assignment->papersheetsreturned) { ! $papergrade = get_string("notpublished", "math_assignment"); } else if ($grade->papergrade >= 0) { ! $papergrade = "<b>$grade->papergrade / $math_assignment->papergrade</b>"; } else if ($grade->papergrade = -1) { ! $papergrade = "<b>-- / $math_assignment->papergrade</b>"; } if ($math_assignment->timedue > time()) { ! $papergrade = $stropen; } } --- 1119,1130 ---- if ($math_assignment->papergrade > 0) { if (!$math_assignment->papersheetsreturned) { ! $papergrade = get_string("notpublished", "math_assignment"); } else if ($grade->papergrade >= 0) { ! $papergrade = "<b>$grade->papergrade / $math_assignment->papergrade</b>"; } else if ($grade->papergrade = -1) { ! $papergrade = "<b>-- / $math_assignment->papergrade</b>"; } if ($math_assignment->timedue > time()) { ! $papergrade = $stropen; } } *************** *** 1133,1146 **** if ($math_assignment->aimgrade > 0) { if ($grade->aimgrade >= 0) { ! $aimgrade = "<b>$grade->aimgrade / $math_assignment->aimgrade</b>"; } else { ! $aimgrade = "<b>-- / $math_assignment->aimgrade</b>"; } // show aimgrade in grey if quiz has not closed yet if ($math_assignment->timedue > time()) { ! $aimgrade = "<span style=\"color: silver \">$aimgrade</span>"; } if ($grade->aimoverride > AIMOVR_RESET) { ! $aimgrade .= " (" . get_string("gradeoverride", "math_assignment") . ")"; } } --- 1134,1147 ---- if ($math_assignment->aimgrade > 0) { if ($grade->aimgrade >= 0) { ! $aimgrade = "<b>$grade->aimgrade / $math_assignment->aimgrade</b>"; } else { ! $aimgrade = "<b>-- / $math_assignment->aimgrade</b>"; } // show aimgrade in grey if quiz has not closed yet if ($math_assignment->timedue > time()) { ! $aimgrade = "<span style=\"color: silver \">$aimgrade</span>"; } if ($grade->aimoverride > AIMOVR_RESET) { ! $aimgrade .= " (" . get_string("gradeoverride", "math_assignment") . ")"; } } *************** *** 1164,1170 **** if ($solurl) { if ($timenow > $math_assignment->timedue) ! $solutions = "<a href=\"$solurl\" target=\"solutions\">$strviewsolutions</a>"; else ! $solutions = ""; } else --- 1165,1171 ---- if ($solurl) { if ($timenow > $math_assignment->timedue) ! $solutions = "<a href=\"$solurl\" target=\"solutions\">$strviewsolutions</a>"; else ! $solutions = ""; } else *************** *** 1205,1210 **** } ! function copy_from_url($url, $file) { // emulates copy which works with URLSs only in PHP >= 4.3.0 ! if (!$handle = fopen($url, "rb")) return false; $contents = ""; --- 1206,1211 ---- } ! function math_assignment_copy($origin, $dest) { // emulates copy which works with URLSs only in PHP >= 4.3.0 ! if (!$handle = fopen($origin, "rb")) return false; $contents = ""; *************** *** 1217,1223 **** } while(true); fclose($handle); ! if (!$handle = fopen($file, "wb")) return false; ! fwrite($handle, $contents, strlen($contents)); fclose($handle); return true; --- 1218,1224 ---- } while(true); fclose($handle); ! if (!$handle = fopen($dest, "wb")) return false; ! if (!fwrite($handle, $contents, strlen($contents))) error("copying failed"); fclose($handle); return true; Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** pdfgen.php 2 Nov 2003 15:45:30 -0000 1.22 --- pdfgen.php 10 Nov 2003 12:15:29 -0000 1.23 *************** *** 10,14 **** optional_variable($printcopies); // number of randomized copies to send to printer optional_variable($seed, 0); // seed to be passed to AiM. 0 means no seed set. ! // This may be overruled by the student's saved seed. global $USER; --- 10,14 ---- optional_variable($printcopies); // number of randomized copies to send to printer optional_variable($seed, 0); // seed to be passed to AiM. 0 means no seed set. ! // This may be overruled by the student's saved seed. global $USER; *************** *** 33,37 **** // make sure students don't look at solutions before they should ! if (($type == "solutions") and isstudent($course->id) and $math_assignment->solutiontime > time()){ error("You can not view the solutions yet!"); } --- 33,37 ---- // make sure students don't look at solutions before they should ! if ($type == "solutions" and isstudent($course->id) and $math_assignment->solutiontime > time()){ error("You can not view the solutions yet!"); } *************** *** 82,86 **** $tempfile = substr(md5(microtime()), 0, 6); } ! $errlog = ""; --- 82,88 ---- $tempfile = substr(md5(microtime()), 0, 6); } ! $remote = 'ftp://gustav:bek...@ma.../home/gustav/public_html/moodletex/'; ! $textopdf = 'http://manor.york.ac.uk/~gustav/moodletex/index.php'; ! $errlog = ""; *************** *** 98,152 **** error("Couldn't add $i seed $newseed->seed to database"); } ! math_assignment_generate_pdf($math_assignment, $course, $subject, $server, $type, "$tempfile$i", $newseed->seed); ! // I would now like to send the sheet directly to the printer but that does not work for unknown reasons ! // so for now I am satisfied with having the sheet saved on disk and I will send them all to the printer ! // from the file manager later. //echo exec("gsview32 -p prmaths1.york.ac.uk $tempfile$i.pdf"); echo "Sheet $i generated<br>"; } } else { - /* - math_assignment_generate_pdf($math_assignment, $course, $subject, $server, $type, $tempfile, $seed); ! // output of pdf ! ! // I have just noticed the following in the php documentation on this issue of using Content-disposition headers: ! // Note: There is a bug in Microsoft Internet Explorer 4.01 that prevents this from working. There is no workaround. ! // There is also a bug in Microsoft Internet Explorer 5.5 that interferes with this, which can be resolved by upgrading ! // to Service Pack 2 or later. ! // Darn MS! ! // One possible way round this might be to use slash arguments with the last arguent 'problems.pdf' when a ! // problem sheet is required and 'solutions.pdf' when solutions are required. With luck this might fool IE which seems to ! // go by the extension when it ignores the headers. This would need testing in a broken version of IE. ! if ($file = @fopen("$tempfile.pdf", "rb")) { // the 'b' is for compatibility with Windoze ! // tell the browser that it is pdf ! header("Content-type: application/pdf"); ! if ($type = "solutions") ! header("Content-disposition: inline; filename=solutions.pdf"); ! else ! header("Content-disposition: inline; filename=problems.pdf"); ! header('Cache-Control: public'); ! @fpassthru($file); // chuck all the data direct to the browser and close the handle ! @fclose($file); ! } ! */ ! error("<p>Problem and solution sheets are temporarily unavailable. You can however still view the AiM assignment.</p> ! <p>Unfortunately the machine that was supposed to automatically ! generate these sheets has had a hard disk failure. If you did not receive a copy of the problem sheet during the lectures ! please send an email to <a href=\"mailto:gw...@yo...\">gw...@yo...</a>. I may be able to email you the pdf file. </p>"); } - @unlink("$tempfile.pdf"); - ! function math_assignment_generate_pdf($math_assignment, $course, $subject, $server, $type, $tempfile, $seed=0) { ! // This function generates a sheet of type $type (problem or solution) for the assignment // $math_assignment and stores it in $tempfile.pdf ! global $CFG; // if there is an aim quiz load it into $data --- 100,126 ---- error("Couldn't add $i seed $newseed->seed to database"); } ! math_assignment_generate_latex($math_assignment, $course, $subject, $server, $type, "$tempfile$i", $newseed->seed); ! //echo exec("gsview32 -p prmaths1.york.ac.uk $tempfile$i.pdf"); echo "Sheet $i generated<br>"; } + redirect("$textopdf?tempfile=$tempfile&printcopies=$printcopies"); } else { ! math_assignment_generate_latex($math_assignment, $course, $subject, $server, $type, $tempfile, $seed); ! redirect("$textopdf?tempfile=$tempfile"); ! die; } ! function math_assignment_generate_latex($math_assignment, $course, $subject, $server, $type, $tempfile, $seed=0) { ! // This function generates a LaTeX sheet of type $type (problem or solution) for the assignment // $math_assignment and stores it in $tempfile.pdf ! global $CFG, $remote; // if there is an aim quiz load it into $data *************** *** 173,177 **** // attempt to register them automatically if (!math_assignment_register_with_aim($server, $subject)) { ! error(get_string("nooutput", "math_assignment"), "view.php?id=$cm->id"); } // retry --- 147,151 ---- // attempt to register them automatically if (!math_assignment_register_with_aim($server, $subject)) { ! error(get_string("nooutput", "math_assignment"), "view.php?id=$cm->id"); } // retry *************** *** 185,194 **** $imageurls = $imagematches[1]; foreach ($imageurls as $key => $imageurl) { ! if (!copy_from_url($imageurl,"$tempfile$key.jpg")) error("Couldn't copy image file to temp directory"); $data = preg_replace("/<img src=\"([^\"]+jpg)\"/", "<latex>\n\\begin\{center}\n\\pdfimageresolution=150\n\\pdfximage\{$tempfile$key.jpg}\\pdfrefximage\\pdflastximage\n\\end\{center}\n</latex>", $data,1 ); } } --- 159,174 ---- $imageurls = $imagematches[1]; foreach ($imageurls as $key => $imageurl) { ! if (!math_assignment_copy($imageurl,"$remote$tempfile$key.jpg")) { error("Couldn't copy image file to temp directory"); + } $data = preg_replace("/<img src=\"([^\"]+jpg)\"/", "<latex>\n\\begin\{center}\n\\pdfimageresolution=150\n\\pdfximage\{$tempfile$key.jpg}\\pdfrefximage\\pdflastximage\n\\end\{center}\n</latex>", $data,1 ); + if (!$conn = ftp_connect("manor.york.ac.uk")) echo "couldn't open ftp connection"; + if (!ftp_login($conn, "gustav", "bekieh++")) echo "couldn't log in"; + if (!ftp_chdir($conn, "/home/gustav/public_html/moodletex")) echo " couldn't change directory"; + if (!ftp_site($conn, "chmod 0744 /home/gustav/public_html/moodletex/$tempfile$key.jpg")) echo "couldn't chmod"; + ftp_close($conn); } } *************** *** 207,211 **** } } ! else if ($type == "solutions") { if ($math_assignment->solutionsisurl) { $texfile = $math_assignment->solutions; --- 187,191 ---- } } ! else if ($type == solutions) { if ($math_assignment->solutionsisurl) { $texfile = $math_assignment->solutions; *************** *** 217,224 **** if (math_assignment_is_tex_file($texfile)) { ! $latex = implode ('', file($texfile)); ! // Make sure that inputs and eps files are taken from the course file directory ! $latex = preg_replace("/\\\input[ ]+(?!amstex)/", "\\\input $CFG->dataroot/$course->id/", $latex); ! $latex = preg_replace("/(?<=[\\W])[\\w]+\\.eps/", "$CFG->dataroot/$course->id/\$1", $latex); // \aimquestion prints a \spericalangle before the aim question $latex = str_replace('\aimquestion', '$\sphericalangle$ \aimque', $latex); --- 197,217 ---- if (math_assignment_is_tex_file($texfile)) { ! $latex = implode ('', file($texfile)); ! ! // Copy eps files to moodletex ! if (preg_match_all("/(?<=[\\W])[\\w]+\\.eps/" ,$latex, $imagematches)) { ! $images = $imagematches[1]; ! foreach ($images as $image) { ! if (!math_assignment_copy("$CFG->dataroot/$course->id/$image", "$remote$tempfile$image")) { ! error("Couldn't copy graphics file $image"); ! } ! $latex = preg_replace("/(?<=[\\W])[\\w]+\\.eps/", "$tempfile$image", $latex, 1); ! if (!$conn = ftp_connect("manor.york.ac.uk")) echo "couldn't open ftp connection"; ! if (!ftp_login($conn, "gustav", "bekieh++")) echo "couldn't log in"; ! if (!ftp_site($conn, "chmod 0744 /home/gustav/public_html/moodletex/$tempfile$image.eps")) echo "couldn't chmod"; ! ftp_close($conn); ! } ! } ! // \aimquestion prints a \spericalangle before the aim question $latex = str_replace('\aimquestion', '$\sphericalangle$ \aimque', $latex); *************** *** 245,293 **** $latex = str_replace("\begin{document}", "\begin{document}\begin{flushright}Problem sheet ID: $seed\end{flushright}", $latex); } ! ! // generate pdf file from $latex ! if (!$fp=fopen("$tempfile.tex","wb")) error("Sorry, I can't produce the pdf output. Failed to open temporary file."); fwrite($fp,$latex); fclose($fp); ! // decide whether to use latex or tex ! if (strpos($latex, "begin{document}")) { ! $texcommand = "pdflatex.bat"; ! } ! else { ! $texcommand = "pdftex"; ! } ! ! // for Unix work in temp directory ! if (strpos($_ENV["OS"], "Win") === false) { ! exec("cd ".dirname($tempfile)."; $texcommand $tempfile.tex"); ! } ! // for Windows unfortunately the cd doesn't work so we work in the ! // current directory ! else { ! $logp=fopen("$tempfile.mog","wb"); ! fwrite($logp,shell_exec("$texcommand $tempfile.tex")); ! fclose($logp); ! } - if (!file_exists("$tempfile.pdf")) { - $errlog = htmlentities(implode('', file("$tempfile.log"))); - error("There was a problem while compiling the tex source!<br> - pdflatex wrote the following log file:<br><br> - <pre>$errlog</pre>"); - } - - // delete temporary files - @unlink("$tempfile.tex"); - @unlink("$tempfile.aux"); - @unlink("$tempfile.log"); - @unlink("$tempfile.mog"); - if (isset($imageurls)) { - foreach ($imageurls as $key => $imageurl) { - @unlink("$tempfile$key.jpg"); - } - } - return true; } --- 238,255 ---- $latex = str_replace("\begin{document}", "\begin{document}\begin{flushright}Problem sheet ID: $seed\end{flushright}", $latex); } ! ! // Write $latex to moodletex ! if (!$fp=fopen("$remote$tempfile.tex","wb")) error("Sorry, I can't produce the pdf output. Failed to open temporary file."); fwrite($fp,$latex); fclose($fp); ! if (!$conn = ftp_connect("manor.york.ac.uk")) echo "couldn't open ftp connection"; ! if (!ftp_login($conn, "gustav", "bekieh++")) echo "couldn't log in"; ! if (!ftp_site($conn, "chmod 0744 /home/gustav/public_html/moodletex/{$tempfile}.tex")) echo "couldn't chmod"; ! ftp_close($conn); ! ! return $latex; } Index: setseed.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/setseed.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** setseed.php 31 Oct 2003 14:05:59 -0000 1.3 --- setseed.php 10 Nov 2003 12:15:30 -0000 1.4 *************** *** 44,49 **** "", "", true, update_module_button($cm->id, $course->id, $strmath_assignment), navmenu($course, $cm)); ! // generate random seed if sheetid = 0 ! if ($sheetid == 0) { $sheetid = mt_rand (10000000,99999999); // make sure seed hasn't already been used --- 44,49 ---- "", "", true, update_module_button($cm->id, $course->id, $strmath_assignment), navmenu($course, $cm)); ! // generate random seed if sheetid = -1 ! if ($sheetid == -1) { $sheetid = mt_rand (10000000,99999999); // make sure seed hasn't already been used Index: updatepapergrades.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/updatepapergrades.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** updatepapergrades.php 31 Oct 2003 14:05:59 -0000 1.3 --- updatepapergrades.php 10 Nov 2003 12:15:30 -0000 1.4 *************** *** 31,43 **** /// update database with each grade posted ! foreach ($_POST as $userid => $grade) { if (ctype_digit("$userid") && (ctype_digit("$grade") || "$grade" === "")) { ! if ($grade < 0) $grade = 0; ! if ($grade > $math_assignment->papergrade) $grade = $math_assignment->papergrade; ! if ($grade === "") $grade = -1; // load grade record and update if (!$gradeobj = get_record("math_assignment_grades", "assignment", $math_assignment->id, "userid", $userid)) { --- 31,48 ---- /// update database with each grade posted ! $warning = 0; foreach ($_POST as $userid => $grade) { if (ctype_digit("$userid") && (ctype_digit("$grade") || "$grade" === "")) { ! if ($grade < 0) { $grade = 0; ! $warning = 1; ! } ! if ($grade > $math_assignment->papergrade) { $grade = $math_assignment->papergrade; ! $warning = 2; ! } ! if ($grade === "") { $grade = -1; + } // load grade record and update if (!$gradeobj = get_record("math_assignment_grades", "assignment", $math_assignment->id, "userid", $userid)) { *************** *** 50,59 **** $gradeobj->aimoverride = AIMOVR_OFF; $gradeobj->aimcomment = ""; ! insert_record("math_assignment_grades", $gradeobj, false); } else if ($gradeobj->papergrade != $grade) { $gradeobj->papergrade = $grade; $gradeobj->papertimemodified = time(); ! math_assignment_update_grades($gradeobj); } } --- 55,68 ---- $gradeobj->aimoverride = AIMOVR_OFF; $gradeobj->aimcomment = ""; ! if (!insert_record("math_assignment_grades", $gradeobj, false)) { ! $warning = 3; ! } } else if ($gradeobj->papergrade != $grade) { $gradeobj->papergrade = $grade; $gradeobj->papertimemodified = time(); ! if (!math_assignment_update_grades($gradeobj)) { ! $warning = 4; ! } } } *************** *** 61,64 **** print_header(); ! redirect("$CFG->wwwroot/mod/math_assignment/view.php?q=$math_assignment->id", get_string("changessaved"), 1); ?> --- 70,80 ---- print_header(); ! ! $strnotice = get_string("changessaved"); ! $delay = 3; ! if ($warning) { ! $strnotice .= "<br />There have however been some irregularities (such as grades larger than the allowed maximum or negative grades). Please review the grades."; ! $delay = 15; ! } ! redirect("$CFG->wwwroot/mod/math_assignment/view.php?q=$math_assignment->id", $strnotice, $delay); ?> Index: view.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/view.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** view.php 2 Nov 2003 15:45:30 -0000 1.22 --- view.php 10 Nov 2003 12:15:30 -0000 1.23 *************** *** 276,280 **** $totalmax = $math_assignment->papergrade + $math_assignment->aimgrade; ! if (!isteacher($course->id)) { if (!$inbox) { print_simple_box_start("center"); --- 276,280 ---- $totalmax = $math_assignment->papergrade + $math_assignment->aimgrade; ! if (!isteacher()) { if (!$inbox) { print_simple_box_start("center"); *************** *** 449,453 **** } } ! if ($isstudent) { echo math_assignment_get_file_links($math_assignment, "center"); if ($hasaim) { --- 449,453 ---- } } ! if ($isstudent or isguest()) { echo math_assignment_get_file_links($math_assignment, "center"); if ($hasaim) { |
From: <gus...@us...> - 2003-11-02 15:45:33
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv24415/mod/math_assignment Modified Files: aimpage.php index.php lib.php pdfgen.php view.php Log Message: some minor improvements. Index: aimpage.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/aimpage.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** aimpage.php 31 Oct 2003 14:05:59 -0000 1.17 --- aimpage.php 2 Nov 2003 15:45:30 -0000 1.18 *************** *** 267,273 **** echo "<td align=\"center\" width=\"35%\">"; // write admin links ! if (isteacher($course->id)) echo math_assignment_get_admin_links($cm, $math_assignment, $server->password, "center"); ! echo "<center><a href=\"view.php?id=$cm->id&showgrades=true\">Show Grades table</a></center>"; echo "</td></tr></table>"; --- 267,274 ---- echo "<td align=\"center\" width=\"35%\">"; // write admin links ! if (isteacher($course->id)) { echo math_assignment_get_admin_links($cm, $math_assignment, $server->password, "center"); ! echo "<center><a href=\"view.php?id=$cm->id&showgrades=true\">".get_string("showgradestable", "math_assignment").'</a></center>'; ! } echo "</td></tr></table>"; Index: index.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/index.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** index.php 26 Sep 2003 22:23:23 -0000 1.8 --- index.php 2 Nov 2003 15:45:30 -0000 1.9 *************** *** 7,10 **** --- 7,12 ---- require_variable($id); // course + + global $USER; if (! $course = get_record("course", "id", $id)) { *************** *** 33,44 **** print_header("$course->shortname: $strmath_assignments", "$course->fullname", "$navigation $strmath_assignments"); - /// Get all the appropriate data ! if (! $math_assignments = get_all_instances_in_course("math_assignment", $course)) { notice("There are no $strmath_assignments", "../../course/view.php?id=$course->id"); die; } ! /// Print the list of instances (your module will probably extend this) $timenow = time(); --- 35,46 ---- print_header("$course->shortname: $strmath_assignments", "$course->fullname", "$navigation $strmath_assignments"); ! if (!$table = math_assignment_gradestable($course, $USER->id)) { notice("There are no $strmath_assignments", "../../course/view.php?id=$course->id"); die; } + /* ! /// Print the list of instances $timenow = time(); *************** *** 55,58 **** --- 57,61 ---- $strtotal = get_string("total"); $strgrade = get_string("grade"); + $stropen = get_string("open", "math_assignment"); if (isteacher($course->id)) { *************** *** 155,175 **** $grade->aimcomment = ""; } ! if ($grade->papergrade >= 0 && $math_assignment->papergrade > 0) ! $papergrade = "$grade->papergrade / $math_assignment->papergrade"; ! else $papergrade = ""; if ($math_assignment->aimgrade > 0) { ! if ($grade->aimgrade >= 0) $aimgrade = "$grade->aimgrade / $math_assignment->aimgrade"; ! else ! $aimgrade = ""; ! if ($grade->aimoverride > AIMOVR_RESET) $aimgrade .= " (" . get_string("gradeoverride", "math_assignment") . ")"; } ! else $aimgrade = ""; $totalgrade = math_assignment_total_grade($math_assignment, $grade); $maxgrade = $math_assignment->papergrade + $math_assignment->aimgrade; $totalgrade = "$totalgrade / $maxgrade"; if ($course->format == "weeks" or $course->format == "topics") $row = array ($math_assignment->section, $link); --- 158,200 ---- $grade->aimcomment = ""; } ! if ($math_assignment->papergrade > 0) { ! if (!$math_assignment->papersheetsreturned) { ! $papergrade = get_string("notpublished", "math_assignment"); ! } else if ($grade->papergrade >= 0) { ! $papergrade = "$grade->papergrade / $math_assignment->papergrade"; ! } else if ($grade->papergrade = -1) { ! $papergrade = "-- / $math_assignment->papergrade"; ! } ! if ($math_assignment->timedue > time()) { ! $papergrade = $stropen; ! } ! } ! else { $papergrade = ""; + } if ($math_assignment->aimgrade > 0) { ! if ($grade->aimgrade >= 0) { $aimgrade = "$grade->aimgrade / $math_assignment->aimgrade"; ! } else { ! $aimgrade = "-- / $math_assignment->aimgrade"; ! } ! if ($math_assignment->timedue > time()) { ! $aimgrade = $stropen; ! } ! if ($grade->aimoverride > AIMOVR_RESET) { $aimgrade .= " (" . get_string("gradeoverride", "math_assignment") . ")"; + } } ! else { $aimgrade = ""; + } + $totalgrade = math_assignment_total_grade($math_assignment, $grade); $maxgrade = $math_assignment->papergrade + $math_assignment->aimgrade; $totalgrade = "$totalgrade / $maxgrade"; + // Don't show a total grade if there is an unpublished paper grade + if ($math_assignment->papergrade > 0 and !$math_assignment->papersheetsreturned) { + $totalgrade = ""; + } if ($course->format == "weeks" or $course->format == "topics") $row = array ($math_assignment->section, $link); *************** *** 188,191 **** --- 213,217 ---- } } + */ print_heading($strmath_assignments); Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** lib.php 31 Oct 2003 14:05:59 -0000 1.40 --- lib.php 2 Nov 2003 15:45:30 -0000 1.41 *************** *** 314,318 **** if($math_assignment->problems) { if (math_assignment_is_tex_file($math_assignment->problems)) ! $proburl = "pdfgen.php?id=$math_assignment->id&type=problems"; else if ($math_assignment->problemsisurl) $proburl = $math_assignment->problems; --- 314,318 ---- if($math_assignment->problems) { if (math_assignment_is_tex_file($math_assignment->problems)) ! $proburl = "$CFG->wwwroot/mod/math_assignment/pdfgen.php?id=$math_assignment->id&type=problems"; else if ($math_assignment->problemsisurl) $proburl = $math_assignment->problems; *************** *** 323,327 **** } else if ($math_assignment->aimquiz) ! $proburl = "pdfgen.php?id=$math_assignment->id&type=problems"; else $proburl = ""; --- 323,327 ---- } else if ($math_assignment->aimquiz) ! $proburl = "$CFG->wwwroot/mod/math_assignment/pdfgen.php?id=$math_assignment->id&type=problems"; else $proburl = ""; *************** *** 329,333 **** if($math_assignment->solutions) { if (math_assignment_is_tex_file($math_assignment->solutions)) ! $solurl = "pdfgen.php?id=$math_assignment->id&type=solutions"; else if ($math_assignment->solutionsisurl) $solurl = $math_assignment->solutions; --- 329,333 ---- if($math_assignment->solutions) { if (math_assignment_is_tex_file($math_assignment->solutions)) ! $solurl = "$CFG->wwwroot/mod/math_assignment/pdfgen.php?id=$math_assignment->id&type=solutions"; else if ($math_assignment->solutionsisurl) $solurl = $math_assignment->solutions; *************** *** 338,342 **** } else if ($math_assignment->aimquiz) ! $solurl = "pdfgen.php?id=$math_assignment->id&type=solutions"; else $solurl = ""; --- 338,342 ---- } else if ($math_assignment->aimquiz) ! $solurl = "$CFG->wwwroot/mod/math_assignment/pdfgen.php?id=$math_assignment->id&type=solutions"; else $solurl = ""; *************** *** 789,793 **** /// Funtion which returns the total grade given a grade object $grade = min(max($gradeobj->aimgrade, 0), $math_assignment->aimgrade); ! if ($math_assignment->papersheetreturned) { $grade += min(max($gradeobj->papergrade, 0), $math_assignment->papergrade); } --- 789,793 ---- /// Funtion which returns the total grade given a grade object $grade = min(max($gradeobj->aimgrade, 0), $math_assignment->aimgrade); ! if ($math_assignment->papersheetsreturned) { $grade += min(max($gradeobj->papergrade, 0), $math_assignment->papergrade); } *************** *** 872,876 **** break; } ! return $students; } --- 872,880 ---- break; } ! if (count($students) > 1) { ! return $students; ! } else { ! return false; ! } } *************** *** 989,992 **** --- 993,1191 ---- } + function math_assignment_gradestable($course, $userid, $showlinks='true') { + + global $CFG; + + $timenow = time(); + $strweek = get_string("week"); + $strtopic = get_string("topic"); + $strname = get_string("name"); + $strtimedue = get_string("timedue", "math_assignment"); + $strproblems = get_string("problemsbrief", "math_assignment"); + $strsolutions = get_string("solutionsbrief", "math_assignment"); + $strviewproblems = get_string("view", "math_assignment"); + $strviewsolutions = get_string("view", "math_assignment"); + $strpaper = get_string("paper", "math_assignment"); + $strcomputer = get_string("computer", "math_assignment"); + $strtotal = get_string("total"); + $strgrade = get_string("grade"); + $stropen = get_string("open", "math_assignment"); + + if (! $math_assignments = get_all_instances_in_course("math_assignment", $course)) { + return false; + } + + if (isteacher($course->id, $userid)) { + $teacher = true; + + // if ($CFG->math_assignment_aim_display == 0) + // $showaim = false; + // else if ($CFG->math_assignment_aim_display == 1) + // $showaim = isadmin(); + // else + // $showaim = true; + // + // if ($showaim) { + // $straimsubject = get_string("aimsubject", "math_assignment"); + // $strserver = get_string("aimserver", "math_assignment"); + // } + + if ($course->format == "weeks") { + $table->head = array ($strweek, $strname, $strtimedue, $strproblems, $strsolutions); + $table->align = array ("CENTER", "LEFT","LEFT","LEFT","LEFT"); + $table->width = array (10, "*","*","*","*"); + } else if ($course->format == "topics") { + $table->head = array ($strtopic, $strname, $strtimedue, $strproblems, $strsolutions); + $table->align = array ("CENTER", "LEFT","LEFT","LEFT","LEFT"); + $table->width = array (10, "*","*","*","*"); + } else { + $table->head = array ($strname, $strtimedue, $strproblems, $strsolutions); + $table->align = array ("LEFT","LEFT","LEFT","LEFT"); + $table->width = array ("*","*","*","*"); + } + if ($showaim) { + array_push($table->head, $straimsubject, $strserver); + array_push($table->align, "LEFT", "LEFT"); + array_push($table->width, "*", "*"); + } + } + else { + $teacher = false; + + if ($course->format == "weeks") { + $table->head = array ($strweek, $strname, $strtimedue, $strproblems, $strsolutions, "$strpaper $strgrade", "$strcomputer $strgrade", "$strtotal $strgrade"); + $table->align = array ("CENTER", "LEFT", "LEFT", "LEFT", "LEFT", "CENTER", "CENTER", "CENTER"); + $table->width = array (10, "*", "*", "*", "*", "*", "*", "*"); + } else if ($course->format == "topics") { + $table->head = array ($strtopic, $strname, $strtimedue, $strproblems, $strsolutions, "$strpaper $strgrade", "$strcomputer $strgrade", "$strtotal $strgrade"); + $table->align = array ("CENTER", "LEFT", "LEFT", "LEFT", "LEFT", "CENTER", "CENTER", "CENTER"); + $table->width = array (10, "*", "*", "*", "*", "*", "*", "*"); + } else { + $table->head = array ($strname, $strtimedue, $strproblems, $strsolutions, "$strpaper $strgrade", "$strcomputer $strgrade", "$strtotal $strgrade"); + $table->align = array ("LEFT", "LEFT", "LEFT", "LEFT", "CENTER", "CENTER", "CENTER"); + $table->width = array ("*", "*", "*", "*", "*", "*", "*"); + } + } + + foreach ($math_assignments as $math_assignment) { + + $link = "<b>$math_assignment->name</b>"; + if ($showlinks) { + $link = "<a href=\"$CFG->wwwroot/mod/math_assignment/view.php?id=$math_assignment->coursemodule\">$link</a>"; + } + if (!$math_assignment->visible) { + //Show dimmed if the mod is hidden + $link = "<span style=\"dimmed\">$link</span>"; + } + + math_assignment_get_file_urls($math_assignment, $proburl, $solurl); + $proburl = htmlspecialchars($proburl); + $solurl = htmlspecialchars($solurl); + if ($teacher) { // this is for teachers. They are not shown any grades + // if ($showaim && $math_assignment->aimquiz) { + // // lookup subject + // if (! $subject = get_record("math_assignment_subject", "course", $course->id)) { + // $subject->server = 0; + // $subject->name = "Unknown"; + // } + // // lookup server + // if (! $server = get_record("math_assignment_server", "id", $subject->server)) { + // $server->name = "Unknown"; + // $server->address = "unknown"; + // } + // } + if ($course->format == "weeks" or $course->format == "topics") { + $row = array ($math_assignment->section, $link); + } else { + $row = array ($link); + } + array_push($row, userdate($math_assignment->timedue, "", 99, false), $proburl ? "<a href=\"$proburl\" target=\"problems\">$strviewproblems</a>" : "", $solurl ? "<a href=\"$solurl\" target=\"solutions\">$strviewsolutions</a>" : ""); + // if ($showaim) { + // if ($math_assignment->aimquiz) + // array_push($row, $subject->name, "$server->name ($server->address)"); + // else + // array_push($row, "", ""); + // } + $table->data[] = $row; + } + else if ($math_assignment->visible) { // this is for students. They are shown grades + if (!$grade = get_record("math_assignment_grades", "assignment", $math_assignment->id, "userid", $userid)) { + $grade->papergrade = -1; + $grade->aimgrade = -1; + $grade->aimoverride = AIMOVR_OFF; + $grade->aimcomment = ""; + } + if ($math_assignment->papergrade > 0) { + if (!$math_assignment->papersheetsreturned) { + $papergrade = get_string("notpublished", "math_assignment"); + } else if ($grade->papergrade >= 0) { + $papergrade = "<b>$grade->papergrade / $math_assignment->papergrade</b>"; + } else if ($grade->papergrade = -1) { + $papergrade = "<b>-- / $math_assignment->papergrade</b>"; + } + if ($math_assignment->timedue > time()) { + $papergrade = $stropen; + } + } + else { + $papergrade = ""; + } + if ($math_assignment->aimgrade > 0) { + if ($grade->aimgrade >= 0) { + $aimgrade = "<b>$grade->aimgrade / $math_assignment->aimgrade</b>"; + } else { + $aimgrade = "<b>-- / $math_assignment->aimgrade</b>"; + } + // show aimgrade in grey if quiz has not closed yet + if ($math_assignment->timedue > time()) { + $aimgrade = "<span style=\"color: silver \">$aimgrade</span>"; + } + if ($grade->aimoverride > AIMOVR_RESET) { + $aimgrade .= " (" . get_string("gradeoverride", "math_assignment") . ")"; + } + } + else { + $aimgrade = ""; + } + + $totalgrade = math_assignment_total_grade($math_assignment, $grade); + $maxgrade = $math_assignment->papergrade + $math_assignment->aimgrade; + $totalgrade = "<b>$totalgrade / $maxgrade</b>"; + // Don't show a total grade if there is an unpublished paper grade + if ($math_assignment->timedue > time() or ($math_assignment->papergrade > 0 and !$math_assignment->papersheetsreturned)) { + $totalgrade = "<span style=\"color: silver \">$totalgrade</span>"; + } + if ($course->format == "weeks" or $course->format == "topics") + $row = array ($math_assignment->section, $link); + else + $row = array ($link); + + // show links to the solutions only after the due date + if ($solurl) { + if ($timenow > $math_assignment->timedue) + $solutions = "<a href=\"$solurl\" target=\"solutions\">$strviewsolutions</a>"; + else + $solutions = ""; + } + else + $solutions = ""; + + array_push($row, userdate($math_assignment->timedue, "", 99, false), $proburl ? "<a href=\"$proburl\" target=\"problems\">$strviewproblems</a>" : "", $solutions, $papergrade, $aimgrade, $totalgrade); + $table->data[] = $row; + } + } + if (count($table->data) > 1) { + return $table; + } else { + return false; + } + } + + //////////////////////////////////////////////////////////////////////////////////// + // + // The following functions are general purpose functions not specific to this module + // + + function str_replace_once($needle, $replace, $haystack) { // Looks for the first occurence of $needle in $haystack *************** *** 1034,1037 **** --- 1233,1237 ---- } } + ?> Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** pdfgen.php 31 Oct 2003 14:05:59 -0000 1.21 --- pdfgen.php 2 Nov 2003 15:45:30 -0000 1.22 *************** *** 10,14 **** optional_variable($printcopies); // number of randomized copies to send to printer optional_variable($seed, 0); // seed to be passed to AiM. 0 means no seed set. ! // This may be overruled by the student's saved seed. global $USER; --- 10,14 ---- optional_variable($printcopies); // number of randomized copies to send to printer optional_variable($seed, 0); // seed to be passed to AiM. 0 means no seed set. ! // This may be overruled by the student's saved seed. global $USER; *************** *** 25,43 **** } ! require_login($course->id); ! if (!isstudent($course->id) and !isteacher($course->id)) { error("Sorry, this assignment is not for you!"); } add_to_log($course->id, "math_assignment", "pdfgen", "pdfgen.php?id=$math_assignment->id", $type); - // check that the request is valid - if ($solutions) { - if (time() < $math_assignment->solutiontime and !isteacher($course->id)) { - error("You can not view the solutions yet!"); - } - } - if ($math_assignment->aimquiz) { --- 25,42 ---- } ! require_login(); ! // have to be a student on this course or a teacher on any course to view this page ! if (!isstudent($course->id) and !record_exists("user_teachers", "userid", $USER->id)) { error("Sorry, this assignment is not for you!"); } + + // make sure students don't look at solutions before they should + if (($type == "solutions") and isstudent($course->id) and $math_assignment->solutiontime > time()){ + error("You can not view the solutions yet!"); + } add_to_log($course->id, "math_assignment", "pdfgen", "pdfgen.php?id=$math_assignment->id", $type); if ($math_assignment->aimquiz) { *************** *** 125,129 **** // tell the browser that it is pdf header("Content-type: application/pdf"); ! if ($solutions) header("Content-disposition: inline; filename=solutions.pdf"); else --- 124,128 ---- // tell the browser that it is pdf header("Content-type: application/pdf"); ! if ($type = "solutions") header("Content-disposition: inline; filename=solutions.pdf"); else *************** *** 134,138 **** } */ ! //error("Problem and solution sheets are temporarily unavailable. You can however still view the AiM assignment."); } --- 133,140 ---- } */ ! error("<p>Problem and solution sheets are temporarily unavailable. You can however still view the AiM assignment.</p> ! <p>Unfortunately the machine that was supposed to automatically ! generate these sheets has had a hard disk failure. If you did not receive a copy of the problem sheet during the lectures ! please send an email to <a href=\"mailto:gw...@yo...\">gw...@yo...</a>. I may be able to email you the pdf file. </p>"); } *************** *** 171,175 **** // attempt to register them automatically if (!math_assignment_register_with_aim($server, $subject)) { ! error(get_string("nooutput", "math_assignment"), "view.php?id=$cm->id"); } // retry --- 173,177 ---- // attempt to register them automatically if (!math_assignment_register_with_aim($server, $subject)) { ! error(get_string("nooutput", "math_assignment"), "view.php?id=$cm->id"); } // retry *************** *** 205,209 **** } } ! else if ($type == solutions) { if ($math_assignment->solutionsisurl) { $texfile = $math_assignment->solutions; --- 207,211 ---- } } ! else if ($type == "solutions") { if ($math_assignment->solutionsisurl) { $texfile = $math_assignment->solutions; Index: view.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/view.php,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** view.php 31 Oct 2003 14:05:59 -0000 1.21 --- view.php 2 Nov 2003 15:45:30 -0000 1.22 *************** *** 76,79 **** --- 76,81 ---- $strgrades = get_string("grades"); $strreview = get_string("review", "math_assignment"); + $strshowgradestable = get_string("showgradestable", "math_assignment"); + $strhidegradestable = get_string("hidegradestable", "math_assignment"); if ($course->category) { *************** *** 325,331 **** echo math_assignment_get_admin_links($cm, $math_assignment, $zonelink, "center"); if ($showgrades) { ! echo "<center><a href=\"view.php?id=$cm->id\">Hide grades table</a></center>"; } else { ! echo "<center><a href=\"view.php?id=$cm->id&showgrades=true\">Show Grades table</a></center>"; } } --- 327,333 ---- echo math_assignment_get_admin_links($cm, $math_assignment, $zonelink, "center"); if ($showgrades) { ! echo "<center><a href=\"view.php?id=$cm->id\">$strhidegradestable</a></center>"; } else { ! echo "<center><a href=\"view.php?id=$cm->id&showgrades=true\">$strshowgradestable</a></center>"; } } *************** *** 418,422 **** echo "<center>The grades have not yet been finalized</center>"; } ! if (!$math_assignment->papersheetsreturned and !empty($USER->teacheredit[$course->id])) { echo "<table border=\"0\" align=\"center\"><tr><td>"; $options = array("id"=>$cm->id); --- 420,424 ---- echo "<center>The grades have not yet been finalized</center>"; } ! if (!$math_assignment->papersheetsreturned and (!empty($USER->teacheredit[$course->id]) or isadmin())) { echo "<table border=\"0\" align=\"center\"><tr><td>"; $options = array("id"=>$cm->id); |
From: <gus...@us...> - 2003-11-02 01:30:45
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv8717/WEB-INF/maple/aim Modified Files: Test.mpl Log Message: Fixed `aim/TestSet` and `aim/TestNumericSet` by converting sets to lists and sorting them before testing Index: Test.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Test.mpl,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Test.mpl 19 Sep 2003 20:13:19 -0000 1.6 --- Test.mpl 2 Nov 2003 01:30:39 -0000 1.7 *************** *** 116,120 **** `Package/Assign`( `aim/TestExtended_numeric`::boolean, ! "Returns @`aim/TestNumeric`(ans,rightans)@ if @ans@ and @rightans@ are both @numeric@, otherwise it returns @`aim/TestEqual`(ans,rightans)@. This allows the @ans@ and @rightans@ to be one of @{infinity,-infinity,undefined}@ ", proc(ans::anything, --- 116,123 ---- `Package/Assign`( `aim/TestExtended_numeric`::boolean, ! "Returns @`aim/TestNumeric`(ans,rightans)@ if @ans@ and @rightans@ are ! both @numeric@, otherwise it returns @`aim/TestEqual`(ans,rightans)@. ! This allows the @ans@ and @rightans@ to be one of ! @{infinity,-infinity,undefined}@ ", proc(ans::anything, *************** *** 389,421 **** ###################################################################### - # Test whether ans is equal to the set rightans. - # By default, this just compares entries using ans[i] = rightans[i]. - # If a third argument 'testproc' is supplied, it instead compares - # entries using testproc(ans[i],rightans[i]). `Package/Assign`( `aim/TestSet`::boolean, ! "", proc(ans,rightans::set, # optional testproc_) ! local i,testproc; ! ! if nargs > 2 then ! testproc := eval(testproc_); ! else ! testproc := eval(`aim/TestEqual`); ! fi; ! ! if type([ans],[set]) and nops(ans) = nops(rightans) then ! for i from 1 to nops(rightans) do ! if evalb(testproc(ans[i],rightans[i])) <> true then ! RETURN(false); ! fi; ! od; ! RETURN(true); else ! # ans is not a set of the right length ! RETURN(false); fi; end --- 392,407 ---- ###################################################################### `Package/Assign`( `aim/TestSet`::boolean, ! "Test whether @ans@ is equal to the set @rightans@. ! Do this by converting them to lists, sorting them and then call @`aim/TestList`@", proc(ans,rightans::set, # optional testproc_) ! if (nargs = 2) then ! `aim/TestList`(sort(convert(ans,list)),sort(convert(rightans,list))); else ! `aim/TestList`(sort(convert(ans,list)),sort(convert(rightans,list)),testproc_); fi; end *************** *** 424,443 **** ###################################################################### - ###TODO: this is not robust, and may not be useful `Package/Assign`( `aim/TestNumericSet`, ! "", proc(ans::anything, rightans::set(numeric), # optional marginspec_::`aim/Test/MarginSpecification`) - global MARGINSPEC; - if (nargs = 2) then ! `aim/TestSet`(ans,rightans,`aim/TestNumeric`); else ! `aim/TestSet`(ans,rightans, ! subs(MARGINSPEC = marginspec_, ! (a,b) -> `aim/TestNumeric`(a,b,MARGINSPEC))); fi; end --- 410,425 ---- ###################################################################### `Package/Assign`( `aim/TestNumericSet`, ! "Test whether @ans@ is equal to the set @rightans@. ! Do this by converting them to lists, sorting them and then calling @`aim/TestNumericList`@", proc(ans::anything, rightans::set(numeric), # optional marginspec_::`aim/Test/MarginSpecification`) if (nargs = 2) then ! `aim/TestNumericList`(sort(convert(ans,list)),sort(convert(rightans,list))); else ! `aim/TestNumericList`(sort(convert(ans,list)),sort(convert(rightans,list)),marginspec_); fi; end |
From: <bre...@us...> - 2003-11-01 04:14:08
|
Update of /cvsroot/aimmath/AIM/bin/tth_exe/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv3921/OSX Log Message: Directory /cvsroot/aimmath/AIM/bin/tth_exe/OSX added to the repository |