forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
80 lines (69 loc) · 2.88 KB
/
index.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?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/>.
/**
* Adds new instance of enrol_authorize to specified course
* or edits current instance.
*
* @package enrol
* @subpackage authorize
* @copyright 2010 Eugene Venter
* @author Eugene Venter
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/// Load libraries
require_once('../../config.php');
require_once('const.php');
require_once('locallib.php');
require_once('localfuncs.php');
require_once('authorizenet.class.php');
/// Parameters
$orderid = optional_param('order', 0, PARAM_INT);
$courseid = optional_param('course', SITEID, PARAM_INT);
$userid = optional_param('user', 0, PARAM_INT);
$url = new moodle_url('/enrol/authorize/index.php');
if ($orderid !== 0) {
$url->param('order', $orderid);
}
if ($courseid !== SITEID) {
$url->param('course', $courseid);
}
if ($userid !== 0) {
$url->param('user', $userid);
}
$PAGE->set_url($url);
/// Get course
if (!($course = $DB->get_record('course', array('id'=>$courseid)))) {
print_error('invalidcourseid', '', '', $courseid);
}
/// Only SITE users can access to this page
require_login(); // Don't use $courseid! User may want to see old orders.
if (isguestuser()) {
print_error('noguest');
}
/// Load strings. All strings should be defined here. locallib.php uses these strings.
$strs = get_strings(array('search','status','action','time','course','confirm','yes','no','cancel','all','none','error'));
$authstrs = get_strings(array('orderid','nameoncard','echeckfirslasttname','void','capture','refund','delete',
'allpendingorders','authcaptured','authorizedpendingcapture','capturedpendingsettle','settled',
'refunded','cancelled','expired','underreview','approvedreview','reviewfailed','tested','new',
'paymentmethod','methodcc','methodecheck', 'paymentmanagement', 'orderdetails', 'cclastfour', 'isbusinesschecking','shopper',
'transid','settlementdate','notsettled','amount','unenrolstudent'), 'enrol_authorize');
/// User wants to see all orders
if (empty($orderid)) {
authorize_print_orders($courseid, $userid);
}
else {
authorize_print_order($orderid);
}