$strloginto = get_string("loginto", "", $course->shortname);
$strcourses = get_string("courses");
-
$teacher = get_teacher($course->id);
-
if ( (float) $course->cost < 0 ) {
$cost = (float) $CFG->enrol_cost;
} else {
print_simple_box_start("center");
- if (isguest()) {
+ if (has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM, SITEID), NULL, false)) {
if (empty($CFG->loginhttps)) {
$wwwroot = $CFG->wwwroot;
} else {
}
}
-/**
-* Returns information about the courses a student has access to
-*
-* Set the $user->student course array
-* Set the $user->timeaccess course array
-*
-* @param user referenced object, must contain $user->id already set
-*/
-function get_student_courses(&$user) {
- $manual = enrolment_factory::factory('manual');
- $manual->get_student_courses($user);
-}
-
} // end of class definition
?>
redirect($CFG->wwwroot);
}
+ if (! $context = get_context_instance(CONTEXT_COURSE, $course->id)) {
+ redirect($CFG->wwwroot);
+ }
+
require_login();
/// Refreshing enrolment data in the USER session
- $enrol = new enrolment_plugin_paypal();
- $enrol->get_student_courses($USER);
+ load_user_capability();
if ($SESSION->wantsurl) {
$destination = $SESSION->wantsurl;
$destination = "$CFG->wwwroot/course/view.php?id=$course->id";
}
- if (isstudent($course->id) or isteacher($course->id)) {
+ if (has_capability('moodle/course:view', $context)) {
redirect($destination, get_string('paymentthanks', '', $course->fullname));
} else { /// Somehow they aren't enrolled yet! :-(
print_header();
notice(get_string('paymentsorry', '', $course), $destination);
}
-
?>
/// This fragment is called by admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$plugin->version = 2004081800; // This module's version
+$plugin->version = 2006092200; // This module's version
-$plugin->requires = 2004081800; // Requires this Moodle version
+$plugin->requires = 2006092100; // Requires this Moodle version
?>