Update of /cvsroot/aimmath/moodle/mod/math_assignment
In directory sc8-pr-cvs1:/tmp/cvs-serv12173/mod/math_assignment
Modified Files:
lib.php mod.html pdfgen.php version.php
Log Message:
implemented solution sheet time. Also some changes in pdfgen.
Index: lib.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** lib.php 2 Oct 2003 19:42:15 -0000 1.35
--- lib.php 5 Oct 2003 22:54:16 -0000 1.36
***************
*** 19,22 ****
--- 19,28 ----
$math_assignment->timedue = make_timestamp($math_assignment->dueyear, $math_assignment->duemonth,$math_assignment->dueday, $math_assignment->duehour, $math_assignment->dueminute);
+ // solution time
+ $math_assignment->solutiontime = make_timestamp($math_assignment->dueyear, $math_assignment->duemonth,$math_assignment->dueday, $math_assignment->duehour, $math_assignment->dueminute);
+ if ($math_assignment->solutiontime < $math_assignment->timedue) {
+ $math_assignment->solutiontime += 86400;
+ }
+
// problems
$math_assignment->problemsisurl = 0;
***************
*** 80,83 ****
--- 86,95 ----
$math_assignment->timedue = make_timestamp($math_assignment->dueyear, $math_assignment->duemonth,$math_assignment->dueday, $math_assignment->duehour, $math_assignment->dueminute);
+ // solution time
+ $math_assignment->solutiontime = make_timestamp($math_assignment->dueyear, $math_assignment->duemonth,$math_assignment->dueday, $math_assignment->duehour, $math_assignment->dueminute);
+ if ($math_assignment->solutiontime < $math_assignment->timedue) {
+ $math_assignment->solutiontime += 86400;
+ }
+
// problems
$math_assignment->problemsisurl = 0;
***************
*** 310,314 ****
$return .= math_assignment_help_button("viewproblems", $strviewproblems, false);
}
! if (($solurl) and ($math_assignment->timedue < time())) {
if (isset($return))
$return .= "<br />\n";
--- 322,326 ----
$return .= math_assignment_help_button("viewproblems", $strviewproblems, false);
}
! if (($solurl) and ($math_assignment->solutiontime < time())) {
if (isset($return))
$return .= "<br />\n";
***************
*** 762,765 ****
--- 774,779 ----
// sort out a netscape bug
$out = str_replace("<br/>", "<br />", $out);
+ $out = str_replace("  ", " ", $out);
+ $out = str_replace(" ", " ", $out);
// convert Latex to MathML
Index: mod.html
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/mod.html,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** mod.html 26 Sep 2003 22:23:23 -0000 1.22
--- mod.html 5 Oct 2003 22:54:16 -0000 1.23
***************
*** 8,12 ****
/*
* Variables specific to this module are:
! * name, problems, solutions, aimsubject, aimquiz, papergrade, aimgrade, timedue.
* We check that these are setup here.
*/
--- 8,13 ----
/*
* Variables specific to this module are:
! * name, problems, solutions, aimsubject, aimquiz, papergrade, aimgrade, timedue,
! * solutiontime.
* We check that these are setup here.
*/
***************
*** 44,47 ****
--- 45,51 ----
$form->timedue = 0;
}
+ if (!isset($form->solutiontime)) {
+ $form->solutiontime = 0;
+ }
// Now we set the defaults
if (!$form->name)
***************
*** 82,85 ****
--- 86,90 ----
$straimquiz = get_string("aimquiz","math_assignment");
$straimstyle = get_string("aimstyle","math_assignment");
+ $strsolutiontime = get_string("solutiontime","math_assignment");
?>
***************
*** 229,232 ****
--- 234,245 ----
</table>
</td>
+ </tr>
+
+ <tr valign="top">
+ <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>
</tr>
Index: pdfgen.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** pdfgen.php 2 Oct 2003 19:42:15 -0000 1.15
--- pdfgen.php 5 Oct 2003 22:54:16 -0000 1.16
***************
*** 32,37 ****
if ($solutions) {
! if (time() < $math_assignment->timedue and isstudent($course->id)) {
! error("You can not view the solutions until the assignment has closed!");
}
}
--- 32,37 ----
if ($solutions) {
! if (time() < $math_assignment->solutiontime and !isteacher($course->id)) {
! error("You can not view the solutions yet!");
}
}
***************
*** 122,127 ****
if (math_assignment_is_tex_file($texfile)) {
! $latex = implode ('', file($texfile));
$latex = str_replace('\aimquestion', '$\sphericalangle$ \aimque', $latex);
foreach ($questions as $question) {
$latex = str_replace_once('\aimque', math_assignment_aim_to_latex($question,$type),$latex);
--- 122,132 ----
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);
+ // now insert the aim questions
foreach ($questions as $question) {
$latex = str_replace_once('\aimque', math_assignment_aim_to_latex($question,$type),$latex);
***************
*** 136,144 ****
}
! // Insert course and assignment name if required
$latex = str_replace("\coursename","$course->fullname",$latex);
$latex = str_replace("\assignmentname","$math_assignment->name",$latex);
-
// generate pdf file from $latex
--- 141,148 ----
}
! // Insert course and assignment name if required
$latex = str_replace("\coursename","$course->fullname",$latex);
$latex = str_replace("\assignmentname","$math_assignment->name",$latex);
// generate pdf file from $latex
***************
*** 147,154 ****
fwrite($fp,$latex);
fclose($fp);
! if (strpos($_ENV["OS"], "Win") === false)
! exec("cd ".dirname($tempfile)."; pdflatex $tempfile.tex");
! else
! exec("pdflatex $tempfile.tex");
// output of pdf
--- 151,172 ----
fwrite($fp,$latex);
fclose($fp);
!
! // decide whether to use latex or tex
! if (strpos($latex, "begin{document}")) {
! $texcommand = "pdflatex";
! }
! 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 {
! exec("$texcommand $tempfile.tex");
! }
// output of pdf
***************
*** 188,193 ****
@unlink("$tempfile.aux");
@unlink("$tempfile.log");
! foreach ($imageurls as $key => $imageurl) {
! @unlink("$tempfile$key.jpg");
}
--- 206,213 ----
@unlink("$tempfile.aux");
@unlink("$tempfile.log");
! if (isset($imageurls)) {
! foreach ($imageurls as $key => $imageurl) {
! @unlink("$tempfile$key.jpg");
! }
}
Index: version.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/version.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** version.php 26 Sep 2003 22:23:23 -0000 1.12
--- version.php 5 Oct 2003 22:54:16 -0000 1.13
***************
*** 6,10 ****
/////////////////////////////////////////////////////////////////////////////////
! $module->version = 2003092523; // The (date) version of this module
$module->cron = 60; // How often should cron check this module (seconds)?
--- 6,10 ----
/////////////////////////////////////////////////////////////////////////////////
! $module->version = 2003100501; // The (date) version of this module
$module->cron = 60; // How often should cron check this module (seconds)?
|