Some fixes to the enrolment page

This commit is contained in:
moodler 2005-03-04 01:53:53 +00:00
parent 70cc4fc602
commit 553924dc80
2 changed files with 39 additions and 44 deletions

View file

@ -203,6 +203,10 @@ function print_entry($course) {
function check_entry($form, $course) { function check_entry($form, $course) {
global $CFG, $USER, $SESSION, $THEME; global $CFG, $USER, $SESSION, $THEME;
if (empty($form->password)) {
$form->password = '';
}
$groupid = $this->check_group_entry($course->id, $form->password); $groupid = $this->check_group_entry($course->id, $form->password);
if (($form->password == $course->password) or ($groupid !== false) ) { if (($form->password == $course->password) or ($groupid !== false) ) {

View file

@ -1,69 +1,60 @@
<table cellpadding="20" align="center"> <?php print_simple_box_start('center'); ?>
<tr valign="top">
<td>
<p align="center"> <p align="center">
<?php <?php
if ($teacher) { if ($teacher) {
$site = get_site(); $teachername = "<a href=\"../user/view.php?id=$teacher->id&course=".SITEID."\">".fullname($teacher)."</a>.";
$teachername = "<a href=\"../user/view.php?id=$teacher->id&course=$site->id\">".fullname($teacher)."</a>.";
} else { } else {
$teachername = get_string("yourteacher", "", strtolower($course->teacher)); $teachername = get_string('yourteacher', '', strtolower($course->teacher));
} }
print_string("enrolmentkeyfrom", "", $teachername); print_string('enrolmentkeyfrom', '', $teachername);
?> ?>
</p> </p>
</td>
</tr>
<tr valign="top"> <p align="center"><?php if (! empty($this->errormsg)) {formerr($this->errormsg);} ?></p>
<td class=<?php echo ($course->guest==1 ?'"noticebox"':'"generalbox"'); ?> bgcolor="<?php p($THEME->cellcontent) ?>">
<center><?php if (! empty($this->errormsg)) {formerr($this->errormsg);} ?></center>
<form name="form" method="post" action="enrol.php"> <form name="form" method="post" action="enrol.php">
<table> <table align="center">
<tr> <tr>
<td width="50%" align="right"><p><?php print_string("enrolmentkey") ?>:</p></td> <td align="right"><p><?php print_string("enrolmentkey") ?>:</p></td>
<td width="50%"> <td>
<input type="password" name="password" size="20" value="<?php p($password) ?>" > <input type="password" name="password" size="20" value="<?php p($password) ?>" >
<input type="hidden" name="id" value="<?php p($course->id) ?>" > <input type="hidden" name="id" value="<?php p($course->id) ?>" >
</td> </td>
<tr> <tr>
<td width="50%">&nbsp;</td> <td>&nbsp;</td>
<td width="50%"> <td>
<table cellpadding="1" cellspacing="0" align="center"> <table cellpadding="1" cellspacing="0" align="center">
<tr> <tr>
<td><input type="submit" value="<?php print_string("login") ?>">&nbsp;&nbsp;</form></td> <td><input type="submit" value="<?php print_string("enrolme") ?>">&nbsp;&nbsp;</form></td>
<td><form action="<?php p($CFG->wwwroot)?>/index.php" method="post"> <td><form action="<?php p($CFG->wwwroot)?>/index.php" method="post">
<input type="submit" value="<?php print_string("cancel") ?>"></form></td> <input type="submit" value="<?php print_string("cancel") ?>"></form></td>
</tr> </tr>
</table> </table>
</td> </td>
</table> </table>
</td> </form>
</tr> <?php
<?php if ($course->guest==1) { print_simple_box_end();
$strallowguests = get_string("allowguests");
$strloginguest = get_string("loginguest");
$bgcolor = $THEME->cellcontent; if ($course->guest or true) {
$viewasguest = <<<view_as_guest print_simple_box_start('center');
<tr> ?>
<td class="generalbox" bgcolor="$bgcolor">
<form name="form" method="post" action="enrol.php"> <form name="form" method="post" action="enrol.php">
<table align="center" cellpadding="20"> <table align="center" cellpadding="20">
<tbody>
<tr> <tr>
<td>$strallowguests:&nbsp; </td> <td><?php print_string('allowguests') ?>:&nbsp; </td>
<td> <td>
<input name="id" value="$course->id" type="hidden"> <input name="id" value="<?php p($course->id) ?>" type="hidden">
<input name="loginasguest" value="yes" type="hidden"> <input name="loginasguest" value="yes" type="hidden">
<input value="$strloginguest" type="submit">&nbsp;&nbsp; <input value="<?php print_string('loginguest') ?>" type="submit">
</td> </td>
</tr> </tr>
</tbody>
</table> </table>
</form> </form>
</td>
</tr> <?php
view_as_guest; print_simple_box_end();
echo $viewasguest;} ?> }
</table> ?>