Skip to content

Commit

Permalink
fixup! MDL-81714 grades: Add regrading progress indicator to grade re…
Browse files Browse the repository at this point in the history
…ports
  • Loading branch information
marxjohnson committed Sep 4, 2024
1 parent d581376 commit 6069f99
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 19 deletions.
7 changes: 3 additions & 4 deletions grade/report/grader/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,13 @@

$reportname = get_string('pluginname', 'gradereport_grader');
$regradetask = \core_course\task\regrade_final_grades::create($courseid);
$indicatorheader = get_string('recalculatinggrades', 'grades');
$indicatorheading = get_string('recalculatinggrades', 'grades');
$indicatormessage = get_string('recalculatinggradesadhoc', 'grades');
$indictoricon = new pix_icon('i/grades', '');
$taskindicator = new \core\output\task_indicator($regradetask, $indicatorheader, $indicatormessage, $indictoricon, $PAGE->url);
$taskindicator = new \core\output\task_indicator($regradetask, $indicatorheading, $indicatormessage, $PAGE->url);
if (!$taskindicator->has_task_record()) {
// Do this check just before printing the grade header (and only do it once).
grade_regrade_final_grades_if_required($course);
$taskindicator = new \core\output\task_indicator($regradetask, $indicatorheader, $indicatormessage, $indictoricon, $PAGE->url);
$taskindicator = new \core\output\task_indicator($regradetask, $indicatorheading, $indicatormessage, $PAGE->url);
}

//Initialise the grader report object that produces the table
Expand Down
5 changes: 3 additions & 2 deletions grade/report/outcomes/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@
// First make sure we have proper final grades.
$regradetask = \core_course\task\regrade_final_grades::create($courseid);
$indicatormessage = get_string('recalculatinggradesadhoc', 'grades');
$taskindicator = new \core\output\task_indicator($regradetask, $indicatormessage);
$indicatorheading = get_string('recalculatinggrades', 'grades');
$taskindicator = new \core\output\task_indicator($regradetask, $indicatorheading, $indicatormessage, $PAGE->url);
if (!$taskindicator->has_task_record()) {
grade_regrade_final_grades_if_required($course);
$taskindicator = new \core\output\task_indicator($regradetask, $indicatormessage);
$taskindicator = new \core\output\task_indicator($regradetask, $indicatorheading, $indicatormessage, $PAGE->url);
}

// Grab all outcomes used in course.
Expand Down
1 change: 0 additions & 1 deletion grade/report/overview/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
\core_course\task\regrade_final_grades::create($courseid),
get_string('recalculatinggrades', 'grades'),
get_string('recalculatinggradesadhoc', 'grades'),
new \core\output\pix_icon('i/grades', ''),
$PAGE->url,
);

Expand Down
1 change: 0 additions & 1 deletion grade/report/singleview/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@
\core_course\task\regrade_final_grades::create($courseid),
get_string('recalculatinggrades', 'grades'),
get_string('recalculatinggradesadhoc', 'grades'),
new \core\output\pix_icon('i/grades', ''),
$PAGE->url,
);

Expand Down
1 change: 0 additions & 1 deletion grade/report/summary/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
\core_course\task\regrade_final_grades::create($courseid),
get_string('recalculatinggrades', 'grades'),
get_string('recalculatinggradesadhoc', 'grades'),
new \core\output\pix_icon('i/grades', ''),
$PAGE->url,
);

Expand Down
1 change: 0 additions & 1 deletion grade/report/user/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
\core_course\task\regrade_final_grades::create($courseid),
get_string('recalculatinggrades', 'grades'),
get_string('recalculatinggradesadhoc', 'grades'),
new \core\output\pix_icon('i/grades', ''),
$PAGE->url,
);

Expand Down
1 change: 0 additions & 1 deletion grade/report/user/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ function grade_report_user_profilereport(object $course, object $user, bool $vie
\core_course\task\regrade_final_grades::create($course->id),
get_string('recalculatinggrades', 'grades'),
get_string('recalculatinggradesadhoc', 'grades'),
new \core\output\pix_icon('i/grades', ''),
new \core\url('/course/user.php', ['mode' => 'grade', 'id' => $course->id, 'user' => $user->id]),
);

