Skip to content

Commit

Permalink
initial commit for extension of the viewed element
Browse files Browse the repository at this point in the history
  • Loading branch information
DocDanou committed Aug 6, 2024
1 parent 5c83f5d commit 02ea6dd
Show file tree
Hide file tree
Showing 2 changed files with 230 additions and 0 deletions.
172 changes: 172 additions & 0 deletions templates/core_courseformat/local/content/cm/activity.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_courseformat/local/content/cm/activity
Display the activity content of a cm.
Example context (json):
{
"cmname": {
"displayvalue" : "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Activity example</span></a>"
},
"hasname": "true",
"afterlink": "<span class=\"resourcelinkdetails\">24.7&nbsp;KB · Uploaded 26/05/23, 16:29</span>",
"activitybadge": {
"badgecontent": "PDF",
"badgestyle": "badge-none",
"badgeurl": "http://example.org/help",
"badgeelementid": "myelementid",
"badgeextraattributes": [
{
"name": "data-el1name",
"value": "el1value"
},
{
"name": "data-el2name",
"value": "el2value"
}
]
},
"hasextras": true,
"extras": ["<span class=\"badge bg-secondary\">[extras]</span>"],
"activityinfo": {
"hasmodavailability": true,
"activityname": "Activity example",
"hascompletion": true,
"uservisible": true,
"hasdates": true,
"isautomatic": true,
"istrackeduser": true,
"activitydates": [
{
"label": "Opens:",
"datestring": "6 April 2021, 6:46 PM"
}
],
"completiondetails": [
{
"statuscomplete": 1,
"description": "Viewed"
},
{
"statusincomplete": 1,
"description": "Receive a grade"
}
]
},
"visibility": {
"isInteractive": false,
"modhiddenfromstudents": true
}
}
}}
{{#moveicon}} {{{moveicon}}} {{/moveicon}}
<div class="activity-grid {{^hasname}}noname-grid{{/hasname}}">

{{! Icon, Name & Badge }}
{{#hasname}}
{{#cmname}}
{{$ core_courseformat/local/content/cm/cmname }}
{{> core_courseformat/local/content/cm/cmname }}
{{/ core_courseformat/local/content/cm/cmname }}
{{/cmname}}
{{/hasname}}

{{! Dates }}
{{#dates}}
{{#hasdates}}
<div data-region="activity-dates" class="activity-dates mr-sm-2">
{{#activitydates}}
{{$core_course/activity_date}}
{{>core_course/activity_date}}
{{/core_course/activity_date}}
{{/activitydates}}
</div>
{{/hasdates}}
{{/dates}}

{{! Visibility }}
{{$ core_courseformat/local/content/cm/badges }}
{{> core_courseformat/local/content/cm/badges }}
{{/ core_courseformat/local/content/cm/badges }}

{{! Group mode }}
{{#groupmodeinfo}}
<div
class="activity-groupmode-info align-self-start ml-sm-2"
data-region="groupmode"
>
{{$ core_courseformat/local/content/cm/groupmode}}
{{> core_courseformat/local/content/cm/groupmode}}
{{/ core_courseformat/local/content/cm/groupmode}}
</div>
{{/groupmodeinfo}}

{{! Tarsus mode }}
{{^tarsussettinginfo}}
<div
class="activity-tarsus-info align-self-start ml-sm-2"
data-region="tarsussetting"
>
{{$ core_courseformat/local/content/cm/tarsussetting}}
{{> core_courseformat/local/content/cm/tarsussetting}}
{{/ core_courseformat/local/content/cm/tarsussetting}}
</div>
{{/tarsussettinginfo}}

{{! Completion }}
{{#completion}}
{{#hascompletion}}
<div class="activity-completion align-self-start ml-sm-2">
{{$ core_courseformat/local/content/cm/activity_info}}
{{> core_courseformat/local/content/cm/activity_info}}
{{/ core_courseformat/local/content/cm/activity_info}}
</div>
{{/hascompletion}}
{{/completion}}

{{! Action menu }}
{{#controlmenu}}
<div class="activity-actions bulk-hidden align-self-start ml-sm-2">
{{$ core_courseformat/local/content/cm/controlmenu }}
{{> core_courseformat/local/content/cm/controlmenu }}
{{/ core_courseformat/local/content/cm/controlmenu }}
</div>
{{/controlmenu}}

{{! Description }}
{{#altcontent}}
<div class="activity-altcontent d-flex text-break {{#hasname}}activity-description{{/hasname}}">
{{{altcontent}}}
</div>
{{/altcontent}}

{{! Availability }}
{{#modavailability}}
{{$ core_courseformat/local/content/cm/availability }}
{{> core_courseformat/local/content/cm/availability }}
{{/ core_courseformat/local/content/cm/availability }}
{{/modavailability}}

{{! Afterlink }}
{{#afterlink}}
<div class="activity-afterlink afterlink d-flex align-items-center">
{{{afterlink}}}
</div>
{{/afterlink}}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_courseformat/local/content/cm/tarsussetting
Container to display tarsus information on the course page.
Example context (json):
{
"activityname": "Course announcements",
"groupicon": "i/groupv",
"groupalt": "Visible groups"
}
}}

{{#isInteractive}}
{{#dropwdown}}
{{< core/local/dropdown/status}}
{{$ buttonclasses }}
{{#autohide}} v-parent-focus {{/autohide}}
tarsus-information btn btn-icon icon-no-margin
{{/ buttonclasses }}
{{$ buttoncontent }}
{{{groupicon}}}
<span class="tarsus-icon-info">{{groupalt}}</span>
{{/ buttoncontent }}
{{/ core/local/dropdown/status}}
{{/dropwdown}}
{{/isInteractive}}
{{^isInteractive}}
<div
data-region="tarsus-information"
data-activityname="{{activityname}}"
class="tarsus-information d-flex align-items-center justify-content-center icon-no-margin"
>
<button class="v-parent-focus tarsus-information btn btn-icon icon-no-margin">
{{#pix}}i/search, core, {{#str}}frontend_cm_tarsus_status, local_lai_connector{{/str}}{{/pix}}
<div class="tarsus-icon-info ml-1">{{#str}}frontend_cm_tarsus_status, local_lai_connector{{/str}}</div>
</button>



</div>
{{/isInteractive}}

0 comments on commit 02ea6dd

Please sign in to comment.