Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/enrol/paypal/return.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00028 require("../../config.php");
00029 require_once("$CFG->dirroot/enrol/paypal/lib.php");
00030 
00031 $id = required_param('id', PARAM_INT);
00032 
00033 if (!$course = $DB->get_record("course", array("id"=>$id))) {
00034     redirect($CFG->wwwroot);
00035 }
00036 
00037 $context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
00038 
00039 require_login();
00040 
00041 if ($SESSION->wantsurl) {
00042     $destination = $SESSION->wantsurl;
00043     unset($SESSION->wantsurl);
00044 } else {
00045     $destination = "$CFG->wwwroot/course/view.php?id=$course->id";
00046 }
00047 
00048 $fullname = format_string($course->fullname, true, array('context' => $context));
00049 
00050 if (is_enrolled($context, NULL, '', true)) { // TODO: use real paypal check
00051     redirect($destination, get_string('paymentthanks', '', $fullname));
00052 
00053 } else {   
00054     $PAGE->set_url($destination);
00055     echo $OUTPUT->header();
00056     $a = new stdClass();
00057     $a->teacher = get_string('defaultcourseteacher');
00058     $a->fullname = $fullname;
00059     notice(get_string('paymentsorry', '', $a), $destination);
00060 }
00061 
00062 
 All Data Structures Namespaces Files Functions Variables Enumerations