Expand Down
7 changes: 3 additions & 4 deletions lib/classes/output/task_indicator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class task_indicator implements renderable, templatable {
* @param adhoc_task $task The task whose progress is being indicated. The task class must use stored_progress_task_trait.
* @param string $heading The header text for the indicator.
* @param string $message A message to explain what is happening while the task is running.
* @param ?pix_icon $icon An optional icon to display with the heading.
* @param ?url $redirecturl An optional URL to redirect to when the task completes.
* @param ?pix_icon $icon An optional icon to display with the heading.
* @param array $extraclasses Extra class names to apply to the indicator's container.
* @throws \coding_exception
*/
Expand All @@ -57,10 +57,10 @@ public function __construct(
protected string $heading,
/** @var string $message A message to explain what is happening while the task is running. */
protected string $message,
/** @var ?pix_icon $icon An optional icon to display with the heading. */
protected ?pix_icon $icon = null,
/** @var ?url $redirecturl An optional URL to redirect to when the task completes. */
protected ?url $redirecturl = null,
/** @var ?pix_icon $icon An optional icon to display with the heading. */
protected ?pix_icon $icon = new pix_icon('i/timer', ''),
/** @var array $extraclasses Extra class names to apply to the indicator's container. */
protected array $extraclasses = [],
) {
Expand All @@ -73,7 +73,6 @@ public function __construct(
$idnumber = stored_progress_bar::convert_to_idnumber($this->task::class, $this->task->get_id());
$this->progressbar = stored_progress_bar::get_by_idnumber($idnumber);
}
$this->icon->attributes['class'] .= 'iconsize-big';
}

/**
Expand Down
6 changes: 2 additions & 4 deletions lib/templates/task_indicator.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@
<div class="task-indicator {{extraclasses}}">
{{#icon}}
<div class="text-center">
<div class="icon-circle">
{{>core/pix_icon}}
</div>
{{>core/pix_icon}}
</div>
{{/icon}}
<h2 class="text-center">{{heading}}</h2>
<h3 class="text-center">{{heading}}</h3>
<p class="text-center">{{message}}</p>
{{#progress}}
{{>core/progress_bar}}
Expand Down
11 changes: 11 additions & 0 deletions pix/i/timer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions theme/boost/scss/moodle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ $breadcrumb-divider-rtl: "◀" !default;
@import "moodle/moodlenet";
@import "moodle/dropdown";
@import "moodle/deprecated";
@import "moodle/task-indicator";
16 changes: 16 additions & 0 deletions theme/boost/scss/moodle/task-indicator.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.task-indicator {
padding-top: 2rem;

img.icon {
width: 145px;
height: 145px;
max-height: 145px;
max-width: 145px;
font-size: 145px;
padding-bottom: 2rem;
}

.progressbar_container {
padding-top: 2rem;
}
}
15 changes: 15 additions & 0 deletions theme/boost/style/moodle.css
Original file line number Diff line number Diff line change
Expand Up @@ -39147,6 +39147,21 @@ body.behat-site .path-course-view li.activity form.togglecompletion::before,
max-width: none; /* The width is 0 so ensure we don't end up with a relative max-width */
}

.task-indicator {
padding-top: 2rem;
}
.task-indicator img.icon {
width: 145px;
height: 145px;
max-height: 145px;
max-width: 145px;
font-size: 145px;
padding-bottom: 2rem;
}
.task-indicator .progressbar_container {
padding-top: 2rem;
}

body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
Expand Down
15 changes: 15 additions & 0 deletions theme/classic/style/moodle.css
Original file line number Diff line number Diff line change
Expand Up @@ -39081,6 +39081,21 @@ body.behat-site .path-course-view li.activity form.togglecompletion::before,
max-width: none; /* The width is 0 so ensure we don't end up with a relative max-width */
}

.task-indicator {
padding-top: 2rem;
}
.task-indicator img.icon {
width: 145px;
height: 145px;
max-height: 145px;
max-width: 145px;
font-size: 145px;
padding-bottom: 2rem;
}
.task-indicator .progressbar_container {
padding-top: 2rem;
}

body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
Expand Down

0 comments on commit 6069f99

Please sign in to comment.