mirrored from git://git.moodle.org/moodle.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleaned up enrol and unenrol process a bit
- Loading branch information
martin
committed
Jun 4, 2002
1 parent
c888501
commit e136072
Showing
4 changed files
with
66 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,40 @@ | |||
<?PHP // $Id$ | |||
|
|||
// Allows a student to "unenrol" from a class | |||
// This will not delete any of their data from the course, | |||
// but will remove them from the student list and prevent | |||
// any course email being sent to them. | |||
|
|||
require("../config.php"); | |||
require("lib.php"); | |||
|
|||
require_variable($id); //course | |||
|
|||
if (! $course = get_record("course", "id", $id) ) { | |||
error("That's an invalid course id"); | |||
} | |||
|
|||
require_login($course->id); | |||
|
|||
if (isset($confirm)) { | |||
if (! unenrol_student_in_course($USER->id, $course->id)) { | |||
error("An error occurred while trying to unenrol you."); | |||
} | |||
add_to_log($course->id, "course", "unenrol", "view.php?id=$course->id", "$USER->id"); | |||
|
|||
unset($USER->student["$id"]); | |||
|
|||
redirect("$CFG->wwwroot"); | |||
} | |||
|
|||
|
|||
print_header("Unenrol from $course->shortname", "$course->shortname", "<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> -> Unenrol"); | |||
|
|||
notice_yesno ("Are you sure you want to remove yourself from this course?", | |||
"unenrol.php?id=$id&confirm=yes", | |||
"$HTTP_REFERER"); | |||
|
|||
print_footer(); | |||
|
|||
|
|||
?> |