@@ -49,6 +49,7 @@ public function __construct() {
49
49
'classname ' => get_string ('classname ' , 'tool_task ' ),
50
50
'type ' => get_string ('tasktype ' , 'admin ' ),
51
51
'time ' => get_string ('taskage ' , 'tool_task ' ),
52
+ 'progress ' => get_string ('progress ' , 'core ' ),
52
53
'timestarted ' => get_string ('started ' , 'tool_task ' ),
53
54
'hostname ' => get_string ('hostname ' , 'tool_task ' ),
54
55
'pid ' => get_string ('pid ' , 'tool_task ' ),
@@ -153,4 +154,29 @@ public function col_time($row): string {
153
154
public function col_timestarted ($ row ): string {
154
155
return userdate ($ row ->timestarted );
155
156
}
157
+
158
+ /**
159
+ * Format the progress column.
160
+ *
161
+ * @param \stdClass $row
162
+ * @return string
163
+ */
164
+ public function col_progress ($ row ): string {
165
+ global $ DB ;
166
+
167
+ // Check to see if there is a stored progress record for this task.
168
+ if ($ row ->type === 'adhoc ' ) {
169
+ $ idnumber = \core \stored_progress_bar::convert_to_idnumber ($ row ->classname , $ row ->id );
170
+ } else {
171
+ $ idnumber = \core \stored_progress_bar::convert_to_idnumber ($ row ->classname );
172
+ }
173
+
174
+ $ bar = \core \stored_progress_bar::get_by_idnumber ($ idnumber );
175
+ if ($ bar ) {
176
+ return $ bar ->get_content ();
177
+ } else {
178
+ return '- ' ;
179
+ }
180
+ }
181
+
156
182
}
0 commit comments