Update of /cvsroot/aimmath/moodle/mod/math_assignment
In directory sc8-pr-cvs1:/tmp/cvs-serv6453/mod/math_assignment
Modified Files:
aimpage.php lib.php pdfgen.php setseed.php view.php
Log Message:
inputting the ID numbers of randomized problem sheets is now working.
Index: aimpage.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/aimpage.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** aimpage.php 2 Oct 2003 19:42:15 -0000 1.15
--- aimpage.php 20 Oct 2003 03:02:55 -0000 1.16
***************
*** 49,59 ****
}
}
-
- require_login($course->id);
-
- add_to_log($course->id, "math_assignment", "aimpage", "aimpage.php?id=$cm->id", "$math_assignment->id");
-
- // Process arguments
-
if (!$subject = get_record("math_assignment_subject", "course", $course->id)) {
error(get_string("noaccess", "math_assignment"));
--- 49,52 ----
***************
*** 62,65 ****
--- 55,64 ----
error(get_string("noaccess", "math_assignment"));
}
+
+ require_login($course->id);
+
+ add_to_log($course->id, "math_assignment", "aimpage", "aimpage.php?id=$cm->id", "$math_assignment->id");
+
+ // Process arguments
// browse through the data which has been POSTed to us
***************
*** 79,82 ****
--- 78,82 ----
$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 (strcasecmp($aimaction, "source") == 0) { // load the edit source page
***************
*** 106,110 ****
$postdata = math_assignment_add_arg_to_url_data($postdata, "SubjectName", $subject->name);
}
! else {
// default to show quiz page
$postdata = math_assignment_add_arg_to_url_data($postdata, "Command", "ShowQuizPage");
--- 106,131 ----
$postdata = math_assignment_add_arg_to_url_data($postdata, "SubjectName", $subject->name);
}
! else { // user is student
! // 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
! if ($course->category) {
! $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
! }
! else
! $navigation = "";
! $strmath_assignments = get_string("modulenameplural", "math_assignment");
! $strmath_assignment = get_string("modulename", "math_assignment");
! $straimpage = get_string("aimpage", "math_assignment");
! print_header("$course->shortname: $math_assignment->name", "$course->fullname",
! "$navigation <a href=\"index.php?id=$course->id\">$strmath_assignments</a> -> <a href=\"view.php?id=$cm->id\">$math_assignment->name</a> -> $straimpage",
! "", "", true, update_module_button($cm->id, $course->id, $strmath_assignment), navmenu($course, $cm), $usexml);
! include("seed.html");
! die;
! }
! }
!
// default to show quiz page
$postdata = math_assignment_add_arg_to_url_data($postdata, "Command", "ShowQuizPage");
***************
*** 133,141 ****
if (array_key_exists("outputchange", $_POST) && array_key_exists("postdata", $_POST)) {
if (strcmp($_POST['outputchange'], "html") == 0 || strcmp($_POST['outputchange'], "xml") == 0) {
! // set the cookie
! setcookie("output", $_POST['outputchange'], 0x7FFFFFFF);
! $_COOKIE['output'] = $_POST['outputchange'];
! $postdata = $_POST['postdata'];
! $_POST = array();
}
}
--- 154,162 ----
if (array_key_exists("outputchange", $_POST) && array_key_exists("postdata", $_POST)) {
if (strcmp($_POST['outputchange'], "html") == 0 || strcmp($_POST['outputchange'], "xml") == 0) {
! // set the cookie
! setcookie("output", $_POST['outputchange'], 0x7FFFFFFF);
! $_COOKIE['output'] = $_POST['outputchange'];
! $postdata = $_POST['postdata'];
! $_POST = array();
}
}
Index: lib.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** lib.php 19 Oct 2003 10:01:43 -0000 1.37
--- lib.php 20 Oct 2003 03:02:56 -0000 1.38
***************
*** 320,324 ****
$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())) {
--- 320,324 ----
$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())) {
***************
*** 331,335 ****
$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)) {
--- 331,335 ----
$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)) {
***************
*** 416,420 ****
else
$data .= "&" . urlencode($item);
! if ($value)
$data .= "=" . urlencode($value);
}
--- 416,420 ----
else
$data .= "&" . urlencode($item);
! if ($value <> "")
$data .= "=" . urlencode($value);
}
***************
*** 686,691 ****
// find the row which gives the totals
if (preg_match("/<td(?:\s[^<>]*?|)>Total<\/td>(?:.(?!<td\s|<td>))*.?<td(?:\s[^<>]*?|)>((?:.(?!<\/td>))*?.?)<\/td>(?:.(?!<td\s|<td>))*.?<td(?:\s[^<>]*?|)>((?:.(?!<\/td>))*?.?)<\/td>/si", $data, $matches)) {
! if (empty($CFG->math_assignment_grade_multiplier))
! $CFG->math_assignment_grade_multiplier = 1.0;
$max_grade = (int) (((float) decodeHTML($matches[1])) * ((float) $CFG->math_assignment_grade_multiplier));
$grade = (int) (((float) decodeHTML($matches[2])) * ((float) $CFG->math_assignment_grade_multiplier));
--- 686,691 ----
// find the row which gives the totals
if (preg_match("/<td(?:\s[^<>]*?|)>Total<\/td>(?:.(?!<td\s|<td>))*.?<td(?:\s[^<>]*?|)>((?:.(?!<\/td>))*?.?)<\/td>(?:.(?!<td\s|<td>))*.?<td(?:\s[^<>]*?|)>((?:.(?!<\/td>))*?.?)<\/td>/si", $data, $matches)) {
! if (empty($CFG->math_assignment_grade_multiplier))
! $CFG->math_assignment_grade_multiplier = 1.0;
$max_grade = (int) (((float) decodeHTML($matches[1])) * ((float) $CFG->math_assignment_grade_multiplier));
$grade = (int) (((float) decodeHTML($matches[2])) * ((float) $CFG->math_assignment_grade_multiplier));
Index: pdfgen.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** pdfgen.php 19 Oct 2003 10:01:44 -0000 1.19
--- pdfgen.php 20 Oct 2003 03:02:56 -0000 1.20
***************
*** 10,13 ****
--- 10,15 ----
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;
if (! $site = get_site()) {
***************
*** 47,50 ****
--- 49,76 ----
}
}
+
+ // 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
+ if ($course->category) {
+ $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
+ }
+ else
+ $navigation = "";
+ $strmath_assignments = get_string("modulenameplural", "math_assignment");
+ $strmath_assignment = get_string("modulename", "math_assignment");
+ $straimpage = get_string("showsheet", "math_assignment");
+ print_header("$course->shortname: $math_assignment->name", "$course->fullname",
+ "$navigation <a href=\"index.php?id=$course->id\">$strmath_assignments</a> -> <a href=\"view.php?id=$cm->id\">$math_assignment->name</a> -> $straimpage",
+ "", "", true, update_module_button($cm->id, $course->id, $strmath_assignment), navmenu($course, $cm), $usexml);
+ include("seed.html");
+ die;
+ } else {
+ $seed = $seeddata->seed;
+ }
+ }
+
// Create temp file names
***************
*** 74,79 ****
}
math_assignment_generate_pdf($math_assignment, $course, $subject, $server, $type, "$tempfile$i", $newseed->seed);
! echo exec("gsview32 -p prmaths1.york.ac.uk $tempfile$i.pdf");
! echo "Sheet sent to gsview";
}
}
--- 100,108 ----
}
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>";
}
}
***************
*** 92,97 ****
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");
--- 121,129 ----
go by the extension when it ignores the headers. This would need testing in a broken version of IE. */
+ /* This occasionally has hanged in the past and if it happens again I will have to use redirect
+ even though that has the disadvantage of not
+ deleting the pdf file afterwards.
+ */
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");
***************
*** 104,119 ****
@fclose($file);
}
! else {
! $errlog = htmlentities(implode('', file("$tempfile.log")));
! }
}
@unlink("$tempfile.pdf");
! if (strlen($errlog) > 0) {
! error("There was a problem while compiling the tex source!<br>
! pdflatex wrote the following log file:<br><br>
! <pre>$errlog</pre>"); // error message
! }
--- 136,148 ----
@fclose($file);
}
!
! /*
! redirect("$tempfile.pdf");
! */
}
@unlink("$tempfile.pdf");
!
***************
*** 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
--- 176,180 ----
// 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
***************
*** 233,237 ****
$texcommand = "pdftex";
}
!
// for Unix work in temp directory
if (strpos($_ENV["OS"], "Win") === false) {
--- 262,266 ----
$texcommand = "pdftex";
}
!
// for Unix work in temp directory
if (strpos($_ENV["OS"], "Win") === false) {
***************
*** 243,246 ****
--- 272,283 ----
exec("$texcommand $tempfile.tex");
}
+
+ 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");
Index: setseed.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/setseed.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** setseed.php 8 Oct 2003 19:49:41 -0000 1.1
--- setseed.php 20 Oct 2003 03:02:56 -0000 1.2
***************
*** 5,12 ****
require_once("../../config.php");
require_variable($sheetid);
require_variable($assignment);
! require_variable($student);
if (! $math_assignment = get_record("math_assignment", "id", $assignment)) {
--- 5,14 ----
require_once("../../config.php");
+ require_once("lib.php");
require_variable($sheetid);
require_variable($assignment);
! global $USER;
! $student = $USER->id;
if (! $math_assignment = get_record("math_assignment", "id", $assignment)) {
***************
*** 18,21 ****
--- 20,31 ----
}
+ 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");
+ }
+
require_login();
***************
*** 29,55 ****
error("Sorry, you shouldn't be on this page!");
}
!
! if ($seed = get_record("math_assignment_seed", "assignment", $assignment, "student", $student)) {
! error("You already entered an ID for this assignment.");
! }
!
print_header("$course->shortname: $math_assignment->name", "$course->fullname",
"$navigation <a href=\"index.php?id=$course->id\">$strmath_assignments</a> -> $math_assignment->name",
"", "", true, update_module_button($cm->id, $course->id, $strmath_assignment), navmenu($course, $cm));
!
! if (!$seed = get_record("math_assignment_seed", "assignment", $assignment, "seed", $sheetid)) {
! // The ID number does not exist
! notice(get_string("idinvalid", "math_assignment"));
}
!
! // ID number is valid
! if (isset($seed->student)) {
! // but this ID number was already entered by a
! // different student
! notice(get_string("idtaken", "math_assignment"));
}
// Everything is o.k., so assign seed to student
! set_field($math_assignment_seed, "student", $student, "assignment", $assignment, "seed", $sheetid);
redirect($_SERVER["HTTP_REFERER"]);
--- 39,108 ----
error("Sorry, you shouldn't be on this page!");
}
!
print_header("$course->shortname: $math_assignment->name", "$course->fullname",
"$navigation <a href=\"index.php?id=$course->id\">$strmath_assignments</a> -> $math_assignment->name",
"", "", 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
! 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
! notice(get_string("idtaken", "math_assignment", $sheetid));
! }
}
// 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");
! }
!
! // request quiz page once to set seed on AiM
! $postdata = "";
! $postdata = math_assignment_add_arg_to_url_data($postdata, "Command", "ShowQuizPage");
! $postdata = math_assignment_add_arg_to_url_data($postdata, "SubjectName", $subject->name);
! $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz);
! $postdata = math_assignment_add_arg_to_url_data($postdata, "StudentID", $USER->username);
! $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password);
! $postdata = math_assignment_add_arg_to_url_data($postdata, "SeedPassword", $subject->password);
! $postdata = math_assignment_add_arg_to_url_data($postdata, "Seed", $sheetid);
!
! // load the AiM page and grab the result
! $data = math_assignment_get_aim_output($server->address, $postdata, "html");
!
! // check if we need to sooth any AiM grumbles
! $error = math_assignment_check_aim_output($data);
! if ($error == 1) { // user not registered
! if ($CFG->math_assignment_auto_register) {
! // 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
! $data = math_assignment_get_aim_output($server->address, $postdata, "html");
! }
! }
!
redirect($_SERVER["HTTP_REFERER"]);
Index: view.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/view.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** view.php 8 Oct 2003 19:49:41 -0000 1.19
--- view.php 20 Oct 2003 03:02:56 -0000 1.20
***************
*** 13,18 ****
optional_variable($sort, "lastname"); // column to sort
optional_variable($sortdir, "asc"); // direction to sort
-
- global $USER;
if (! $site = get_site()) {
--- 13,16 ----
***************
*** 85,89 ****
if (strcasecmp($sort, "firstname") != 0) { // to improve speed
if (strcasecmp($sort, "totalgrade") != 0)
! $sort = "lastname"; // not valid so use default instead
}
}
--- 83,87 ----
if (strcasecmp($sort, "firstname") != 0) { // to improve speed
if (strcasecmp($sort, "totalgrade") != 0)
! $sort = "lastname"; // not valid so use default instead
}
}
***************
*** 151,161 ****
if ($hasboth) {
if ($student->papergrade >= 0)
! $myxls->InsertNumber($student->papergrade);
else
! $myxls->InsertText("");
if ($student->aimgrade >= 0)
! $myxls->InsertNumber($student->aimgrade);
else
! $myxls->InsertText("");
}
$myxls->InsertNumber($student->totalgrade);
--- 149,159 ----
if ($hasboth) {
if ($student->papergrade >= 0)
! $myxls->InsertNumber($student->papergrade);
else
! $myxls->InsertText("");
if ($student->aimgrade >= 0)
! $myxls->InsertNumber($student->aimgrade);
else
! $myxls->InsertText("");
}
$myxls->InsertNumber($student->totalgrade);
***************
*** 187,194 ****
if ($hasboth) {
if ($student->papergrade >= 0)
! echo "$student->papergrade";
echo "\t";
if ($student->aimgrade >= 0)
! echo "$student->aimgrade";
echo "\t";
}
--- 185,192 ----
if ($hasboth) {
if ($student->papergrade >= 0)
! echo "$student->papergrade";
echo "\t";
if ($student->aimgrade >= 0)
! echo "$student->aimgrade";
echo "\t";
}
***************
*** 229,237 ****
echo "<td>";
if ($student->aimgrade >= 0)
! echo $student->aimgrade;
else echo " ";
echo "</td><td>";
if ($student->papergrade >= 0)
! echo $student->papergrade;
else echo " ";
echo "</td>";
--- 227,235 ----
echo "<td>";
if ($student->aimgrade >= 0)
! echo $student->aimgrade;
else echo " ";
echo "</td><td>";
if ($student->papergrade >= 0)
! echo $student->papergrade;
else echo " ";
echo "</td>";
***************
*** 240,244 ****
echo "<td>";
if ($student->totalgrade > 0)
! echo $student->totalgrade;
else echo " ";
echo "</td>";
--- 238,242 ----
echo "<td>";
if ($student->totalgrade > 0)
! echo $student->totalgrade;
else echo " ";
echo "</td>";
***************
*** 279,287 ****
}
if ($haspaper) {
! echo "<b>$strpaper $strgrade :</b> ";
if ($grade->papergrade >= 0)
! echo "$grade->papergrade / $math_assignment->papergrade";
else
! print_string("notmarked", "math_assignment");
echo "<br />";
}
--- 277,287 ----
}
if ($haspaper) {
! echo "<b>";
! if ($hasaim) echo "$strpaper ";
! echo "$strgrade :</b> ";
if ($grade->papergrade >= 0)
! echo "$grade->papergrade / $math_assignment->papergrade";
else
! print_string("notmarked", "math_assignment");
echo "<br />";
}
***************
*** 289,304 ****
echo "<b>$strcomputer $strgrade :</b> ";
if ($grade->aimgrade >= 0)
! echo "$grade->aimgrade / $math_assignment->aimgrade";
else
! print_string("notattempted", "math_assignment");
if ($grade->aimoverride > AIMOVR_RESET) {
! echo " (";
! print_string("gradeoverride", "math_assignment");
! echo ")";
}
echo "<br />";
if ($grade->aimcomment)
! echo "<b>" . $course->teacher . " " . get_string("comment", "math_assignment") .
! ":</b> " . nl2br(htmlspecialchars($grade->aimcomment)) . "<br />";
}
if ($hasboth) {
--- 289,304 ----
echo "<b>$strcomputer $strgrade :</b> ";
if ($grade->aimgrade >= 0)
! echo "$grade->aimgrade / $math_assignment->aimgrade";
else
! print_string("notattempted", "math_assignment");
if ($grade->aimoverride > AIMOVR_RESET) {
! echo " (";
! print_string("gradeoverride", "math_assignment");
! echo ")";
}
echo "<br />";
if ($grade->aimcomment)
! echo "<b>" . $course->teacher . " " . get_string("comment", "math_assignment") .
! ":</b> " . nl2br(htmlspecialchars($grade->aimcomment)) . "<br />";
}
if ($hasboth) {
***************
*** 306,312 ****
echo "<b>$strtotal $strgrade :</b> ";
if ($totalgrade >= 0)
! echo " $totalgrade / $totalmax";
else
! print_string("notmarked", "math_assignment");
}
}
--- 306,312 ----
echo "<b>$strtotal $strgrade :</b> ";
if ($totalgrade >= 0)
! echo " $totalgrade / $totalmax";
else
! print_string("notmarked", "math_assignment");
}
}
***************
*** 318,322 ****
if ($subject = get_record("math_assignment_subject", "course", $course->id)) {
if ($server = get_record("math_assignment_server", "id", $subject->server))
! $zonelink = $server->password;
}
echo math_assignment_get_admin_links($cm, $math_assignment, $zonelink, "right");
--- 318,322 ----
if ($subject = get_record("math_assignment_subject", "course", $course->id)) {
if ($server = get_record("math_assignment_server", "id", $subject->server))
! $zonelink = $server->password;
}
echo math_assignment_get_admin_links($cm, $math_assignment, $zonelink, "right");
***************
*** 344,390 ****
$picture = print_user_picture($student->userid, $course->id, $student->picture, false, true);
if ($student->papergrade >= 0)
! $papergrade = $student->papergrade;
else
! $papergrade = "";
$papergrade = "<input type=\"text\" name=\"$student->userid\" size=\"10\" maxlength=\"10\" value=\"$papergrade\" tabindex=\"$i\" />";
if ($student->aimgrade >= 0)
! $aimgrade = $student->aimgrade;
else
! $aimgrade = "";
if ($student->aimoverride > AIMOVR_RESET) {
! $edited = "$stredited (";
! $editedclose = ")";
}
else if ($student->aimcomment) {
! $edited = "$strcommented (";
! $editedclose = ")";
}
else {
! $edited = "";
! $editedclose = "";
}
$email = "<a href=\"mailto:$student->email\">";
if ($CFG->math_assignment_default_email_host) {
! if (preg_match("/^(.*)@(.*)$/", $student->email, $matches)) {
! if (strcmp($matches[2], $CFG->math_assignment_default_email_host) == 0)
! $email .= "$matches[1]</a>";
! else
! $email .= "$student->email</a>";
! }
! else
! $email .= "$student->email</a>";
}
else
! $email .= "$student->email</a>";
if ($hasboth)
! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, $papergrade,
! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->userid\">$stredit</a>$editedclose", $student->totalgrade);
else if ($haspaper)
! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, $papergrade);
else if ($hasaim)
! $table->data[] = array($picture, $student->firstname, $student->lastname, $email,
! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->userid\">$stredit</a>$editedclose");
$i++;
--- 344,390 ----
$picture = print_user_picture($student->userid, $course->id, $student->picture, false, true);
if ($student->papergrade >= 0)
! $papergrade = $student->papergrade;
else
! $papergrade = "";
$papergrade = "<input type=\"text\" name=\"$student->userid\" size=\"10\" maxlength=\"10\" value=\"$papergrade\" tabindex=\"$i\" />";
if ($student->aimgrade >= 0)
! $aimgrade = $student->aimgrade;
else
! $aimgrade = "";
if ($student->aimoverride > AIMOVR_RESET) {
! $edited = "$stredited (";
! $editedclose = ")";
}
else if ($student->aimcomment) {
! $edited = "$strcommented (";
! $editedclose = ")";
}
else {
! $edited = "";
! $editedclose = "";
}
$email = "<a href=\"mailto:$student->email\">";
if ($CFG->math_assignment_default_email_host) {
! if (preg_match("/^(.*)@(.*)$/", $student->email, $matches)) {
! if (strcmp($matches[2], $CFG->math_assignment_default_email_host) == 0)
! $email .= "$matches[1]</a>";
! else
! $email .= "$student->email</a>";
! }
! else
! $email .= "$student->email</a>";
}
else
! $email .= "$student->email</a>";
if ($hasboth)
! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, $papergrade,
! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->userid\">$stredit</a>$editedclose", $student->totalgrade);
else if ($haspaper)
! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, $papergrade);
else if ($hasaim)
! $table->data[] = array($picture, $student->firstname, $student->lastname, $email,
! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->userid\">$stredit</a>$editedclose");
$i++;
***************
*** 407,414 ****
echo "</td></tr></table></form>\n";
if (!$math_assignment->papersheetsreturned) {
! echo "<table border=\"0\" align=\"center\"><tr><td>";
! $options = array("id"=>$cm->id);
! print_single_button("email.php", $options, get_string("emailstudents", "math_assignment"));
! echo "</td></tr></table>\n";
}
}
--- 407,414 ----
echo "</td></tr></table></form>\n";
if (!$math_assignment->papersheetsreturned) {
! echo "<table border=\"0\" align=\"center\"><tr><td>";
! $options = array("id"=>$cm->id);
! print_single_button("email.php", $options, get_string("emailstudents", "math_assignment"));
! echo "</td></tr></table>\n";
}
}
***************
*** 436,460 ****
}
}
! else { // This is for the student
! // First get seed
! if (!$seed = get_record("math_assignment_seed", "assignment", $math_assignment->id, "student", $USER->id)) {
! // No seed set yet, so ask the student
! 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=\"hidden\" name=\"student\" value=\"$USER->id\" />\n";
! echo "<input type=\"submit\" value=\"Submit\"><br />";
! }
! else {
! echo math_assignment_get_file_links($math_assignment, "center");
! if ($hasaim) {
! if ($grade->aimoverride > AIMOVR_RESET) {
! echo "<p align=\"center\">";
! print_string("gradeoverridemsg", "math_assignment");
! echo "</p>";
! }
! echo "<p align=\"center\"><a href=\"aimpage.php?id=$cm->id\">" . get_string("viewquiz", "math_assignment") . "</a></p>";
}
}
}
--- 436,448 ----
}
}
! else {
! echo math_assignment_get_file_links($math_assignment, "center");
! if ($hasaim) {
! if ($grade->aimoverride > AIMOVR_RESET) {
! echo "<p align=\"center\">";
! print_string("gradeoverridemsg", "math_assignment");
! echo "</p>";
}
+ echo "<p align=\"center\"><a href=\"aimpage.php?id=$cm->id\">" . get_string("viewquiz", "math_assignment") . "</a></p>";
}
}
|