Update of /cvsroot/aimmath/moodle/mod/math_assignment
In directory sc8-pr-cvs1:/tmp/cvs-serv10369/mod/math_assignment
Modified Files:
config.html mod.html subjects.php
Log Message:
The administrator is now asked to associate a Moodle course with each AiM subject. There is an extra option denying the teacher the right to choose other AiM subjects.
Index: config.html
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/config.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** config.html 9 Sep 2003 18:31:07 -0000 1.1
--- config.html 16 Sep 2003 14:41:38 -0000 1.2
***************
*** 42,45 ****
--- 42,56 ----
</tr>
<tr valign="top">
+ <td align="right"><p><b><?php echo "Teachers choose AiM subject" ?>:</b></p></td>
+ <td align="left"><?php
+ unset($options);
+ $options[0] = "false";
+ $options[1] = "true";
+
+ choose_from_menu ($options, "math_assignment_teachers_choose_subject", $CFG->math_assignment_teachers_choose_subject, "", "", "");
+ ?></td>
+ <td align="left"><?php helpbutton ("config_choosesubject", "Teachers choose AiM subject", "math_assignment"); ?></td>
+ </tr>
+ <tr valign="top">
<td align="right"><p><b><?php echo $strserverdisplay; ?>:</b></p></td>
<td align="left"><?php
Index: mod.html
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/mod.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** mod.html 16 Sep 2003 10:06:23 -0000 1.4
--- mod.html 16 Sep 2003 14:41:38 -0000 1.5
***************
*** 11,14 ****
--- 11,15 ----
* We check that these are setup here.
*/
+
if (!isset($form->name)) {
$form->name = "";
***************
*** 21,25 ****
}
if (!isset($form->aimsubject)) {
! $form->aimsubject = "";
}
if (!isset($form->aimquiz)) {
--- 22,26 ----
}
if (!isset($form->aimsubject)) {
! $form->aimsubject = 0;
}
if (!isset($form->aimquiz)) {
***************
*** 38,45 ****
if (!$form->name)
$form->name = get_string("modulename", "math_assignment");
! if (!$form->aimsubject) {
! $courses = get_courses();
! $form->aimsubject = $courses[$form->course]->shortname;
}
// Process problems and solutions
$form->problemsurl = "";
--- 39,52 ----
if (!$form->name)
$form->name = get_string("modulename", "math_assignment");
!
! if (!$form->aimsubject > 0) {
! // get aimsubject from database
! if (!$form->aimsubject = get_field("math_assignment_subject", "id", "course", $form->course)) {
! $form->aimsubject = 0;
! };
}
+
+ echo "aimsubject: $form->aimsubject";
+
// Process problems and solutions
$form->problemsurl = "";
***************
*** 200,239 ****
</tr>
! <tr valign="top">
! <td align="right"><p><b><?php echo "$straimsubject"; ?>:</b></p></td>
! <td>
! <select name="aimsubject">
! <?php math_assignment_list_all_subjects($form->aimsubject); ?>
! </select>
! <?php
! helpbutton ("addupdate_serversubject", $straimsubject, "math_assignment");
! if (isadmin()) {
! if (!empty($update)) {
! $newreturn = "update=$update";
! if (!empty($return)) {
! $newreturn .= "&return=$return";
}
}
! else if (isset($id) && isset($section) && isset($add)) {
! $newreturn = "id=$id§ion=$section&add=$add";
! }
! else {
! $newreturn = "";
! }
! if (!empty($newreturn)) {
! $newreturn = "?return=" . htmlspecialchars(urlencode($newreturn));
! }
! echo "<a href=\"$CFG->wwwroot/mod/math_assignment/servers.php$newreturn\">" . get_string("aimserverconfig", "math_assignment") . "</a>";
! }
! ?>
! </td>
! </tr>
! <tr valign="top">
! <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"); ?>
! </td>
! </tr>
</table>
--- 207,258 ----
</tr>
! <?php
! if ($CFG->math_assignment_teachers_choose_subject) {
! ?>
! <tr valign="top">
! <td align="right"><p><b><?php echo "$straimsubject"; ?>:</b></p></td>
! <td>
! <select name="aimsubject">
! <?php math_assignment_list_all_subjects($form->aimsubject); ?>
! </select>
! <?php
! helpbutton ("addupdate_serversubject", $straimsubject, "math_assignment");
! if (isadmin()) {
! if (!empty($update)) {
! $newreturn = "update=$update";
! if (!empty($return)) {
! $newreturn .= "&return=$return";
! }
}
+ else if (isset($id) && isset($section) && isset($add)) {
+ $newreturn = "id=$id§ion=$section&add=$add";
+ }
+ else {
+ $newreturn = "";
+ }
+ if (!empty($newreturn)) {
+ $newreturn = "?return=" . htmlspecialchars(urlencode($newreturn));
+ }
+ echo "<a href=\"$CFG->wwwroot/mod/math_assignment/servers.php$newreturn\">" . get_string("aimserverconfig", "math_assignment") . "</a>";
}
! ?>
! </td>
! </tr>
! <?php
! }
! ?>
! <?php
! if (($CFG->math_assignment_teachers_choose_subject > 0) or ($form->aimsubject > 0)) {
! ?>
! <tr valign="top">
! <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"); ?>
! </td>
! </tr>
! <?php
! }
! ?>
</table>
Index: subjects.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/subjects.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** subjects.php 9 Sep 2003 18:31:07 -0000 1.1
--- subjects.php 16 Sep 2003 14:41:38 -0000 1.2
***************
*** 10,13 ****
--- 10,14 ----
optional_variable($name); // new name for the subject
optional_variable($passwd); // password
+ optional_variable($course); // course that this subject is assigned to
optional_variable($delete); // delete button
optional_variable($return); // return options (passed to mod.php to go back to add / update page)
***************
*** 66,69 ****
--- 67,71 ----
$entry->server = $server->id;
$entry->password = $passwd;
+ $entry->course = $course;
if (!update_record("math_assignment_subject", $entry)) {
error(get_string("failed", "math_assignment"), "subjects.php?server=$servername");
***************
*** 74,77 ****
--- 76,80 ----
$entry->server = $server->id;
$entry->password = $passwd;
+ $entry->course = $course;
if (!insert_record("math_assignment_subject", $entry)) {
error(get_string("failed", "math_assignment"), "subjects.php?server=$servername");
***************
*** 98,101 ****
--- 101,105 ----
$strsubject = get_string("subject","math_assignment");
$strpasswd = get_string("passwd","math_assignment");
+ $strsubjectcourse = get_string("subjectcourse","math_assignment");
?>
***************
*** 150,153 ****
--- 154,164 ----
<td>
<input type="text" name="passwd" size="40" maxlength="255" /> <?php helpbutton ("subject_passwd", $strpasswd, "math_assignment"); ?>
+ </td>
+ </tr>
+
+ <tr valign="top">
+ <td align="right"><p><b><?php echo $strsubjectcourse; ?>:</b></p></td>
+ <td>
+ <input type="text" name="course" size="40" maxlength="255" /> <?php helpbutton ("subject_course", $strsubjectcourse, "math_assignment"); ?>
</td>
</tr>
|