Skip to content

Commit 83f841e

Browse files
dpaloumdjnelson
authored andcommitted
Mobile app: Create ionic5 template duplicating latest
1 parent 02de845 commit 83f841e

File tree

2 files changed

+170
-1
lines changed

2 files changed

+170
-1
lines changed

classes/output/mobile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static function mobile_view_activity($args) {
4242
global $OUTPUT, $DB, $USER;
4343

4444
$args = (object) $args;
45-
$versionname = $args->appversioncode >= 3950 ? 'latest' : 'ionic3';
45+
$versionname = $args->appversioncode >= 44000 ? 'latest' : 'ionic5';
4646

4747
$cmid = $args->cmid;
4848
$groupid = empty($args->group) ? 0 : (int) $args->group; // By default, group 0.
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
{{!
2+
This file is part of Moodle - http://moodle.org/
3+
4+
Moodle is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
Moodle is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
}}
17+
{{!
18+
@template mod_customcert/mobile_view_activity_page
19+
20+
The main page to view the custom certificate activity
21+
22+
Classes required for JS:
23+
* None
24+
25+
Data attibutes required for JS:
26+
* All data attributes are required
27+
28+
Context variables required for this template:
29+
* certificate
30+
* cmid
31+
* hasissues
32+
* issues
33+
* showgroups
34+
* groups
35+
* canmanage
36+
* requiredtimemet
37+
* hasrecipients
38+
* recipients
39+
* fileurl
40+
* showreport
41+
* currenttimestamp
42+
43+
Example context (json):
44+
{
45+
"certificate": {
46+
"id": "1",
47+
"course": "2",
48+
"name": "A rad certificate name!",
49+
"intro": "A certificate",
50+
"requiredtime": "60"
51+
},
52+
"cmid": "25",
53+
"issue": {
54+
"timecreated": "1528370177"
55+
},
56+
"showgroups": "true",
57+
"groups": [
58+
{
59+
"id": "2",
60+
"selected": "false",
61+
"name": "Group A"
62+
}
63+
],
64+
"canmanage": "true",
65+
"requiredtimemet": "true",
66+
"fileurl": "http://yoursite.com/mod/customcert/mobile/pluginfile.php?id=4",
67+
"showreport": "true",
68+
"hasrecipients": "true",
69+
"recipients": [
70+
{
71+
"id": "2",
72+
"issueid": "3",
73+
"displayname": "Michaelangelo (Mickey)",
74+
"fileurl": "http://yoursite.com/mod/customcert/mobile/pluginfile.php?id=4",
75+
"timecreated": "1528370177"
76+
}
77+
],
78+
"currenttimestamp": "1528370177"
79+
}
80+
}}
81+
{{=<% %>=}}
82+
<core-course-module-description description="<% certificate.intro %>" component="mod_customcert" componentId="<% cmid %>"></core-course-module-description>
83+
<ion-list>
84+
<%^canmanage%>
85+
<%#requiredtimemet%>
86+
<ion-item>
87+
<ion-label>
88+
{{ 'plugin.mod_customcert.receiveddate' | translate }}
89+
<br />
90+
<div class="timerewarded">
91+
<%#issue%>
92+
{{ <% timecreated %> * 1000 | coreFormatDate }}
93+
<%/issue%>
94+
<%^issue%>
95+
{{ 'plugin.mod_customcert.notissued' | translate }}
96+
<%/issue%>
97+
</div>
98+
</ion-label>
99+
<div slot="end" class="flex-row">
100+
<ion-button fill="clear" [core-download-file]="{fileurl: '<% fileurl %>', timemodified: '<% currenttimestamp %>'}" moduleId="<% cmid %>" courseId="<% certificate.course %>" component="mod_customcert" [attr.aria-label]="'core.download' | translate">
101+
<ion-icon name="cloud-download" slot="icon-only" aria-hidden="true"></ion-icon>
102+
</ion-button>
103+
</div>
104+
</ion-item>
105+
<%/requiredtimemet%>
106+
<%^requiredtimemet%>
107+
<ion-item>
108+
<ion-label>
109+
<p>{{ 'plugin.mod_customcert.requiredtimenotmet' | translate: {$a: { requiredtime: <% certificate.requiredtime %>} } }}</p>
110+
</ion-label>
111+
</ion-item>
112+
<%/requiredtimemet%>
113+
<%/canmanage%>
114+
<%#canmanage%>
115+
<ion-button expand="block" class="ion-margin" core-course-download-module-main-file moduleId="<% cmid %>" courseId="<% certificate.course %>" component="mod_customcert" [files]="[{fileurl: '<% fileurl %>', timemodified: '<% currenttimestamp %>'}]">
116+
<ion-icon name="cloud-download" slot="start" aria-hidden="true"></ion-icon>
117+
{{ 'plugin.mod_customcert.getcustomcert' | translate }}
118+
</ion-button>
119+
<%/canmanage%>
120+
<%#showreport%>
121+
<ion-item>
122+
<ion-label>
123+
{{ 'plugin.mod_customcert.listofissues' | translate: { $a: <% numrecipients %> } }}
124+
</ion-label>
125+
</ion-item>
126+
<%#showgroups%>
127+
<ion-item>
128+
<ion-label>{{ 'plugin.mod_customcert.selectagroup' | translate }}</ion-label>
129+
<ion-select [(ngModel)]="CONTENT_OTHERDATA.group" name="group" (ionChange)="updateContent({cmid: <% cmid %>, courseid: <% certificate.course %>, group: CONTENT_OTHERDATA.group})" interface="popover">
130+
<%#groups%>
131+
<ion-select-option [value]="<% id %>"><% name %></ion-select-option>
132+
<%/groups%>
133+
</ion-select>
134+
</ion-item>
135+
<%/showgroups%>
136+
<%#hasrecipients%>
137+
<%#recipients%>
138+
<ion-item>
139+
<ion-label>
140+
<% displayname %>
141+
<br />
142+
<div class="timerewarded">{{ <% timecreated %> * 1000 | coreFormatDate }}</div>
143+
</ion-label>
144+
<div slot="end" class="flex-row">
145+
<ion-button fill="clear" [core-download-file]="{fileurl: '<% fileurl %>', timemodified: '<% currenttimestamp %>'}" moduleId="<% cmid %>" courseId="<% certificate.course %>" component="mod_customcert" [attr.aria-label]="'core.download' | translate">
146+
<ion-icon name="cloud-download" slot="icon-only" aria-hidden="true"></ion-icon>
147+
</ion-button>
148+
<%#canmanage%>
149+
<ion-button fill="clear" core-site-plugins-call-ws name="mod_customcert_delete_issue"
150+
[params]="{certificateid: <% certificate.id %>, issueid: <% issueid %>}"
151+
[preSets]="{getFromCache: 0, saveToCache: 0, typeExpected: 'boolean'}"
152+
confirmMessage="{{ 'plugin.mod_customcert.deleteissueconfirm' | translate }}"
153+
refreshOnSuccess="true" [attr.aria-label]="'core.delete' | translate">
154+
<ion-icon name="fas-trash" slot="icon-only" aria-hidden="true"></ion-icon>
155+
</ion-button>
156+
<%/canmanage%>
157+
</div>
158+
</ion-item>
159+
<%/recipients%>
160+
<%/hasrecipients%>
161+
<%^hasrecipients%>
162+
<ion-item>
163+
<ion-label>
164+
{{ 'plugin.mod_customcert.nothingtodisplay' | translate }}
165+
</ion-label>
166+
</ion-item>
167+
<%/hasrecipients%>
168+
<%/showreport%>
169+
</ion-list>

0 commit comments

Comments
 (0)