MDL-67974 core_badges: Badge expiry date when hover

Text displayed for expired badges when the user hovers over the
warning (!) icon has been fixed in the "Issued badge information"
page.
This commit is contained in:
Sara Arjona 2021-02-23 15:23:53 +01:00
parent a93828a188
commit 5b4204a584

View File

@ -322,7 +322,15 @@ class core_badges_renderer extends plugin_renderer_base {
$badgeclass = $ibadge->badgeclass;
$badge = new badge($ibadge->badgeid);
$now = time();
$expiration = isset($issued['expires']) ? $issued['expires'] : $now + 86400;
if (isset($issued['expires'])) {
if (!is_numeric($issued['expires'])) {
$issued['expires'] = strtotime($issued['expires']);
}
$expiration = $issued['expires'];
} else {
$expiration = $now + 86400;
}
$badgeimage = is_array($badgeclass['image']) ? $badgeclass['image']['id'] : $badgeclass['image'];
$languages = get_string_manager()->get_list_of_languages();
@ -432,9 +440,6 @@ class core_badges_renderer extends plugin_renderer_base {
}
$dl[get_string('dateawarded', 'badges')] = userdate($issued['issuedOn']);
if (isset($issued['expires'])) {
if (!is_numeric($issued['expires'])) {
$issued['expires'] = strtotime($issued['expires']);
}
if ($issued['expires'] < $now) {
$dl[get_string('expirydate', 'badges')] = userdate($issued['expires']) . get_string('warnexpired', 'badges');