Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / enrol / authorize / index.php
blob90682c12c62638af1c06d73077b7c67201b4a91a
1 <?php // $Id$
3 /// Load libraries
4 require_once('../../config.php');
5 require_once('const.php');
6 require_once('locallib.php');
7 require_once('localfuncs.php');
8 require_once('authorizenetlib.php');
10 /// Parameters
11 $orderid = optional_param('order', 0, PARAM_INT);
12 $courseid = optional_param('course', SITEID, PARAM_INT);
13 $userid = optional_param('user', 0, PARAM_INT);
15 /// Get course
16 if (! $course = get_record('course', 'id', $courseid)) {
17 error('Could not find that course');
20 /// Only site users can access to this page
21 require_login(); // Don't use $courseid! User may want to see old orders.
23 if (has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM), $USER->id, false)) {
24 error("Guests cannot use this page.");
27 /// Load strings. All strings should be defined here. locallib.php uses these strings.
28 $strs = get_strings(array('search','status','action','time','course','confirm','no','all','none','error'));
29 $authstrs = get_strings(array('orderid','nameoncard','echeckfirslasttname','void','capture','refund','delete',
30 'allpendingorders','authcaptured','authorizedpendingcapture','capturedpendingsettle','settled',
31 'refunded','cancelled','expired','underreview','approvedreview','reviewfailed','tested','new',
32 'paymentmethod','methodcc','methodecheck',
33 'transid','settlementdate','notsettled','amount','unenrolstudent'), 'enrol_authorize');
35 /// Print header
36 $strpaymentmanagement = get_string('paymentmanagement', 'enrol_authorize');
37 $navlinks = array();
38 $navlinks[] = array('name' => $strpaymentmanagement, 'link' => 'index.php', 'type' => 'misc');
39 $navigation = build_navigation($navlinks);
41 print_header_simple($strpaymentmanagement, "", $navigation);
43 /// If orderid is empty, user wants to see all orders
44 if (empty($orderid)) {
45 authorize_print_orders($courseid, $userid);
46 } else {
47 authorize_print_order_details($orderid);
50 /// Print footer
51 print_footer();