-
Notifications
You must be signed in to change notification settings - Fork 4
/
return.php
36 lines (27 loc) · 969 Bytes
/
return.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require("../../config.php");
require_once("$CFG->dirroot/enrol/flutterwave/lib.php");
$id = required_param('id', PARAM_INT);
if (!$course = $DB->get_record("course", array("id" => $id))) {
redirect($CFG->wwwroot);
}
$context = context_course::instance($course->id, MUST_EXIST);
$PAGE->set_context($context);
require_login();
if (!empty($SESSION->wantsurl)) {
$destination = $SESSION->wantsurl;
unset($SESSION->wantsurl);
} else {
$destination = "$CFG->wwwroot/course/view.php?id=$course->id";
}
$fullname = format_string($course->fullname, true, array('context' => $context));
if (is_enrolled($context, null, '', true)) {
redirect($destination, get_string('paymentthanks', '', $fullname));
} else {
$PAGE->set_url($destination);
echo $OUTPUT->header();
$a = new stdClass();
$a->teacher = get_string('defaultcourseteacher');
$a->fullname = $fullname;
notice(get_string('paymentsorry', '', $a), $destination);
}