Skip to content

Commit

Permalink
Add boilerplate to mustache
Browse files Browse the repository at this point in the history
  • Loading branch information
sharpchi committed Nov 17, 2023
1 parent cd85866 commit 49c2833
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
18 changes: 18 additions & 0 deletions classes/output/summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@
* Summary displayed on landing page.
*/
class summary implements renderable, templatable {
/**
* Student object
*
* @var object
*/
private $student;
/**
* Total expected hours
*
* @var float
*/
private $totalexpectedhours;
/**
* Total actual hours records
*
* @var float
*/
private $totalactualhours;
/**
* Constructor
*
Expand Down
53 changes: 53 additions & 0 deletions templates/summary.mustache
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
{{!
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 local_apprenticeoffjob/summary
Template to render Summary section.
Classes required for JS:
* none
Data attributes required for JS:
* none
Context variables required for this template:
* notify1 Statement 1 output
* notify2 Statement 3 output
* newactivity Information about the selected activity
* completedhours Total hours completed
* expectedhours Hours expected to be completed
* commitmentstatement Link to commitment statement
Example context (json):
{
"notify1": "<div>Notify html</div>",
"notify2": "<div>Notify html</div>",
"newactivity": {
"url": "http://mymoodle.example.com/local/apprenticeoffjob.activity",
"text": "Link text",
"class": "btn btn-secondary",
"id": "activitybutton"
},
"completedhours": 10.2,
"expectedhours": {
"total": 30,
"hoursleft": 19.8
},
"commitmentstatement": "http://mymoodle.example.com/link/to/file"
}
}}
<span class="notify1">
{{#notify1}}
{{> core/notification }}
Expand Down

0 comments on commit 49c2833

Please sign in to comment.