Skip to content

Commit

Permalink
Merge pull request #8 from andreasschenkel/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
andreasschenkel authored Mar 11, 2023
2 parents 19abdc1 + 9a1f734 commit 44d8e6e
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 46 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
## Changelog ##
[[v1.4.1]] 20230311

- new feature: show how many courses a user is enroled with a role
- fix spacing problems with the agenda
- new position for the icons that indicates if a course is hidden

[[v1.4.0]] 20221211
- new feature: fold or unfold courselist on start

Expand Down
47 changes: 29 additions & 18 deletions block_overviewmyrolesincourses.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,15 @@ public function get_content() {
$data->foldonstart = $foldonstart;
$data->mylist = $this->get_courses_enroled_with_roleid($USER->id,
$enroledcourses, $rolefixname->id, $favouritecourseids);
$data->counter = count($data->mylist);
// To get example-json for mustache uncomment following line of code.
// This can be uses to get a json-example $objectasjson = json_encode($data);
// Now render the content for this role and concatenate it with the previous rendered content.
if (count($data->mylist) > 0) {
$data->courses = get_string('course');
if (count($data->mylist) > 1) {
$data->courses = get_string('courses');
}
$text .= $OUTPUT->render_from_template('block_overviewmyrolesincourses/overviewmyrolesincourses', $data);
}
}
Expand Down Expand Up @@ -255,35 +260,41 @@ private function create_duration(stdClass $course): stdClass {
public function create_agenda(): string {
$agenda = "";
if ($this->config->showpast) {
$agenda .= '<div class="row" style="margin-left: 3px;">' .
'<div class="overviewmyrolesincourses-coursefinished" style="width: 95px;">' .
get_string('past', 'block_overviewmyrolesincourses') .
'</div>' .
$agenda .= '<div class="container">' .
'<div class="row">' .
'<div class="col col-sm-5 overviewmyrolesincourses-coursefinished">' .
get_string('past', 'block_overviewmyrolesincourses') .
'</div>' .

'<div class="overviewmyrolesincourses-coursefinished dimmed" style="width: 110px;">' .
get_string('butnotvisible', 'block_overviewmyrolesincourses') .
'<div class="col col-sm-7 overviewmyrolesincourses-coursefinished dimmed">' .
get_string('butnotvisible', 'block_overviewmyrolesincourses') .
'</div>' .
'</div>' .
'</div>';
}

if ($this->config->showinprogress) {
$agenda .= '<div class="row" style="margin-left: 3px;">' .
'<div class="overviewmyrolesincourses-courseinprogress" style="width: 95px;">' .
get_string('inprogress', 'block_overviewmyrolesincourses') .
'</div>' .
'<div class="overviewmyrolesincourses-courseinprogress dimmed" style="width: 110px;">' .
get_string('butnotvisible', 'block_overviewmyrolesincourses') .
$agenda .= '<div class="container">' .
'<div class="row">' .
'<div class="col col-sm-5 overviewmyrolesincourses-courseinprogress">' .
get_string('inprogress', 'block_overviewmyrolesincourses') .
'</div>' .
'<div class="col col-sm-7 overviewmyrolesincourses-courseinprogress dimmed">' .
get_string('butnotvisible', 'block_overviewmyrolesincourses') .
'</div>' .
'</div>' .
'</div>';
}

if ($this->config->showfuture) {
$agenda .= '<div class="row" style="margin-left: 3px;">' .
'<div class="overviewmyrolesincourses-coursefuture" style="width: 95px;">' .
get_string('future', 'block_overviewmyrolesincourses') .
'</div>' .
'<div class="overviewmyrolesincourses-coursefuture dimmed" style="width: 110px;">' .
get_string('butnotvisible', 'block_overviewmyrolesincourses') .
$agenda .= '<div class="container">' .
'<div class="row">' .
'<div class="col col-sm-5 overviewmyrolesincourses-coursefuture">' .
get_string('future', 'block_overviewmyrolesincourses') .
'</div>' .
'<div class="col col-sm-7 overviewmyrolesincourses-coursefuture dimmed">' .
get_string('butnotvisible', 'block_overviewmyrolesincourses') .
'</div>' .
'</div>' .
'</div>';
}
Expand Down
47 changes: 35 additions & 12 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,61 @@
background-color: #eee;
}

.overviewmyrolesincourses-coursefinished {
.col.overviewmyrolesincourses-coursefinished {
border-left: solid 5px rgb(155, 13, 13);
margin-bottom: 5px;
margin-bottom: 0;
padding-left: 5px;
}
.overviewmyrolesincourses-coursefinished.dimmed {
.col.overviewmyrolesincourses-coursefinished.dimmed {
border-left: solid 5px rgb(166, 119, 119);
margin-bottom: 5px;
margin-bottom: 0;
padding-left: 5px;
}

.overviewmyrolesincourses-courseinprogress {
.col.overviewmyrolesincourses-courseinprogress {
border-left: solid 5px rgb(53, 244, 127);
margin-bottom: 5px;
margin-bottom: 0;
padding-left: 5px;
}
.overviewmyrolesincourses-courseinprogress.dimmed {
.col.overviewmyrolesincourses-courseinprogress.dimmed {
border-left: solid 5px rgb(111, 169, 134);
margin-bottom: 5px;
margin-bottom: 0;
padding-left: 5px;
}

.overviewmyrolesincourses-coursefuture {
.col.overviewmyrolesincourses-coursefuture {
border-left: solid 5px rgb(58, 132, 241);
margin-bottom: 5px;
margin-bottom: 0;
padding-left: 5px;
}
.overviewmyrolesincourses-coursefuture.dimmed {
.col.overviewmyrolesincourses-coursefuture.dimmed {
border-left: solid 5px rgb(158, 190, 238);
margin-bottom: 5px;
margin-bottom: 0;
padding-left: 5px;
}
.overviewmyrolesincourses-foldonstart {
display: none;
}

.row.duration {
margin-left: 0px;
}
.row.duration .col-8 {
padding-left: 0;
}
.row.duration .col-4 {
padding-right: 10px;
}






.overviewmyrolesincourses-tools {
text-align: right;
}

.summary .no-overflow p {
margin-bottom: 0.5rem;
}
32 changes: 18 additions & 14 deletions templates/overviewmyrolesincourses.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -82,32 +82,36 @@
}
</script>
<div class="border p-2 overviewmyrolesincourses-bg-{{roleshortname}}" onclick="myFunction{{roleshortname}}()">
{{rolelocalname}}
{{rolelocalname}} {{counter}} {{courses}}
</div>
<div id="overviewmyrolesincourses-visibility-{{roleshortname}}"
class="{{#foldonstart}}overviewmyrolesincourses-foldonstart{{/foldonstart}}">
class="{{#foldonstart}}overviewmyrolesincourses-foldonstart{{/foldonstart}}">
{{#mylist}}
<div class="border p-1">
<div class="{{cssselectordurationstatusofcourse}} {{dimmed}}">
<div class="{{dimmed}}">
<a href="{{url}}" class="{{dimmed}}" title="{{coursefullname}}">
<i class="icon fa fa-graduation-cap fa-fw"></i>{{coursefullname}}
</a>
<div class="border">
<div class="col {{cssselectordurationstatusofcourse}} {{dimmed}}">
<div class="{{dimmed}}">
<a href="{{url}}" class="{{dimmed}}" title="{{coursefullname}}">
<i class="icon fa fa-graduation-cap fa-fw"></i>{{coursefullname}}
</a>
</div>
<div class="row duration">
<div class="{{dimmed}} col-8">
{{duration}}
</div>
<div class="col-4 overviewmyrolesincourses-tools">
{{#favourite}}
{{/favourite}}
{{^dimmed}}<span><i class="fa fa-eye" aria-hidden="true"></i></span>{{/dimmed}}
{{#dimmed}}<span><i class="fa fa-eye-slash" aria-hidden="true"></i></span>{{/dimmed}}
{{#showdeleteicon}}
<a href="{{urldelete}}">
<i class="fa fa-trash" aria-hidden="true"></i>
</a>
{{/showdeleteicon}}
{{#favourite}}
{{/favourite}}
</div>
<div class="{{dimmed}}">
{{duration}}
</div>
</div>
</div>
</div>
{{/mylist}}
</div>
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die;

$plugin->maturity = MATURITY_STABLE;
$plugin->version = 2022121100;
$plugin->version = 2023031100;
$plugin->component = 'block_overviewmyrolesincourses';
$plugin->requires = 2017111300;
$plugin->release = 'v1.4.0';
$plugin->release = 'v1.4.1';

0 comments on commit 44d8e6e

Please sign in to comment.