mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
Fixes to user new Roles
This commit is contained in:
parent
4feeadeb59
commit
bc492d185c
@ -15,10 +15,8 @@ function print_entry($course) {
|
||||
$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 {
|
||||
@ -44,7 +42,7 @@ function print_entry($course) {
|
||||
|
||||
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 {
|
||||
@ -208,19 +206,6 @@ function check_entry($form, $course) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
?>
|
||||
|
@ -9,11 +9,14 @@
|
||||
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;
|
||||
@ -22,13 +25,12 @@
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
@ -5,8 +5,8 @@
|
||||
/// 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
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user