mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-23502 php docs improvements and cleanup
This commit is contained in:
parent
5379726a09
commit
24a625725a
@ -18,9 +18,10 @@
|
||||
/**
|
||||
* Adds new instance of enrol_paypal to specified course.
|
||||
*
|
||||
* @package enrol_paypal
|
||||
* @copyright 2010 Eugene Venter
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @package enrol
|
||||
* @subpackage paypal
|
||||
* @copyright 2010 Eugene Venter
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require('../../config.php');
|
||||
|
@ -1,24 +0,0 @@
|
||||
<DBMIGRATION type="enrol/paypal" VERSION="2005120100">
|
||||
<TABLES>
|
||||
<TABLE name="enrol_paypal">
|
||||
<FIELDS>
|
||||
<FIELD name="business" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="receiver_email" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="receiver_id" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="item_name" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="memo" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="tax" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="option_name1" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="option_selection1_x" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="option_name2" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="option_selection2_x" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="payment_status" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="pending_reason" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="reason_code" method="NO_CONV" type="varchar" length="30" />
|
||||
<FIELD name="txn_id" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="parent_txn_id" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="payment_type" method="NO_CONV" type="varchar" length="30" />
|
||||
</FIELDS>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</DBMIGRATION>
|
@ -1,8 +1,29 @@
|
||||
<?php
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the paypal enrolment plugin
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* This file keeps track of upgrades to the paypal enrolment plugin
|
||||
*
|
||||
* @package enrol
|
||||
* @subpackage paypal
|
||||
* @copyright 2010 Eugene Venter
|
||||
* @author Eugene Venter
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
|
@ -15,25 +15,23 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @package enrol_paypal
|
||||
* Listens for Instant Payment Notification from PayPal
|
||||
*
|
||||
* This script waits for Payment notification from PayPal,
|
||||
* then double checks that data by sending it back to PayPal.
|
||||
* If PayPal verifies this then it sets up the enrolment for that
|
||||
* user.
|
||||
*
|
||||
* @package enrol
|
||||
* @subpackage paypal
|
||||
* @copyright 2010 Eugene Venter
|
||||
* @author Eugene Venter - based on code by others
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Eugene Venter - based on code by others
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Listens for Instant Payment Notification from PayPal
|
||||
*
|
||||
* This script waits for Payment notification from PayPal,
|
||||
* then double checks that data by sending it back to PayPal.
|
||||
* If PayPal verifies this then it sets up the enrolment for that
|
||||
* user.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
require("../../config.php");
|
||||
require("lib.php");
|
||||
require_once("lib.php");
|
||||
require_once($CFG->libdir.'/eventslib.php');
|
||||
require_once($CFG->libdir.'/enrollib.php');
|
||||
|
||||
|
@ -18,9 +18,10 @@
|
||||
/**
|
||||
* Strings for component 'enrol_paypal', language 'en', branch 'MOODLE_20_STABLE'
|
||||
*
|
||||
* @package enrol_paypal
|
||||
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @package enrol
|
||||
* @subpackage paypal
|
||||
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['defaultrole'] = 'Default role assignment';
|
||||
|
@ -19,17 +19,19 @@
|
||||
*
|
||||
* This plugin allows you to set up paid courses.
|
||||
*
|
||||
* @package enrol_paypal
|
||||
* @package enrol
|
||||
* @subpackage paypal
|
||||
* @copyright 2010 Eugene Venter
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
/**
|
||||
* Paypal enrolment plugin implementation.
|
||||
* @author Eugene Venter - based on code by Martin Dougiamas and others
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
class enrol_paypal_plugin extends enrol_plugin {
|
||||
|
||||
/**
|
||||
|
@ -1,40 +1,63 @@
|
||||
<?php
|
||||
|
||||
require("../../config.php");
|
||||
require_once("$CFG->dirroot/enrol/paypal/lib.php");
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
$id = required_param('id', PARAM_INT);
|
||||
/**
|
||||
* Paypal utility script
|
||||
*
|
||||
* @package enrol
|
||||
* @subpackage paypal
|
||||
* @subpackage file
|
||||
* @copyright 2004 onwards Martin Dougiamas (http://dougiamas.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
if (!$course = $DB->get_record("course", array("id"=>$id))) {
|
||||
redirect($CFG->wwwroot);
|
||||
}
|
||||
require("../../config.php");
|
||||
require_once("$CFG->dirroot/enrol/paypal/lib.php");
|
||||
|
||||
if (! $context = get_context_instance(CONTEXT_COURSE, $course->id)) {
|
||||
redirect($CFG->wwwroot);
|
||||
}
|
||||
$id = required_param('id', PARAM_INT);
|
||||
|
||||
require_login();
|
||||
if (!$course = $DB->get_record("course", array("id"=>$id))) {
|
||||
redirect($CFG->wwwroot);
|
||||
}
|
||||
|
||||
/// Refreshing enrolment data in the USER session
|
||||
load_all_capabilities();
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
|
||||
if ($SESSION->wantsurl) {
|
||||
$destination = $SESSION->wantsurl;
|
||||
unset($SESSION->wantsurl);
|
||||
} else {
|
||||
$destination = "$CFG->wwwroot/course/view.php?id=$course->id";
|
||||
}
|
||||
require_login();
|
||||
|
||||
if (is_enrolled($context, NULL, '', true)) { // TODO: use real paypal check
|
||||
redirect($destination, get_string('paymentthanks', '', $course->fullname));
|
||||
// Refreshing enrolment data in the USER session
|
||||
load_all_capabilities();
|
||||
|
||||
} else { /// Somehow they aren't enrolled yet! :-(
|
||||
$PAGE->set_url($destination);
|
||||
echo $OUTPUT->header();
|
||||
$a = new stdClass();
|
||||
$a->teacher = get_string('defaultcourseteacher');
|
||||
$a->fullname = format_string($course->fullname);
|
||||
notice(get_string('paymentsorry', '', $a), $destination);
|
||||
}
|
||||
if ($SESSION->wantsurl) {
|
||||
$destination = $SESSION->wantsurl;
|
||||
unset($SESSION->wantsurl);
|
||||
} else {
|
||||
$destination = "$CFG->wwwroot/course/view.php?id=$course->id";
|
||||
}
|
||||
|
||||
if (is_enrolled($context, NULL, '', true)) { // TODO: use real paypal check
|
||||
redirect($destination, get_string('paymentthanks', '', $course->fullname));
|
||||
|
||||
} else { /// Somehow they aren't enrolled yet! :-(
|
||||
$PAGE->set_url($destination);
|
||||
echo $OUTPUT->header();
|
||||
$a = new stdClass();
|
||||
$a->teacher = get_string('defaultcourseteacher');
|
||||
$a->fullname = format_string($course->fullname);
|
||||
notice(get_string('paymentsorry', '', $a), $destination);
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,10 +18,11 @@
|
||||
/**
|
||||
* Paypal enrolments plugin settings and presets.
|
||||
*
|
||||
* @package enrol_paypal
|
||||
* @copyright 2010 Eugene Venter
|
||||
* @author Eugene Venter - based on code by Petr Skoda and others
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @package enrol
|
||||
* @subpackage paypal
|
||||
* @copyright 2010 Eugene Venter
|
||||
* @author Eugene Venter - based on code by Petr Skoda and others
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
@ -55,9 +56,6 @@ if ($ADMIN->fulltree) {
|
||||
|
||||
$settings->add(new admin_setting_configselect('enrol_paypal/currency', get_string('currency', 'enrol_paypal'), '', 'USD', $paypalcurrencies));
|
||||
|
||||
$settings->add(new admin_setting_configcheckbox('enrol_paypal/defaultenrol',
|
||||
get_string('defaultenrol', 'enrol'), get_string('defaultenrol_desc', 'enrol'), 0));
|
||||
|
||||
$options = array(ENROL_INSTANCE_ENABLED => get_string('yes'),
|
||||
ENROL_INSTANCE_DISABLED => get_string('no'));
|
||||
$settings->add(new admin_setting_configselect_with_advanced('enrol_paypal/status',
|
||||
|
@ -17,11 +17,14 @@
|
||||
/**
|
||||
* Paypal enrolment plugin version specification.
|
||||
*
|
||||
* @package enrol_paypal
|
||||
* @copyright 2010 Eugene Venter
|
||||
* @author Eugene Venter
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @package enrol
|
||||
* @subpackage paypal
|
||||
* @copyright 2010 Eugene Venter
|
||||
* @author Eugene Venter
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2010071500;
|
||||
$plugin->requires = 2007101000; // Requires this Moodle version
|
||||
|
Loading…
x
Reference in New Issue
Block a user