@@ -53,15 +53,15 @@ public function filter($text, array $options = array()) {
53
53
// do the replacements
54
54
foreach ($ identifiers as $ value => $ label ) {
55
55
if (stripos ($ text , "[[units:: {$ label }]] " ) !== false ) {
56
- $ html = filter_units::get_units ($ pool , $ current , $ value );
56
+ $ html = filter_units::get_units ($ pool , $ current , $ value, $ label );
57
57
$ text = str_ireplace ("[[units:: {$ label }]] " , $ html , $ text );
58
58
}
59
59
}
60
60
61
61
return $ text ;
62
62
}
63
63
64
- static function get_units ($ pool , $ current_course , $ attrib_value ) {
64
+ static function get_units ($ pool , $ current_course , $ attrib_value, $ attrib_label = '' ) {
65
65
global $ CFG , $ PAGE , $ USER , $ OUTPUT ;
66
66
67
67
// filter the list of courses to just those that match the unittype value
@@ -93,7 +93,7 @@ static function get_units($pool, $current_course, $attrib_value) {
93
93
94
94
95
95
// draw a figure / figcaption for the course
96
- $ html [] = \html_writer::start_tag ('figure ' , ['class ' => 'coursebox ' ]);
96
+ $ html [] = \html_writer::start_tag ('figure ' , ['class ' => 'coursebox ' . strtolower ( $ attrib_label ) ]);
97
97
$ link = new \moodle_url ('/course/view.php ' , array ('id ' => $ course ->id ));
98
98
// proxy course link through an opener url that sets this page as the coursehome in the session
99
99
$ url = new \moodle_url ('/filter/units/open.php ' , array ('from ' => $ PAGE ->url ->out (), 'to ' => $ link ->out (true )));
0 commit comments