Skip to content

Commit

Permalink
$a->course: course information added. Merged from stable.
Browse files Browse the repository at this point in the history
  • Loading branch information
ethem committed Jun 15, 2006
1 parent 8dd19dd commit 2bc509a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions enrol/authorize/enrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ function check_openssl_loaded() {
*/
function cron()
{
global $CFG;
global $CFG, $SITE;
require_once($CFG->dirroot.'/enrol/authorize/authorizenetlib.php');

$oneday = 86400;
Expand Down Expand Up @@ -658,30 +658,36 @@ function cron()
$a = new stdClass;
$a->pending = $count;
$a->days = $CFG->an_emailexpired;
$a->course = $SITE->shortname;
$subject = get_string('pendingorderssubject', 'enrol_authorize', $a);
$a = new stdClass;
$a->pending = $count;
$a->days = $CFG->an_emailexpired;
$a->course = $SITE->fullname;
$a->enrolurl = "$CFG->wwwroot/$CFG->admin/users.php";
$a->url = $CFG->wwwroot."/enrol/authorize/index.php?status=".AN_STATUS_AUTH;
$message = get_string('pendingordersemail', 'enrol_authorize', $a);
$adminuser = get_admin();
email_to_user($adminuser, $adminuser, $subject, $message);
if (!empty($CFG->an_teachermanagepay) and !empty($CFG->an_emailexpiredteacher)) {
$sorttype = empty($CFG->an_sorttype) ? 'ttl' : $CFG->an_sorttype;
$sql = "SELECT E.courseid, E.currency, COUNT(E.courseid) AS cnt, SUM(E.amount) as ttl " .
$sql = "SELECT E.courseid, E.currency, C.fullname, C.shortname, " .
"COUNT(E.courseid) AS cnt, SUM(E.amount) as ttl " .
"FROM {$CFG->prefix}enrol_authorize E " .
"INNER JOIN {$CFG->prefix}course C ON C.id = E.courseid " .
"WHERE $select GROUP BY E.courseid ORDER BY $sorttype DESC";
$message = ''; $subject = ''; $lastcourse = 0;
$courseidandcounts = get_records_sql($sql);
foreach($courseidandcounts as $courseidandcount) {
if ($lastcourse != $courseidandcount->courseid) {
$lastcourse = $courseidandcount->courseid;
$a = new stdClass;
$a->course = $courseidandcount->shortname;
$a->pending = $courseidandcount->cnt;
$a->days = $CFG->an_emailexpired;
$subject = get_string('pendingorderssubject', 'enrol_authorize', $a);
$a = new stdClass;
$a->course = $courseidandcount->fullname;
$a->pending = $courseidandcount->cnt;
$a->currency = $courseidandcount->currency;
$a->sumcost = $courseidandcount->ttl;
Expand Down

0 comments on commit 2bc509a

Please sign in to comment.