Skip to content

Commit

Permalink
Merge branch 'MDL-41585' of https://github.com/totara/openbadges
Browse files Browse the repository at this point in the history
  • Loading branch information
Damyon Wiese committed Mar 5, 2014
2 parents a59b2e1 + 762b2a6 commit 3294c1e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
19 changes: 13 additions & 6 deletions badges/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public function print_badge_table_actions($badge, $context) {

// Outputs issued badge with actions available.
protected function render_issued_badge(issued_badge $ibadge) {
global $USER, $CFG, $DB;
global $USER, $CFG, $DB, $SITE;
$issued = $ibadge->issued;
$userinfo = $ibadge->recipient;
$badgeclass = $ibadge->badgeclass;
Expand Down Expand Up @@ -316,11 +316,18 @@ protected function render_issued_badge(issued_badge $ibadge) {

// Recipient information.
$datatable->data[] = array($this->output->heading(get_string('recipientdetails', 'badges'), 3), '');
$datatable->data[] = array(get_string('name'), fullname($userinfo));
if (empty($userinfo->backpackemail)) {
$datatable->data[] = array(get_string('email'), obfuscate_mailto($userinfo->accountemail));
if ($userinfo->deleted) {
$strdata = new stdClass();
$strdata->user = fullname($userinfo);
$strdata->site = format_string($SITE->fullname, true, array('context' => context_system::instance()));
$datatable->data[] = array(get_string('name'), get_string('error:userdeleted', 'badges', $strdata));
} else {
$datatable->data[] = array(get_string('email'), obfuscate_mailto($userinfo->backpackemail));
$datatable->data[] = array(get_string('name'), fullname($userinfo));
if (empty($userinfo->backpackemail)) {
$datatable->data[] = array(get_string('email'), obfuscate_mailto($userinfo->accountemail));
} else {
$datatable->data[] = array(get_string('email'), obfuscate_mailto($userinfo->backpackemail));
}
}

$datatable->data[] = array($this->output->heading(get_string('issuerdetails', 'badges'), 3), '');
Expand Down Expand Up @@ -938,7 +945,7 @@ public function __construct($hash) {
if ($rec) {
// Get a recipient from database.
$namefields = get_all_user_name_fields(true, 'u');
$user = $DB->get_record_sql("SELECT u.id, $namefields,
$user = $DB->get_record_sql("SELECT u.id, $namefields, u.deleted,
u.email AS accountemail, b.email AS backpackemail
FROM {user} u LEFT JOIN {badge_backpack} b ON u.id = b.userid
WHERE u.id = :userid", array('userid' => $rec->userid));
Expand Down
1 change: 1 addition & 0 deletions lang/en/badges.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@
$string['error:requesttimeout'] = 'The connection request timed out before it could complete.';
$string['error:requesterror'] = 'The connection request failed (error code {$a}).';
$string['error:save'] = 'Cannot save the badge.';
$string['error:userdeleted'] = '{$a->user} (This user no longer exists in {$a->site})';
$string['evidence'] = 'Evidence';
$string['existingrecipients'] = 'Existing badge recipients';
$string['expired'] = 'Expired';
Expand Down

0 comments on commit 3294c1e

Please sign in to comment.