Update of /cvsroot/aimmath/moodle/mod/math_assignment
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21525
Modified Files:
aimpage.php config.html lib.php mod.html pdfgen.php
problems.tex servers.php subjectpage.php view.php
Log Message:
assignment only visible when coursemodule is.
now can deal with .pdf images in tex file
review button now always there
many other little tweaks
Index: aimpage.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/aimpage.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** aimpage.php 11 Jan 2004 14:59:53 -0000 1.21
--- aimpage.php 29 Jan 2004 18:20:38 -0000 1.22
***************
*** 66,69 ****
--- 66,73 ----
error("You are not allowed on this page");
}
+
+ if (!$isteacher and !$cm->visible) {
+ error("This assignment should not be visible");
+ }
// Process arguments
Index: config.html
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/config.html,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** config.html 11 Jan 2004 19:43:12 -0000 1.8
--- config.html 29 Jan 2004 18:20:38 -0000 1.9
***************
*** 1,3 ****
--- 1,16 ----
<?php
+
+ // require_once('../mod/math_assignment/lib.php');
+ function get_server_depends($server, $justcount=true) {
+ global $CFG;
+
+ 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");
+ }
+
$straimserverconfig = get_string("aimserverconfig", "math_assignment");
$strautoregister = get_string("autoregister", "math_assignment");
***************
*** 10,36 ****
$straimsubject = get_string("aimsubject", "math_assignment");
$straimsubjectpasswd = get_string("aimsubjectpasswd", "math_assignment");
?>
<form method="post" action="<?php echo $CFG->wwwroot; ?>/mod/math_assignment/saveconfig.php" name="form">
! <table cellpadding="9" cellspacing="0">
! <tr>
! <td colspan="3" align="center"><a href="<?php echo $CFG->wwwroot; ?>/mod/math_assignment/servers.php"><?php echo $straimserverconfig; ?></a></td>
! </tr>
! <tr>
! <td colspan="3" align="center">
! <?php helpbutton ("config", get_string("help"), "math_assignment", true, true); ?>
! </td>
! </tr>
! <tr valign="top">
! <td align="right"><p><b><?php echo $strautoregister; ?>:</b></p></td>
! <td align="left"><?php
! unset($options);
! $options[0] = get_string("no");
! $options[1] = get_string("yes");
!
! choose_from_menu ($options, "math_assignment_auto_register", $CFG->math_assignment_auto_register, "", "", "");
! ?></td>
! <td align="left"><?php helpbutton ("config_autoregister", $strautoregister, "math_assignment"); ?></td>
! </tr>
<tr valign="top">
--- 23,81 ----
$straimsubject = get_string("aimsubject", "math_assignment");
$straimsubjectpasswd = get_string("aimsubjectpasswd", "math_assignment");
+ $strname = get_string("name", "math_assignment");
+ $straddress = get_string("address", "math_assignment");
+ $strdepends = get_string("dependentcourses", "math_assignment");
+ $stredit = get_string("edit");
+ $strdelete = get_string("delete");
+ $strpassword = get_string('password');
+
+ if ($servers = get_records("math_assignment_servers", "", "", "name ASC")) {
+ $table->head = array($strname, $straddress, $strpassword, $strdepends, $stredit, $strdelete);
+ $table->width = array("*", "*", "*", "*", "*", "*");
+ $table->align = array("LEFT", "LEFT", "LEFT", "CENTER", "CENTER", "CENTER");
+
+ foreach ($servers as $server) {
+ $table->data[] = array($server->name, $server->address, str_repeat("*", strlen($server->password)),
+ get_server_depends($server), "<a href=\"../mod/math_assignment/servers.php?id=$server->id\">$stredit</a>",
+ "<a href=\"../mod/math_assignment/servers.php?id=$server->id&name=&address=&password=\">$strdelete</a>");
+ }
+ print_heading($straimserverconfig);
+ print_table($table);
+
+ $server->name = "";
+ $server->address = "";
+ $server->password = "";
+
+ }
+ echo '<p><center>';
+ print_single_button('../mod/math_assignment/servers.php', NULL, get_string("addnewserver", "math_assignment"));
+ echo '</center>';
+
+ if ($subjects = get_records('math_assignment_subjects')) {
+ unset($table);
+ $table->head = array (get_string('course'), $straimserver, $straimsubject, $strpassword, $stredit, $strdelete);
+ $generaltable->align = array ("LEFT", "LEFT", "LEFT", "LEFT", "CENTER", "CENTER");
+
+ foreach($subjects as $subject) {
+ $course = get_record('course', 'id', $subject->course);
+ $server = get_record('math_assignment_servers', 'id', $subject->server);
+ $table->data[] = array($course->fullname, $server->name, $subject->name, str_repeat("*", strlen($subject->password)),
+ "<a href=\"../mod/math_assignment/subjects.php?id=$subject->id\">$stredit</a>",
+ "<a href=\"../mod/math_assignment/subjects.php?id=$subject->id&course=&name=&subject=&password=\">
+ $strdelete</a>");
+ }
+
+ print_heading($strcoursesettings);
+ print_table($table);
+ }
+
+ echo '<p><center>';
+ print_single_button('../mod/math_assignment/subjects.php', NULL, get_string("addnewsubject", "math_assignment"));
+ echo '</center>';
?>
<form method="post" action="<?php echo $CFG->wwwroot; ?>/mod/math_assignment/saveconfig.php" name="form">
! <p />
! <table cellpadding="9" cellspacing="0" align="center">
<tr valign="top">
***************
*** 45,134 ****
<td align="left"><?php helpbutton ("config_latexoutput", $strlatexoutput, "math_assignment"); ?></td>
</tr>
- <tr valign="top">
- <td align="right"><p><b><?php echo $straimdisplay; ?>:</b></p></td>
- <td align="left"><?php
- unset($options);
- $options[0] = get_string("nobody", "math_assignment");
- $options[1] = get_string("administrators");
- $options[2] = get_string("teachers");
- choose_from_menu ($options, "math_assignment_aim_display", $CFG->math_assignment_aim_display, "", "", "");
- ?></td>
- <td align="left"><?php helpbutton ("config_aimdisplay", $straimdisplay, "math_assignment"); ?></td>
- </tr>
- <tr valign="top">
- <td align="right"><p><b><?php echo $strdefaultemailhost; ?>:</b></p></td>
- <td align="left"><input type="text" name="math_assignment_default_email_host" size="40" maxlength="255" value="<?php echo $CFG->math_assignment_default_email_host; ?>" /></td>
- <td align="left"><?php helpbutton ("config_defaultemailhost", $strdefaultemailhost, "math_assignment"); ?></td>
- </tr>
- <tr valign="top">
- <td align="right"><p><b><?php echo $strsecretaryemail; ?>:</b></p></td>
- <td align="left"><input type="text" name="math_assignment_secretary_email" size="40" maxlength="255" value="<?php echo $CFG->math_assignment_secretary_email; ?>" /></td>
- <td align="left"><?php helpbutton ("config_secretaryemail", $strsecretaryemail, "math_assignment"); ?></td>
- </tr>
- <?php
-
- // display rows for entering per course settings
- if ($courses = get_courses()) {
- ?>
- <tr>
- <th colspan="3" align="center"><?php echo $strcoursesettings; ?></th>
- </tr>
- <?php
-
- // get aim server
- $options = array();
- if ($servers = get_records("math_assignment_servers", "", "", "name ASC")) {
- foreach ($servers as $server) {
- $options[$server->id] = $server->name;
- }
- }
-
- foreach ($courses as $course) {
- if (!$subject = get_record("math_assignment_subjects", "course", $course->id)) {
- $subject->name = "";
- $subject->server = 0;
- $subject->password = "";
- }
- echo "<tr>\n";
- echo "<td colspan=\"3\" align=\"center\">{$course->fullname} ({$course->shortname})</td>\n";
- echo "</tr>\n";
- echo "<tr>\n";
- echo "<td align=\"right\"><p><b>$straimserver : </b></p></td>\n";
- echo "<td align=\"left\">";
- choose_from_menu ($options, "server$course->id", $subject->server, "choose", "", 0);
- echo "</td>\n";
- echo "<td align=\"left\">";
- helpbutton ("config_aimserver", $straimserver, "math_assignment");
- echo "</td>\n";
- echo "</tr>\n";
- echo "<tr>\n";
- echo "<td align=\"right\"><p><b>$straimsubject : </b></p></td>\n";
- echo "<td align=\"left\"><input type=\"text\" name=\"name$course->id\" value=\"$subject->name\" /></td>\n";
- echo "<td align=\"left\">";
- helpbutton ("config_aimsubject", $straimsubject, "math_assignment");
- echo "</td>\n";
- echo "</tr>\n";
- echo "<tr>\n";
- echo "<td align=\"right\"><p><b>$straimsubjectpasswd : </b></p></td>\n";
- echo "<td align=\"left\"><input type=\"password\" name=\"password$course->id\" value=\"$subject->password\" /></td>\n";
- echo "<td align=\"left\">";
- helpbutton ("config_aimsubjectpasswd", $straimsubjectpasswd, "math_assignment");
- echo "</td>\n";
- echo "</tr>\n";
- }
- }
-
- // remove any entries in the subjects table which correspond to non-existent courses
- unset($courseids);
- foreach ($courses as $course) {
- if (isset($courseids))
- $courseids .= ", $course->id";
- else
- $courseids = "$course->id";
- }
- $db->Execute("DELETE FROM `{$CFG->prefix}math_assignment_subjects` WHERE `course` NOT IN ($courseids)");
-
- ?>
<tr>
--- 90,94 ----
Index: lib.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** lib.php 16 Jan 2004 09:34:57 -0000 1.50
--- lib.php 29 Jan 2004 18:20:38 -0000 1.51
***************
*** 36,43 ****
}
$math_assignment->problems = trim($math_assignment->problems);
- if ($math_assignment->problems) {
- if (math_assignment_is_tex_file($math_assignment->problems) xor $math_assignment->aimquiz)
- return get_string($math_assignment->aimquiz ? "invalidmustbetex" : "invalidmustnotbetex", "math_assignment", get_string("problems", "math_assignment"));
- }
// solutions
--- 36,39 ----
***************
*** 54,61 ****
}
$math_assignment->solutions = trim($math_assignment->solutions);
- if ($math_assignment->solutions) {
- if (math_assignment_is_tex_file($math_assignment->solutions) xor $math_assignment->aimquiz)
- return get_string($math_assignment->aimquiz ? "invalidmustbetex" : "invalidmustnotbetex", "math_assignment", get_string("solutions", "math_assignment"));
- }
// check that the paper grade is valid
--- 50,53 ----
***************
*** 103,110 ****
}
$math_assignment->problems = trim($math_assignment->problems);
- if ($math_assignment->problems) {
- if (math_assignment_is_tex_file($math_assignment->problems) xor $math_assignment->aimquiz)
- return get_string($math_assignment->aimquiz ? "invalidmustbetex" : "invalidmustnotbetex", "math_assignment", get_string("problems", "math_assignment"));
- }
// solutions
--- 95,98 ----
***************
*** 121,128 ****
}
$math_assignment->solutions = trim($math_assignment->solutions);
- if ($math_assignment->solutions) {
- if (math_assignment_is_tex_file($math_assignment->solutions) xor $math_assignment->aimquiz)
- return get_string($math_assignment->aimquiz ? "invalidmustbetex" : "invalidmustnotbetex", "math_assignment", get_string("solutions", "math_assignment"));
- }
// check that the paper grade is valid
--- 109,112 ----
***************
*** 298,302 ****
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)
--- 282,286 ----
if($math_assignment->problems) {
! if (math_assignment_is_tex_file($math_assignment->problems) or $math_assignment->problems == 'default')
$proburl = "$CFG->wwwroot/mod/math_assignment/pdfgen.php?id=$math_assignment->id&type=problems";
else if ($math_assignment->problemsisurl)
***************
*** 307,317 ****
$proburl = "$CFG->wwwroot/file.php?file=/$math_assignment->course/$math_assignment->problems";
}
- else if ($math_assignment->aimquiz)
- $proburl = "$CFG->wwwroot/mod/math_assignment/pdfgen.php?id=$math_assignment->id&type=problems";
else
$proburl = "";
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)
--- 291,299 ----
$proburl = "$CFG->wwwroot/file.php?file=/$math_assignment->course/$math_assignment->problems";
}
else
$proburl = "";
if($math_assignment->solutions) {
! if (math_assignment_is_tex_file($math_assignment->solutions) or $math_assignment->problems == 'default')
$solurl = "$CFG->wwwroot/mod/math_assignment/pdfgen.php?id=$math_assignment->id&type=solutions";
else if ($math_assignment->solutionsisurl)
***************
*** 322,327 ****
$solurl = "$CFG->wwwroot/file.php?file=/$math_assignment->course/$math_assignment->solutions";
}
- else if ($math_assignment->aimquiz)
- $solurl = "$CFG->wwwroot/mod/math_assignment/pdfgen.php?id=$math_assignment->id&type=solutions";
else
$solurl = "";
--- 304,307 ----
***************
*** 331,335 ****
/// Function which prints the problem and solution sheet links
/// Note that if $align is empty we assume we are already in a paragraph, else we put the links in a paragraph
!
math_assignment_get_file_urls($math_assignment, $proburl, $solurl);
$proburl = htmlspecialchars($proburl);
--- 311,315 ----
/// Function which prints the problem and solution sheet links
/// Note that if $align is empty we assume we are already in a paragraph, else we put the links in a paragraph
! global $CFG;
math_assignment_get_file_urls($math_assignment, $proburl, $solurl);
$proburl = htmlspecialchars($proburl);
***************
*** 344,347 ****
--- 324,331 ----
$strviewproblems = get_string("viewproblems", "math_assignment");
$return .= "<a href=\"$proburl\" target=\"problems\">$strviewproblems</a>";
+ if (isteacher($math_assignment->course) and math_assignment_is_tex_file($math_assignment->problems)) {
+ $return .= " <a href=\"$CFG->wwwroot/mod/math_assignment/texedit.php?id=$math_assignment->id&file=$math_assignment->problems\"
+ target=\"edit\"><img src=\"$CFG->pixpath/i/edit.gif\" height=16 width=16 border=0 alt=\"\"></a>";
+ }
}
if (($solurl) and ($math_assignment->solutiontime < time()) && isstudent($math_assignment->course)) {
***************
*** 364,367 ****
--- 348,355 ----
$strviewsolutions = get_string("viewsolutions", "math_assignment");
$return .= "<a href=\"$solurl\" target=\"solutions\">$strviewsolutions</a>";
+ if (isteacher($math_assignment->course) and math_assignment_is_tex_file($math_assignment->solutions)) {
+ $return .= " <a href=\"$CFG->wwwroot/mod/math_assignment/texedit.php?id=$math_assignment->id&file=$math_assignment->solutions\"
+ target=\"edit\"><img src=\"$CFG->pixpath/i/edit.gif\" height=16 width=16 border=0 alt=\"\"></a>";
+ }
}
if (isset($return)) {
***************
*** 705,710 ****
$out = preg_replace("/<table border>/", "<table border=\"1\">", $out);
$out = preg_replace("/<hr noshade(?=[\s\/])/", "<hr noshade=\"noshade\" ", $out);
! $out = preg_replace("/width\=([\d]+)/", "width=\"$2\"", $out);
! $out = preg_replace("/height\=([\d]+)/", "height=\"$2\"", $out);
// sort out a netscape bug
$out = str_replace("<br/>", "<br />", $out);
--- 693,698 ----
$out = preg_replace("/<table border>/", "<table border=\"1\">", $out);
$out = preg_replace("/<hr noshade(?=[\s\/])/", "<hr noshade=\"noshade\" ", $out);
! $out = preg_replace("/width\=([\d]+)/", "width=\"$1\"", $out);
! $out = preg_replace("/height\=([\d]+)/", "height=\"$1\"", $out);
// sort out a netscape bug
$out = str_replace("<br/>", "<br />", $out);
Index: mod.html
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/mod.html,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** mod.html 11 Jan 2004 14:08:06 -0000 1.26
--- mod.html 29 Jan 2004 18:20:38 -0000 1.27
***************
*** 148,151 ****
--- 148,152 ----
$coursedirs = get_directory_list($rootdir, $CFG->moddata);
$options = array();
+ $options['default'] = 'default';
foreach ($coursedirs as $dir) {
$options["$dir"] = $dir;
***************
*** 160,166 ****
<?php choose_from_menu ($options, "problems", $form->problems,
$strnone, "sheet_change('problems', 'list');", ""); ?>
- <?php if (math_assignment_is_tex_file("$rootdir/$form->problems")) {
- echo " <a href=\"$CFG->wwwroot/mod/math_assignment/texedit.php?id=$form->id&file=$form->problems\" target=\"_blank\">" . get_string("edit") . "</a>";
- } ?>
</td>
<td rowspan="4"><?php helpbutton("addupdate_problems", $strproblems, "math_assignment"); ?>
--- 161,164 ----
***************
*** 197,200 ****
--- 195,199 ----
$coursedirs = get_directory_list($rootdir, $CFG->moddata);
$options = array();
+ $options['default'] = 'default';
foreach ($coursedirs as $dir) {
$options["$dir"] = $dir;
***************
*** 209,215 ****
<?php choose_from_menu($options, "solutions", $form->solutions,
$strnone, "sheet_change('solutions', 'list');", ""); ?>
- <?php if (math_assignment_is_tex_file("$rootdir/$form->solutions")) {
- echo " <a href=\"$CFG->wwwroot/mod/math_assignment/texedit.php?id=$form->id&file=$form->solutions\" target=\"texedit\">" . get_string("edit") . "</a>";
- } ?>
</td>
<td rowspan="4"><?php helpbutton("addupdate_solutions", $strsolutions, "math_assignment"); ?>
--- 208,211 ----
***************
*** 245,258 ****
</tr>
- <?php
- if ($aimsubject) {
- ?>
- <tr valign="top">
- <td align="center" colspan="2"><p><?php print_string("mustbetex", "math_assignment"); ?></p></td>
- </tr>
- <?php
- }
- ?>
-
<tr valign="top">
<td align="right"><p><b><?php echo $strmaxgrade; ?>:</b></p></td>
--- 241,244 ----
***************
*** 281,284 ****
--- 267,272 ----
$strnone, "", "");
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>
Index: pdfgen.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** pdfgen.php 11 Jan 2004 14:59:53 -0000 1.26
--- pdfgen.php 29 Jan 2004 18:20:38 -0000 1.27
***************
*** 26,29 ****
--- 26,34 ----
error("Course is misconfigured");
}
+
+ if (! $cm = get_coursemodule_from_instance("math_assignment", $math_assignment->id, $course->id)) {
+ error("Course Module ID was incorrect");
+ }
+
require_login();
***************
*** 34,37 ****
--- 39,46 ----
}
+ if (!isteacher($course->id) and !$cm->visible) {
+ error("This assignment should not be visible");
+ }
+
// make sure students don't look at solutions before they should
if ($type == "solutions" and isstudent($course->id) and $math_assignment->solutiontime > time()){
***************
*** 174,182 ****
$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);
}
}
--- 183,193 ----
$data,1
);
! 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_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,227 ****
$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);
// now insert the aim questions
foreach ($questions as $question) {
--- 218,240 ----
$latex = implode ('', file($texfile));
! // Copy pdf files to moodletex
! if (preg_match_all("/(?<=[\\W])[\\w]+\\.p[dn][fg]/" ,$latex, $imagematches)) {
! $images = $imagematches[0];
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("/$image/", "$tempfile$image", $latex, 1);
! if ($texmachine == "remote") {
! if (!$conn = ftp_connect("manor.york.ac.uk")) error("couldn't open ftp connection");
! if (!ftp_login($conn, "gustav", "bekieh++")) error("couldn't log in");
! if (!ftp_site($conn, "chmod 0744 /home/gustav/public_html/moodletex/$tempfile$image")) error("couldn't chmod");
! ftp_close($conn);
! }
}
}
// \aimquestion prints a \spericalangle before the aim question
! $latex = str_replace('\aimquestion', '$\bigodot$ \aimque', $latex);
// now insert the aim questions
foreach ($questions as $question) {
***************
*** 232,236 ****
$latex = implode ('', file("$CFG->dirroot/mod/math_assignment/$type.tex"));
foreach ($questions as $question) {
! $latex .= "\n\n\\nextq $\\sphericalangle$ ".math_assignment_aim_to_latex($question,$type);
}
$latex .= "\n\n\\end{document}";
--- 245,249 ----
$latex = implode ('', file("$CFG->dirroot/mod/math_assignment/$type.tex"));
foreach ($questions as $question) {
! $latex .= "\n\n\\nextq ".math_assignment_aim_to_latex($question,$type);
}
$latex .= "\n\n\\end{document}";
***************
*** 299,303 ****
// "<latex>\n\n\vspace{2mm}\\noindent{\\bf Part \$2}\n\n</latex>",$data);
$data = preg_replace("/id=\"question(\d+).(\d+)\"/i",
! "<latex>\n\n\vspace{1mm}{\\bf (\$2)} </latex>",$data);
// replace radio buttons
--- 312,316 ----
// "<latex>\n\n\vspace{2mm}\\noindent{\\bf Part \$2}\n\n</latex>",$data);
$data = preg_replace("/id=\"question(\d+).(\d+)\"/i",
! "<latex>\n\n\vspace{1mm}\\noindent{\\bf (\$2)} </latex>",$data);
// replace radio buttons
***************
*** 305,315 ****
"<latex>\n\n {\bf $2: } </latex>",$data);
$data = preg_replace("/(type=\"radio\"[^\/]*value=\")([B-Z])\"/",
! "<latex>~~~~~ {\bf $2: } </latex>",$data);
! // replace checkboxes by diamonds
$data = preg_replace("/(type=\"checkbox\"[^\/]*value=\")([A])\"/",
! "<latex>\n\n\\noindent{\bf $2: } </latex>",$data);
$data = preg_replace("/(type=\"checkbox\"[^\/]*value=\")([B-Z])\"/",
! "<latex>{\bf $2: } </latex>",$data);
// remove small print
--- 318,328 ----
"<latex>\n\n {\bf $2: } </latex>",$data);
$data = preg_replace("/(type=\"radio\"[^\/]*value=\")([B-Z])\"/",
! "<latex>;~~~~ {\bf $2: } </latex>",$data);
! // replace checkboxes
$data = preg_replace("/(type=\"checkbox\"[^\/]*value=\")([A])\"/",
! "<latex>\n\n{\bf $2: } </latex>",$data);
$data = preg_replace("/(type=\"checkbox\"[^\/]*value=\")([B-Z])\"/",
! "<latex>;~~~~ {\bf $2: } </latex>",$data);
// remove small print
Index: problems.tex
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/problems.tex,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** problems.tex 27 Sep 2003 09:19:27 -0000 1.1
--- problems.tex 29 Jan 2004 18:20:38 -0000 1.2
***************
*** 13,17 ****
\newcommand{\nextq}{\addtocounter{question}{1}\vspace{0.3truecm}
! \noindent{\bf\arabic{question}.$\quad$}}
\begin{document}
--- 13,17 ----
\newcommand{\nextq}{\addtocounter{question}{1}\vspace{0.3truecm}
! \noindent{\bf AiM \arabic{question}.$\quad$}}
\begin{document}
Index: servers.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/servers.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** servers.php 11 Jan 2004 14:08:06 -0000 1.5
--- servers.php 29 Jan 2004 18:20:38 -0000 1.6
***************
*** 4,11 ****
/* optional variables:
! id Server id used when editing a record
! name Server name used when adding or editing a record
! address Server address used when adding or editing a record
! password Zone admin password for the server used when adding or editing a record
*/
--- 4,11 ----
/* optional variables:
! id Server id used when editing a record
! name Server name used when adding or editing a record
! address Server address used when adding or editing a record
! password Zone admin password for the server used when adding or editing a record
*/
***************
*** 21,26 ****
}
- $straimserverconfig = get_string("aimserverconfig", "math_assignment");
-
if (isset($name) || isset($address) || isset($password)) { // add or edit a record
optional_variable($name, "");
--- 21,24 ----
***************
*** 92,96 ****
error(get_string("failed", "math_assignment"), "servers.php");
}
! redirect("servers.php", get_string("changessaved"), 1);
}
--- 90,94 ----
error(get_string("failed", "math_assignment"), "servers.php");
}
! redirect("http://aim.york.ac.uk/moodle/admin/module.php?module=math_assignment", get_string("changessaved"), 1);
}
***************
*** 101,104 ****
--- 99,103 ----
$strmanagemodules = get_string("managemodules");
$strmathassignment = get_string("modulename", "math_assignment");
+ $straimserverconfig = get_string("aimserverconfig", "math_assignment");
print_header("$site->shortname: $straimserverconfig", "$site->fullname",
Index: subjectpage.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/subjectpage.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** subjectpage.php 11 Jan 2004 14:59:53 -0000 1.5
--- subjectpage.php 29 Jan 2004 18:20:38 -0000 1.6
***************
*** 83,88 ****
print_header("$course->shortname: $math_assignment->name", "$course->fullname",
! "$navigation <a href=\"index.php?id=$course->id\">$strmath_assignments</a> -> $straimsubjectpage",
! "", "", true, update_module_button($cm->id, $course->id, $strmath_assignment), navmenu($course, $cm), $usexml);
--- 83,89 ----
print_header("$course->shortname: $math_assignment->name", "$course->fullname",
! "$navigation <a href=\"index.php?id=$course->id\">$strmath_assignments</a> ->
! <a href=\"subjectpage.php?id=$course->id\">$straimsubjectpage</a>",
! "", "", true, '', navmenu($course, $cm), $usexml);
Index: view.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/view.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** view.php 16 Jan 2004 09:34:57 -0000 1.28
--- view.php 29 Jan 2004 18:20:38 -0000 1.29
***************
*** 62,65 ****
--- 62,69 ----
error("You are not allowed on this page");
}
+
+ if (!$isteacher and !$cm->visible) {
+ error("This assignment should not be visible");
+ }
$hasaim = ($math_assignment->aimgrade > 0);
***************
*** 420,424 ****
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);
--- 424,429 ----
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
! <a href=\"aimpage.php?id=$cm->id&reviewstudent=$student->username&aimaction=reviewquiz\">$strreview</a>", $student->totalgrade);
else if ($haspaper)
$table->data[] = array($picture, $student->firstname, $student->lastname, $email, $papergrade);
|