Skip to content

Commit

Permalink
Make show information alert colors accessible - gjbarnard#88 - thanks…
Browse files Browse the repository at this point in the history
… to https://github.com/haietza for the colours.
  • Loading branch information
gjb2048 authored and NinaHerrmann committed Dec 22, 2020
1 parent 8c157aa commit 4f685df
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 19 deletions.
1 change: 1 addition & 0 deletions Changes.md
Expand Up @@ -12,6 +12,7 @@ Version 3.9.1.0 - TBC
9. No students port from Adaptable - https://gitlab.com/jezhops/moodle-theme_adaptable/-/issues/185.
10. Fix 'Due date disappears when moving activities' - #87.
11. Fix 'Issue with Assignment Meta-information' - #86.
12. Make show information alert colors accessible - #88 - thanks to https://github.com/haietza for the colours.

Version 3.9.0.4 - 31/07/2020
1. Add 'Duplicate section' functionality from 'onetopic' format, thanks to David Herney Bernal for the code - #72.
Expand Down
26 changes: 11 additions & 15 deletions classes/course_renderer.php
Expand Up @@ -272,7 +272,6 @@ protected function course_section_cm_get_meta(cm_info $mod) {
return '';
}
$content = '';
$duedate = '';

$warningclass = '';
if ($meta->submitted) {
Expand All @@ -289,7 +288,7 @@ protected function course_section_cm_get_meta(cm_info $mod) {
} else {
// Only display if this is really a student on the course (i.e. not anyone who can grade an assignment).
if (!has_capability('mod/assign:grade', $mod->context)) {
$content .= html_writer::start_tag('div', array('class' => 'ct-activity-mod-engagement' . $warningclass));
$content .= html_writer::start_tag('div', array('class' => 'ct-activity-mod-engagement'.$warningclass));
$content .= $activitycontent;
$content .= html_writer::end_tag('div');
}
Expand All @@ -307,8 +306,6 @@ protected function course_section_cm_get_meta(cm_info $mod) {
$dateformat = get_string('strftimedate', 'langconfig');
$due = get_string('due', 'format_topcoll', userdate($meta->$field, $dateformat));

$pastdue = $meta->$field < time();

// Create URL for due date.
$url = new \moodle_url("/mod/{$mod->modname}/view.php", ['id' => $mod->id]);
$dateformat = get_string('strftimedate', 'langconfig');
Expand All @@ -317,17 +314,18 @@ protected function course_section_cm_get_meta(cm_info $mod) {

/* Display assignment status (due, nearly due, overdue), as long as it hasn't been submitted,
or submission not required. */
if ( (!$meta->submitted) && (!$meta->submissionnotrequired) ) {
if ((!$meta->submitted) && (!$meta->submissionnotrequired)) {
$warningclass = '';
$labeltext = '';

$time = time();
// If assignment is 7 days before date due(nearly due).
$timedue = $meta->$field - (86400 * 7);
if ( (time() > $timedue) && !(time() > $meta->$field) ) {
if (($time > $timedue) && ($time <= $meta->$field)) {
if ($mod->modname == 'assign') {
$warningclass = ' ct-activity-date-nearly-due';
}
} else if (time() > $meta->$field) { // If assignment is actually overdue.
} else if ($time > $meta->$field) { // If assignment is actually overdue.
if ($mod->modname == 'assign') {
$warningclass = ' ct-activity-date-overdue';
}
Expand All @@ -338,15 +336,14 @@ protected function course_section_cm_get_meta(cm_info $mod) {

$activityclass = '';
if ($mod->modname == 'assign') {
$activityclass = 'ct-activity-due-date';
$activityclass = 'ct-activity-due-date';
}
$duedate .= html_writer::start_tag('span', array('class' => $activityclass . $warningclass));
$duedate = html_writer::start_tag('span', array('class' => $activityclass . $warningclass));
$duedate .= html_writer::link($url, $labeltext);
$duedate .= html_writer::end_tag('span');
$content .= html_writer::start_tag('div', array('class' => 'ct-activity-mod-engagement'));
$content .= $duedate . html_writer::end_tag('div');
}

$content .= html_writer::start_tag('div', array('class' => 'ct-activity-mod-engagement'));
$content .= $duedate . html_writer::end_tag('div');
}

if ($meta->isteacher) {
Expand Down Expand Up @@ -379,7 +376,7 @@ protected function course_section_cm_get_meta(cm_info $mod) {

$icon = $this->output->pix_icon('docs', get_string('info'));
$content .= html_writer::start_tag('div', array('class' => 'ct-activity-mod-engagement'));
$content .= html_writer::link($url, $icon . $engagementstr);
$content .= html_writer::link($url, $icon.$engagementstr, array('class' => 'ct-activity-action'));
$content .= html_writer::end_tag('div');
}

Expand All @@ -403,7 +400,6 @@ protected function course_section_cm_get_meta(cm_info $mod) {
// TODO - spit out a 'submissions allowed from' tag.
return $content;
}

}

return $content;
Expand Down Expand Up @@ -447,7 +443,7 @@ public function submission_cta(cm_info $mod, \format_topcoll\activity_meta $meta
$message = $this->output->pix_icon($warningicon, get_string('warning', 'format_topcoll')).$warningstr;
}

return html_writer::link($url, $message);
return html_writer::link($url, $message, array('class' => 'ct-activity-action'));
}
return '';
}
Expand Down
32 changes: 28 additions & 4 deletions styles.css
Expand Up @@ -818,16 +818,40 @@ body.jsenabled #toggle-all {
font-size: 1.1em;
}

.format-topcoll .ct-activity-date-overdue {
background-color: #ee0000;
.format-topcoll .ct-activity-action {
margin: 0 7px;
}

.format-topcoll .ct-activity-action i {
margin-right: 0.35rem;
}

.format-topcoll .ct-activity-date-submitted {
background-color: #00cc00;
background-color: #d4edda;
}

.format-topcoll .ct-activity-date-submitted a {
color: #155724;
}

.format-topcoll .ct-activity-date-nearly-due {
background-color: #f79100;
background-color: #FFF3CD;
}

.format-topcoll .ct-activity-date-nearly-due a {
color: #856404;
}

.format-topcoll .ct-activity-date-overdue {
background-color: #f8d7da;
}

.format-topcoll .ct-activity-date-overdue a {
color: #721c24;
}

.format-topcoll .ct-activity-date-overdue .text-warning {
color: #721C24 !important;
}

.format-topcoll .ct-activity-due-date .icon,
Expand Down

0 comments on commit 4f685df

Please sign in to comment.