]> git.mjollnir.org Git - moodle.git/commitdiff
Fixes to user new Roles
authormoodler <moodler>
Fri, 22 Sep 2006 16:19:24 +0000 (16:19 +0000)
committermoodler <moodler>
Fri, 22 Sep 2006 16:19:24 +0000 (16:19 +0000)
enrol/paypal/enrol.php
enrol/paypal/return.php
enrol/paypal/version.php

index f030cb91e3b147fdc100502484147a0202c9f84b..fcf5f045578bd56b830a32adcb351d90b8ca5f08 100644 (file)
@@ -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
 
 ?>
index f97e265de7d5170e2d2d6d5f3e2d4da36a85d8c1..28c4adec9614f0152a0e2111e8c3c1cc3ffd02f2 100644 (file)
@@ -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;
         $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);
     }
-    
 
 ?>
index f05da31fe81438184d4286864ac27b2b621b7f41..e4e292521d096c082717bbc7a52d718f171d9fbb 100644 (file)
@@ -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
 
 ?>