mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
Merge branch 'MDL-43621_master' of https://github.com/totara/openbadges
This commit is contained in:
commit
efbed79063
@ -91,7 +91,7 @@ $namefields = get_all_user_name_fields(true, 'u');
|
||||
$sql = "SELECT b.userid, b.dateissued, b.uniquehash, $namefields
|
||||
FROM {badge_issued} b INNER JOIN {user} u
|
||||
ON b.userid = u.id
|
||||
WHERE b.badgeid = :badgeid
|
||||
WHERE b.badgeid = :badgeid AND u.deleted = 0
|
||||
ORDER BY $sortby $sorthow";
|
||||
|
||||
$totalcount = $DB->count_records('badge_issued', array('badgeid' => $badge->id));
|
||||
|
@ -663,7 +663,9 @@ class core_badges_renderer extends plugin_renderer_base {
|
||||
}
|
||||
|
||||
if (has_capability('moodle/badges:viewawarded', $context)) {
|
||||
$awarded = $DB->count_records('badge_issued', array('badgeid' => $badgeid));
|
||||
$awarded = $DB->count_records_sql('SELECT COUNT(b.userid)
|
||||
FROM {badge_issued} b INNER JOIN {user} u ON b.userid = u.id
|
||||
WHERE b.badgeid = :badgeid AND u.deleted = 0', array('badgeid' => $badgeid));
|
||||
$row[] = new tabobject('awards',
|
||||
new moodle_url('/badges/recipients.php', array('id' => $badgeid)),
|
||||
get_string('bawards', 'badges', $awarded)
|
||||
|
@ -331,10 +331,11 @@ class badge {
|
||||
*/
|
||||
public function has_awards() {
|
||||
global $DB;
|
||||
if ($DB->record_exists('badge_issued', array('badgeid' => $this->id))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
$awarded = $DB->record_exists_sql('SELECT b.uniquehash
|
||||
FROM {badge_issued} b INNER JOIN {user} u ON b.userid = u.id
|
||||
WHERE b.badgeid = :badgeid AND u.deleted = 0', array('badgeid' => $this->id));
|
||||
|
||||
return $awarded;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -349,7 +350,7 @@ class badge {
|
||||
'SELECT b.userid, b.dateissued, b.uniquehash, u.firstname, u.lastname
|
||||
FROM {badge_issued} b INNER JOIN {user} u
|
||||
ON b.userid = u.id
|
||||
WHERE b.badgeid = :badgeid', array('badgeid' => $this->id));
|
||||
WHERE b.badgeid = :badgeid AND u.deleted = 0', array('badgeid' => $this->id));
|
||||
|
||||
return $awards;
|
||||
}
|
||||
@ -815,7 +816,9 @@ function badges_get_badges($type, $courseid = 0, $sort = '', $dir = '', $page =
|
||||
$badges[$r->id]->dateissued = $r->dateissued;
|
||||
$badges[$r->id]->uniquehash = $r->uniquehash;
|
||||
} else {
|
||||
$badges[$r->id]->awards = $DB->count_records('badge_issued', array('badgeid' => $badge->id));
|
||||
$badges[$r->id]->awards = $DB->count_records_sql('SELECT COUNT(b.userid)
|
||||
FROM {badge_issued} b INNER JOIN {user} u ON b.userid = u.id
|
||||
WHERE b.badgeid = :badgeid AND u.deleted = 0', array('badgeid' => $badge->id));
|
||||
$badges[$r->id]->statstring = $badge->get_status_name();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user