mirrored from git://git.moodle.org/moodle.git
/
index.php
48 lines (39 loc) · 1.91 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
<?php // $Id$
/// Load libraries
require_once('../../config.php');
require_once('const.php');
require_once('locallib.php');
require_once('localfuncs.php');
require_once('authorizenetlib.php');
/// Parameters
$orderid = optional_param('order', 0, PARAM_INT);
$courseid = optional_param('course', SITEID, PARAM_INT);
$userid = optional_param('user', 0, PARAM_INT);
/// Get course
if (! $course = get_record('course', 'id', $courseid)) {
error('Could not find that course');
}
/// Only site users can access to this page
require_login(); // Don't use $courseid! User may want to see old orders.
if (has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM), $USER->id, false)) {
error("Guests cannot use this page.");
}
/// Load strings. All strings should be defined here. locallib.php uses these strings.
$strs = get_strings(array('search','status','action','time','course','confirm','no','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',
'transid','settlementdate','notsettled','amount','unenrolstudent'), 'enrol_authorize');
/// Print header
$strpaymentmanagement = get_string('paymentmanagement', 'enrol_authorize');
print_header_simple($strpaymentmanagement, "", "<a href=\"index.php\">$strpaymentmanagement</a>");
/// If orderid is empty, user wants to see all orders
if (empty($orderid)) {
authorize_print_orders($courseid, $userid);
} else {
authorize_print_order_details($orderid);
}
/// Print footer
print_footer();
?>