Skip to content

Commit

Permalink
add indicator for roles that are not core roles and add some css for …
Browse files Browse the repository at this point in the history
…backgroundcolor for non core roles
  • Loading branch information
Andreas Schenkel authored and Andreas Schenkel committed Jan 20, 2024
1 parent 467ece6 commit 19f4906
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 6 additions & 0 deletions block_overviewmyrolesincourses.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,17 @@ public function get_content() {
// 4. To mark favourite courses get the ids
$favouritecourseids = self::get_favourite_course_ids($USER->id);
// 5. Check for every role if the role is supported and then in which courses the user has this role.
$coreroles = ['manager', 'coursecreator', 'editingteacher', 'teacher', 'student'];
foreach ($rolefixnames as $rolefixname) {
$data = new stdClass();
if (in_array($rolefixname->id, $configuredsupportedroles)) {
// 5. If role is supported then add look in the enrolled courses if the user is enrolled with this role.
$data->roleshortname = $rolefixname->shortname;
if (in_array($rolefixname->shortname, $coreroles)) {
$data->iscorerole = true;
} else {
$data->iscorerole = false;
}
$data->rolelocalname = $rolefixname->localname;
$data->foldonstart = $foldonstart;
$data->mylist = $this->get_courses_enroled_with_roleid(
Expand Down
11 changes: 7 additions & 4 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
background-color: #ddd;
}

div[class*="overviewmyrolesincourses-bg-"]:not([class*="manager"]):not([class*="editingteacher"]):not([class*="teacher"]):not([class*="student"]) {
.overviewmyrolesincourses .isnotcorerole {
background-color: #eee;
}

Expand All @@ -29,6 +29,7 @@ div[class*="overviewmyrolesincourses-bg-"]:not([class*="manager"]):not([class*="
padding-left: 5px;
padding-right: 5px;
}

.overviewmyrolesincourses-coursefinished.dimmed {
border-left: solid 5px rgb(166, 119, 119);
margin-bottom: 0;
Expand All @@ -42,6 +43,7 @@ div[class*="overviewmyrolesincourses-bg-"]:not([class*="manager"]):not([class*="
padding-left: 5px;
padding-right: 5px;
}

.overviewmyrolesincourses-courseinprogress.dimmed {
border-left: solid 5px rgb(111, 169, 134);
margin-bottom: 0;
Expand All @@ -55,22 +57,26 @@ div[class*="overviewmyrolesincourses-bg-"]:not([class*="manager"]):not([class*="
padding-left: 5px;
padding-right: 5px;
}

.overviewmyrolesincourses-coursefuture.dimmed {
border-left: solid 5px rgb(158, 190, 238);
margin-bottom: 0;
padding-left: 5px;
padding-right: 5px;
}

.overviewmyrolesincourses-foldonstart {
display: none;
}

.overviewmyrolesincourses .row.duration {
margin-left: 0;
}

.overviewmyrolesincourses .row.duration .col-8 {
padding-left: 0;
}

.overviewmyrolesincourses .row.duration .col-4 {
padding-right: 10px;
}
Expand All @@ -89,6 +95,3 @@ div[class*="overviewmyrolesincourses-bg-"]:not([class*="manager"]):not([class*="
padding-left: 3px;
padding-right: 5px;
}



2 changes: 1 addition & 1 deletion templates/overviewmyrolesincourses.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
element.classList.toggle("overviewmyrolesincourses-foldonstart");
}
</script>
<div class="border p-2 overviewmyrolesincourses-bg-{{roleshortname}}" onclick="myFunction{{roleshortname}}()">
<div class="border p-2 overviewmyrolesincourses-bg-{{roleshortname}} {{#iscorerole}}iscorerole{{/iscorerole}} {{^iscorerole}}isnotcorerole{{/iscorerole}}" onclick="myFunction{{roleshortname}}()">
<span class="overviewmyrolesincourses-rolelocalname">{{rolelocalname}}</span>
<span class="overviewmyrolesincourses-separator">:</span>
<span class="overviewmyrolesincourses-counter">{{counter}}</span>
Expand Down

0 comments on commit 19f4906

Please sign in to comment.