Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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_questionnaire/mobile_view_activity_page
19
 
20
    Template which defines a questionnaire display in the mobile app.
21
 
22
    Context variables required for this template:
23
    * questionnaire - object: "intro" and "autonumquestions" strings for first respondent link.
24
    * previous - object: "url" and "title" strings for previous link.
25
    * respnumber - object: Current positio ("currpos") and "total" number of responses.
26
    * next - object: "url" and "title" strings for next link.
27
    * lastrespondent - object: "url" and "title" strings for last respondent link.
28
    * listlink - string: Url of the link back to the response list.
29
    * printaction - string: HTML to launch the print function.
30
 
31
    Example context (json):
32
    {
33
        "cmid": 985,
34
        "userid": 267,
35
        "intro": "Welcome to the questionnaire",
36
        "autonumquestions": "1",
37
        "id": "342",
38
        "rid": 0,
39
        "surveyid": "23",
40
        "action": "nextpage",
41
        "pagenum": 0,
42
        "nextpage": 1,
43
        "prevpage": 0,
44
        "hasmorepages": 1,
45
        "completed": "1",
46
        "complete_userdate": "Monday, 17 December 2018, 3:34pm",
47
        "emptypage": "0",
48
        "emptypage_content": "This is an empty page.",
49
        "pagequestions": [
50
            {
51
                "id": 5432,
52
                "type_id": 4,
53
                "qnum": "Q1",
54
                "content": "Answer this question",
55
                "required": "1",
56
                "fieldkey": "response_1_23",
57
                "isselect": "0",
58
                "isbool": "0",
59
                "isradiobutton": "1",
60
                "ischeckbox": "0",
61
                "istextessay": "0",
62
                "israte": "0",
63
                "choices": [
64
                    {
65
                        "id": 745,
66
                        "content": "Red",
67
                        "value": " ",
68
                        "choice_id": 745,
69
                        "min": 0,
70
                        "max": 5,
71
                        "minstr": "Low",
72
                        "maxstr": "High",
73
                        "na": 0
74
                    }
75
                ]
76
            }
77
        ]
78
    }
79
}}
80
{{=<% %>=}}
81
<div>
82
    <core-course-module-description description="<%intro%>"
83
                                    component="mod_questionnaire" componentId="<%cmid%>"
84
                                    pagenum="<%pagenum%>"></core-course-module-description>
85
    <%#notifications%>
86
    <ion-card>
87
        <ion-card-content>
88
            <%{notifications}%>
89
        </ion-card-content>
90
    </ion-card>
91
    <%/notifications%>
92
    <div>
93
        <ion-card>
94
            <ion-list>
95
                <%#pagequestions%>
96
                <ion-item class="ion-text-wrap">
97
                    <%#autonumquestions%><ion-badge color="dark" slot="start"><%qnum%></ion-badge><%/autonumquestions%>
98
                    <ion-label>
99
                        <core-format-text text="<%content%>"></core-format-text>
100
                    </ion-label>
101
                    <%#required%><ion-badge slot="end" color="danger">{{ 'plugin.mod_questionnaire.required' | translate }}</ion-badge><%/required%>
102
                </ion-item>
103
                <%#isselect%>
104
                    <%> mod_questionnaire/local/mobile/latest/select_question %>
105
                <%/isselect%>
106
                <%#isbool%>
107
                    <%> mod_questionnaire/local/mobile/latest/boolean_question %>
108
                <%/isbool%>
109
                <%#isradiobutton%>
110
                    <%> mod_questionnaire/local/mobile/latest/radio_question %>
111
                <%/isradiobutton%>
112
                <%#ischeckbox%>
113
                    <%> mod_questionnaire/local/mobile/latest/checkbox_question %>
114
                <%/ischeckbox%>
115
                <%#istextessay%>
116
                    <%> mod_questionnaire/local/mobile/latest/text_question %>
117
                <%/istextessay%>
118
                <%#isnumeric%>
119
                    <%> mod_questionnaire/local/mobile/latest/numeric_question %>
