Skip to content

Commit

Permalink
Make show information alert colors accessible - #88 - thanks to https…
Browse files Browse the repository at this point in the history
…://github.com/haietza for the colours.
  • Loading branch information
gjb2048 committed Jan 17, 2021
1 parent 4905f4c commit 516da42
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 @@ -13,6 +13,7 @@ Version 3.8.1.2 - TBD
10. No students port from Adaptable - https://gitlab.com/jezhops/moodle-theme_adaptable/-/issues/185.
11. Fix 'Due date disappears when moving activities' - #87.
12. Fix 'Issue with Assignment Meta-information' - #86.
13. Make show information alert colors accessible - #88 - thanks to https://github.com/haietza for the colours.

Version 3.8.1.1 - 29/06/2020
1. Added 'Course page further information' functionality from Adaptable theme.
Expand Down
26 changes: 11 additions & 15 deletions classes/course_renderer.php
Expand Up @@ -270,7 +270,6 @@ protected function course_section_cm_get_meta(cm_info $mod) {
return '';
}
$content = '';
$duedate = '';

$warningclass = '';
if ($meta->submitted) {
Expand All @@ -287,7 +286,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 @@ -305,8 +304,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 @@ -315,17 +312,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 @@ -336,15 +334,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 @@ -377,7 +374,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 @@ -401,7 +398,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 @@ -445,7 +441,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 @@ -814,16 +814,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 516da42

Please sign in to comment.