mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
A new configuration parameter 'allowunenroll' will enable/disable the
"unenrol me" buttons on user pages and course pages.
This commit is contained in:
parent
726705327f
commit
5204d8316a
@ -300,6 +300,21 @@
|
||||
<?php print_string("configteacherassignteachers") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>allowunenroll:</td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[0] = get_string("no");
|
||||
$options[1] = get_string("yes");
|
||||
|
||||
choose_from_menu ($options, "allowunenroll", $config->allowunenroll, "", "", "");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configallowunenroll") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>maxbytes:</td>
|
||||
<td>
|
||||
|
@ -870,7 +870,9 @@ function print_course_admin_links($course, $width=180) {
|
||||
$admindata[]="<a href=\"$CFG->changepassword\">".get_string("changepassword")."...</a>";
|
||||
$adminicon[]="<img src=\"$CFG->pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
|
||||
}
|
||||
$admindata[]="<a href=\"unenrol.php?id=$course->id\">".get_string("unenrolme", "", $course->shortname)."...</a>";
|
||||
if ($CFG->allowunenroll) {
|
||||
$admindata[]="<a href=\"unenrol.php?id=$course->id\">".get_string("unenrolme", "", $course->shortname)."...</a>";
|
||||
}
|
||||
$adminicon[]="<img src=\"$CFG->pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,10 @@
|
||||
error("You must be a teacher to do this");
|
||||
}
|
||||
|
||||
if ($user->id == $USER->id and !$CFG->allowunenroll) {
|
||||
error("You are not allowed to unenroll");
|
||||
}
|
||||
|
||||
if (isset($confirm)) {
|
||||
|
||||
if (! unenrol_student($user->id, $course->id)) {
|
||||
|
@ -107,6 +107,7 @@ $string['cleaningtempdata'] = "Cleaning temp data";
|
||||
$string['closewindow'] = "Close this window";
|
||||
$string['comparelanguage'] = "Compare and edit current language";
|
||||
$string['complete'] = "Complete";
|
||||
$string['configallowunenroll'] = "If this is set 'Yes', then students are allowed to unenroll themselves from courses whenever they like. Otherwise they are not allowed, and this process will be solely controlled by the teachers and administrators.";
|
||||
$string['configcountry'] = "If you set a country here, then this country will be selected by default on new user accounts. To force users to choose a country, just leave this unset.";
|
||||
$string['configdebug'] = "If you turn this on, then PHP's error_reporting will be increased so that more warnings are printed. This is only useful for developers.";
|
||||
$string['configgdversion'] = "Indicate the version of GD that is installed. The version shown by default is the one that has been auto-detected. Don't change this unless you really know what you're doing.";
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
$defaults = array (
|
||||
"auth" => "email",
|
||||
"allowunenroll" => true,
|
||||
"changepassword" => true,
|
||||
"country" => "",
|
||||
"debug" => 7,
|
||||
|
@ -150,7 +150,7 @@
|
||||
}
|
||||
}
|
||||
if ($course->category and
|
||||
((isstudent($course->id) and ($user->id == $USER->id) and !isguest()) or
|
||||
((isstudent($course->id) and ($user->id == $USER->id) and !isguest() and $CFG->allowunenroll) or
|
||||
(isteacher($course->id) and isstudent($course->id, $user->id))) ) {
|
||||
echo "<TD NOWRAP><P><FORM ACTION=\"../course/unenrol.php\" METHOD=GET>";
|
||||
echo "<INPUT type=hidden name=id value=\"$course->id\">";
|
||||
|
Loading…
x
Reference in New Issue
Block a user