120
                <%/isnumeric%>
121
                <%#isdate%>
122
                    <%> mod_questionnaire/local/mobile/latest/date_question %>
123
                <%/isdate%>
124
                <%#israte%>
125
                    <%> mod_questionnaire/local/mobile/latest/rate_question %>
126
                <%/israte%>
127
                <%#isslider%>
128
                <%> mod_questionnaire/local/mobile/latest/slider_question %>
129
                <%/isslider%>
130
                <%/pagequestions%>
131
 
132
                <%^pagequestions%>
133
                <ion-item>
134
                    <ion-label>
135
                        <p>No questions found.</p>
136
                    </ion-label>
137
                </ion-item>
138
                <%/pagequestions%>
139
 
140
                <%#hasmorepages%>
141
                <ion-grid class="ion-text-wrap">
142
                    <ion-row>
143
                        <%#prevpage%>
144
                        <ion-col>
145
                            <ion-button expand="block" fill="outline" core-site-plugins-new-content component="mod_questionnaire"
146
                                method="mobile_view_activity"
147
                                [args]="{
148
                                                cmid: <%cmid%>,
149
                                                rid: <%rid%>,
150
                                                completeq: 1,
151
                                                action: 'previouspage',
152
                                                pagenum: <%pagenum%>
153
                                            }"
154
                                [useOtherData]="null"
155
                                [preSets]="{getFromCache: 0, saveToCache: 0}"
156
                                refreshOnSuccess="true"
157
                                samePage="true" type="submit"
158
                            >
159
                                <ion-icon name="fas-chevron-left" slot="start" aria-hidden="true"></ion-icon>
160
                                {{ 'plugin.mod_questionnaire.previouspage' | translate }}
161
                            </ion-button>
162
                        </ion-col>
163
                        <%/prevpage%>
164
 
165
                        <%#nextpage%>
166
                        <ion-col>
167
                            <ion-button expand="block" fill="outline" core-site-plugins-new-content component="mod_questionnaire"
168
                                method="mobile_view_activity"
169
                                [args]="{
170
                                                cmid: <%cmid%>,
171
                                                rid: <%rid%>,
172
                                                completeq: 1,
173
                                                action: 'nextpage',
174
                                                pagenum: <%pagenum%>
175
                                            }"
176
                                [useOtherData]="null"
177
                                [preSets]="{getFromCache: 0, saveToCache: 0}"
178
                                refreshOnSuccess="true"
179
                                samePage="true" type="submit"
180
                            >
181
                                <ion-icon name="fas-chevron-right" slot="end" aria-hidden="true"></ion-icon>
182
                                {{ 'plugin.mod_questionnaire.nextpage' | translate }}
183
                            </ion-button>
184
                        </ion-col>
185
                        <%/nextpage%>
186
                    </ion-row>
187
                </ion-grid>
188
                <%/hasmorepages%>
189
 
190
                <%^nextpage%><%^completed%>
191
                <ion-button expand="block" class="ion-margin" core-site-plugins-new-content component="mod_questionnaire"
192
                        method="mobile_view_activity"
193
                        [args]="{
194
                                    questionnaireid: <%id%>,
195
                                    surveyid: <%surveyid%>,
196
                                    userid: <%userid%>,
197
                                    cmid: <%cmid%>,
198
                                    pagenum: <%pagenum%>,
199
                                    completed: <%completed%>,
200
                                    rid: <%rid%>,
201
                                    submit: 1,
202
                                    action: 'submit'
203
                                }"
204
                        [useOtherData]="null"
205
                        [preSets]="{getFromCache: 0, saveToCache: 0}"
206
                        refreshOnSuccess="true"
207
                        samePage="true" type="submit"
208
                >{{ 'plugin.mod_questionnaire.savechanges' | translate }}</ion-button>
209
                <%/completed%><%/nextpage%>
210
            </ion-list>
211
        </ion-card>
212
    </div>
213
    <%#emptypage%>
214
    <%/emptypage%>
215
</div>