From bf228101fd908d2252eca9ad3c3a190fb22aa75c Mon Sep 17 00:00:00 2001 From: ethem Date: Mon, 30 Oct 2006 08:33:00 +0000 Subject: [PATCH] Get only courses made transactions. This lessens the course list; Merged from 17stable. --- enrol/authorize/locallib.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/enrol/authorize/locallib.php b/enrol/authorize/locallib.php index ca7aea1ac3..4dee694fbd 100644 --- a/enrol/authorize/locallib.php +++ b/enrol/authorize/locallib.php @@ -18,7 +18,7 @@ define('ORDER_VOID', 'void'); */ function authorize_print_orders($courseid, $userid) { - global $CFG, $USER; + global $CFG, $USER, $SITE; global $strs, $authstrs; require_once($CFG->libdir.'/tablelib.php'); @@ -44,19 +44,16 @@ function authorize_print_orders($courseid, $userid) AN_STATUS_TEST => $authstrs->tested ); - $sql = "SELECT id, fullname FROM {$CFG->prefix}course "; + $sql = "SELECT c.id, c.fullname FROM {$CFG->prefix}course c INNER JOIN {$CFG->prefix}enrol_authorize e ON c.id = e.courseid "; if ($CFG->enrol == 'authorize') { // default enrolment plugin - $sql .= "WHERE (enrol IS NULL) OR (enrol='') OR (enrol = 'authorize') "; + $sql .= "WHERE (c.enrol IS NULL) OR (c.enrol='') OR (c.enrol = 'authorize') "; } else { - $sql .= "WHERE (enrol = 'authorize') "; + $sql .= "WHERE (c.enrol = 'authorize') "; } - $sql .= "ORDER BY sortorder, fullname"; - if ($courses = get_records_sql($sql)) { - $popupcrs = array(); - foreach ($courses as $crs) { - $popupcrs[$crs->id] = $crs->fullname; - } + $sql .= "ORDER BY c.sortorder, c.fullname"; + if ($popupcrs = get_records_sql_menu($sql)) { + $popupcrs[$SITE->id] = $SITE->fullname; echo ""; echo ""; echo "\n"; -- 2.39.5
$strs->status: ";popup_form($baseurl.'&course='.$courseid.'&status=',$statusmenu,'statusmenu',$status,'','','',false);echo"