Update of /cvsroot/aimmath/moodle/mod/math_assignment
In directory sc8-pr-cvs1:/tmp/cvs-serv8293/mod/math_assignment
Modified Files:
mod.html
Added Files:
subjectpage.php
Log Message:
Added link to AiM subject administration to mod.html to make it easier for lecturers to set up their AiM quizzes.
--- NEW FILE: subjectpage.php ---
<?PHP // $Id: subjectpage.php,v 1.1 2003/09/18 09:32:48 gustav_delius Exp $
/*
* This page displays the AiM subject administration page
*/
require_once("../../config.php");
require_once("lib.php");
require_variable($id); // Course Module ID
if (! $course = get_record("course", "id", $id)) {
error("Course is misconfigured");
}
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");
}
require_login($course->id);
if (!isteacher($id)) {
errpr("Only teachers should be able to view this page");
}
add_to_log($course->id, "math_assignment", "aimsubjectpage", "aimsubjectpage.php?id=$id", "$subject->name");
if (!$_POST) {
$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);
}
else {
// load requested page
foreach ($_POST as $key => $arg) {
if (strcasecmp($key, "target")) { // ignore target arguments
$postdata = math_assignment_add_arg_to_url_data($postdata, math_assignment_convert_arg_name($key), stripslashes($arg));
}
}
// special case for changing the output type
if (count($_POST) == 2) {
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();
}
}
}
}
// get output option from cookie
if (function_exists('editer')) {
if (array_key_exists("output", $_COOKIE))
$usexml = (strcasecmp($_COOKIE['output'], "xml") == 0);
else
$usexml = $CFG->math_assignment_default_latex_output ? true : false;
}
else
$usexml = false;
$usexml = false;
// 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");
$straimsubjectpage = get_string("editquiz", "math_assignment");
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);
// Print the main part of the page
math_assignment_print_aim_output_script();
// load the AiM page and grab the result
$data = math_assignment_get_aim_output($server->address, $postdata, $usexml ? "latex" : "html");
// write out relevant parts of it
$data = math_assignment_convert_aim_output($math_assignment, $subject, $data, $server->address, "subjectpage.php?id=$id", true, $grade, $max_grade);
if (!$data) {
error(get_string("nooutput", "math_assignment"));
}
print_simple_box_start("center", "", "$THEME->cellcontent", "20");
echo $data;
print_simple_box_end();
/// Finish the page
print_footer($course);
?>
Index: mod.html
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/mod.html,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** mod.html 17 Sep 2003 09:12:04 -0000 1.9
--- mod.html 18 Sep 2003 09:32:48 -0000 1.10
***************
*** 171,175 ****
</td>
</tr>
! <input type="hidden" name="problemscompile" value="true"> <!--
<tr>
<td colspan="2"><input type="checkbox" name="problemscompile"<?php if ($form->problemscompile) echo " checked=\"true\""; ?> /><?php echo "$strcompiletex"; ?></td>
--- 171,175 ----
</td>
</tr>
! <input type="hidden" name="problemscompile" value="false"> <!--
<tr>
<td colspan="2"><input type="checkbox" name="problemscompile"<?php if ($form->problemscompile) echo " checked=\"true\""; ?> /><?php echo "$strcompiletex"; ?></td>
***************
*** 220,224 ****
</td>
</tr>
! <input type="hidden" name="solutionscompile" value="true"><!--
<tr>
<td colspan="2"><input type="checkbox" name="solutionscompile"<?php if ($form->solutionscompile) echo " checked=\"true\""; ?> /><?php echo "$strcompiletex"; ?></td>
--- 220,224 ----
</td>
</tr>
! <input type="hidden" name="solutionscompile" value="false"><!--
<tr>
<td colspan="2"><input type="checkbox" name="solutionscompile"<?php if ($form->solutionscompile) echo " checked=\"true\""; ?> /><?php echo "$strcompiletex"; ?></td>
***************
*** 284,287 ****
--- 284,290 ----
<td>
<input type="text" name="aimquiz" size="40" maxlength="255" value="<?php p($form->aimquiz); ?>" /> <?php helpbutton("addupdate_quiz", $straimquiz, "math_assignment"); ?>
+ <?php if ($form->aimsubject > 0) {
+ echo "<a href=\"$CFG->wwwroot/mod/math_assignment/subjectpage.php?id=$form->aimsubject\" target=\"suject\">AiM administration</a>";
+ } ?>
</td>
</tr>
|