Update of /cvsroot/aimmath/moodle/mod/math_assignment
In directory sc8-pr-cvs1:/tmp/cvs-serv15495/mod/math_assignment
Modified Files:
lib.php mod.html pdfgen.php
Log Message:
minor tweaks including drop-down list with all AiM quizzes on mod.html
Index: lib.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** lib.php 5 Oct 2003 22:54:16 -0000 1.36
--- lib.php 19 Oct 2003 10:01:43 -0000 1.37
***************
*** 1,5 ****
<?PHP // $Id$
! @include_once("../../lib/t2mml/edit.php"); // TeX to MathML converter script
/// Library of functions and constants for module math_assignment
--- 1,5 ----
<?PHP // $Id$
! //@include_once("../../lib/t2mml/edit.php"); // TeX to MathML converter script
/// Library of functions and constants for module math_assignment
***************
*** 502,505 ****
--- 502,525 ----
echo "//done hiding --></script>\n";
return true;
+ }
+
+ function math_assignment_quizlist($course) {
+ /// 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 = "";
+ $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, "SubjectName", $subject->name);
+ $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password);
+ // load the AiM page and grab the result
+ $data = math_assignment_get_aim_output($server->address, $postdata, "html");
+
+ preg_match_all("/\\<td align=\"left\"\\>([^<].+)?\\<\/td\\>/", $data, $quizzes);
+
+ return $quizzes[1];
+
}
Index: mod.html
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/mod.html,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** mod.html 5 Oct 2003 22:54:16 -0000 1.23
--- mod.html 19 Oct 2003 10:01:44 -0000 1.24
***************
*** 31,35 ****
}
if (!isset($form->aimquiz)) {
! $form->aimquiz = "";
}
if (!isset($form->aimfocus)) {
--- 31,35 ----
}
if (!isset($form->aimquiz)) {
! $form->aimquiz = "None";
}
if (!isset($form->aimfocus)) {
***************
*** 49,52 ****
--- 49,54 ----
}
// Now we set the defaults
+ if ($form->aimquiz == "") $form->aimquiz = "None";
+
if (!$form->name)
$form->name = get_string("modulename", "math_assignment") . ($form->section ? " $form->section" : "");
***************
*** 133,137 ****
print_date_selector("dueday", "duemonth", "dueyear", $form->timedue);
echo " - ";
! print_time_selector("duehour", "dueminute", $form->timedue, 5);
helpbutton("addupdate_timedue", $strtimedue, "math_assignment");
?></td>
--- 135,139 ----
print_date_selector("dueday", "duemonth", "dueyear", $form->timedue);
echo " - ";
! print_time_selector("duehour", "dueminute", $form->timedue, 15);
helpbutton("addupdate_timedue", $strtimedue, "math_assignment");
?></td>
***************
*** 206,210 ****
</td>
<td>
! <?php choose_from_menu ($options, "solutions", $form->solutions,
$strnone, "sheet_change('solutions', 'list');", ""); ?>
<?php if (math_assignment_is_tex_file("$rootdir/$form->solutions")) {
--- 208,212 ----
</td>
<td>
! <?php choose_from_menu($options, "solutions", $form->solutions,
$strnone, "sheet_change('solutions', 'list');", ""); ?>
<?php if (math_assignment_is_tex_file("$rootdir/$form->solutions")) {
***************
*** 239,243 ****
<td align="right"><p><b><?php echo $strsolutiontime; ?>:</b></td>
<td><?php
! print_time_selector("solutionhour", "solutionminute", $form->solutiontime, 5);
helpbutton("addupdate_solutiontime", $strsolutiontime, "math_assignment");
?></td>
--- 241,245 ----
<td align="right"><p><b><?php echo $strsolutiontime; ?>:</b></td>
<td><?php
! print_time_selector("solutionhour", "solutionminute", $form->solutiontime, 15);
helpbutton("addupdate_solutiontime", $strsolutiontime, "math_assignment");
?></td>
***************
*** 272,280 ****
<td align="right"><p><b><?php echo $straimquiz; ?>:</b></p></td>
<td>
! <input type="text" name="aimquiz" size="40" maxlength="255" value="<?php p($form->aimquiz); ?>" />
! <?php
! helpbutton("addupdate_quiz", $straimquiz, "math_assignment");
! echo "<a href=\"$CFG->wwwroot/mod/math_assignment/subjectpage.php?id=$form->course\"
! target=\"subject\">AiM administration</a>";
?>
</td>
--- 274,285 ----
<td align="right"><p><b><?php echo $straimquiz; ?>:</b></p></td>
<td>
! <?php
! $quizzes = math_assignment_quizlist($form->course);
! foreach ($quizzes as $quiz) {
! $quizarray[$quiz] = $quiz;
! }
! choose_from_menu($quizarray, "aimquiz", $form->aimquiz,
! $strnone, "", "None");
! helpbutton("addupdate_quiz", $straimquiz, "math_assignment");
?>
</td>
Index: pdfgen.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** pdfgen.php 8 Oct 2003 19:49:41 -0000 1.18
--- pdfgen.php 19 Oct 2003 10:01:44 -0000 1.19
***************
*** 73,78 ****
error("Couldn't add $i seed $newseed->seed to database");
}
! math_assignment_generate_pdf($math_assignment, $course, $subject, $server, $type, $tempfile, $newseed->seed);
! exec("\"c:\\Program Files\\ghostgum\\gsview\\gsview32.exe\" $tempfile.pdf");
}
}
--- 73,79 ----
error("Couldn't add $i seed $newseed->seed to database");
}
! 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";
}
}
***************
*** 109,120 ****
@unlink("$tempfile.pdf");
- @unlink("$tempfile.tex");
- @unlink("$tempfile.aux");
- @unlink("$tempfile.log");
- if (isset($imageurls)) {
- foreach ($imageurls as $key => $imageurl) {
- @unlink("$tempfile$key.jpg");
- }
- }
if (strlen($errlog) > 0) {
--- 110,113 ----
***************
*** 249,252 ****
--- 242,254 ----
else {
exec("$texcommand $tempfile.tex");
+ }
+ // delete temporary files
+ @unlink("$tempfile.tex");
+ @unlink("$tempfile.aux");
+ @unlink("$tempfile.log");
+ if (isset($imageurls)) {
+ foreach ($imageurls as $key => $imageurl) {
+ @unlink("$tempfile$key.jpg");
+ }
}
return true;
|