AutorÃa | Ultima modificación | Ver Log |
{{!
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 mod_questionnaire/mobile_view_activity_page
Template which defines a questionnaire display in the mobile app.
Context variables required for this template:
* questionnaire - object: "intro" and "autonumquestions" strings for first respondent link.
* previous - object: "url" and "title" strings for previous link.
* respnumber - object: Current positio ("currpos") and "total" number of responses.
* next - object: "url" and "title" strings for next link.
* lastrespondent - object: "url" and "title" strings for last respondent link.
* listlink - string: Url of the link back to the response list.
* printaction - string: HTML to launch the print function.
Example context (json):
{
"cmid": 985,
"userid": 267,
"intro": "Welcome to the questionnaire",
"autonumquestions": "1",
"id": "342",
"rid": 0,
"surveyid": "23",
"action": "nextpage",
"pagenum": 0,
"nextpage": 1,
"prevpage": 0,
"hasmorepages": 1,
"completed": "1",
"complete_userdate": "Monday, 17 December 2018, 3:34pm",
"emptypage": "0",
"emptypage_content": "This is an empty page.",
"pagequestions": [
{
"id": 5432,
"type_id": 4,
"qnum": "Q1",
"content": "Answer this question",
"required": "1",
"fieldkey": "response_1_23",
"isselect": "0",
"isbool": "0",
"isradiobutton": "1",
"ischeckbox": "0",
"istextessay": "0",
"israte": "0",
"choices": [
{
"id": 745,
"content": "Red",
"value": " ",
"choice_id": 745,
"min": 0,
"max": 5,
"minstr": "Low",
"maxstr": "High",
"na": 0
}
]
}
]
}
}}
{{=<% %>=}}
<div>
<core-course-module-description description="<%intro%>"
component="mod_questionnaire" componentId="<%cmid%>"
pagenum="<%pagenum%>"></core-course-module-description>
<%#notifications%>
<ion-card>
<ion-card-content>
<%{notifications}%>
</ion-card-content>
</ion-card>
<%/notifications%>
<div>
<ion-card>
<ion-list>
<%#pagequestions%>
<ion-item class="ion-text-wrap">
<%#autonumquestions%><ion-badge color="dark" slot="start"><%qnum%></ion-badge><%/autonumquestions%>
<ion-label>
<core-format-text text="<%content%>"></core-format-text>
</ion-label>
<%#required%><ion-badge slot="end" color="danger">{{ 'plugin.mod_questionnaire.required' | translate }}</ion-badge><%/required%>
</ion-item>
<%#isselect%>
<%> mod_questionnaire/local/mobile/latest/select_question %>
<%/isselect%>
<%#isbool%>
<%> mod_questionnaire/local/mobile/latest/boolean_question %>
<%/isbool%>
<%#isradiobutton%>
<%> mod_questionnaire/local/mobile/latest/radio_question %>
<%/isradiobutton%>
<%#ischeckbox%>
<%> mod_questionnaire/local/mobile/latest/checkbox_question %>
<%/ischeckbox%>
<%#istextessay%>
<%> mod_questionnaire/local/mobile/latest/text_question %>
<%/istextessay%>
<%#isnumeric%>
<%> mod_questionnaire/local/mobile/latest/numeric_question %>
<%/isnumeric%>
<%#isdate%>
<%> mod_questionnaire/local/mobile/latest/date_question %>
<%/isdate%>
<%#israte%>
<%> mod_questionnaire/local/mobile/latest/rate_question %>
<%/israte%>
<%#isslider%>
<%> mod_questionnaire/local/mobile/latest/slider_question %>
<%/isslider%>
<%/pagequestions%>
<%^pagequestions%>
<ion-item>
<ion-label>
<p>No questions found.</p>
</ion-label>
</ion-item>
<%/pagequestions%>
<%#hasmorepages%>
<ion-grid class="ion-text-wrap">
<ion-row>
<%#prevpage%>
<ion-col>
<ion-button expand="block" fill="outline" core-site-plugins-new-content component="mod_questionnaire"
method="mobile_view_activity"
[args]="{
cmid: <%cmid%>,
rid: <%rid%>,
completeq: 1,
action: 'previouspage',
pagenum: <%pagenum%>
}"
[useOtherData]="null"
[preSets]="{getFromCache: 0, saveToCache: 0}"
refreshOnSuccess="true"
samePage="true" type="submit"
>
<ion-icon name="fas-chevron-left" slot="start" aria-hidden="true"></ion-icon>
{{ 'plugin.mod_questionnaire.previouspage' | translate }}
</ion-button>
</ion-col>
<%/prevpage%>
<%#nextpage%>
<ion-col>
<ion-button expand="block" fill="outline" core-site-plugins-new-content component="mod_questionnaire"
method="mobile_view_activity"
[args]="{
cmid: <%cmid%>,
rid: <%rid%>,
completeq: 1,
action: 'nextpage',
pagenum: <%pagenum%>
}"
[useOtherData]="null"
[preSets]="{getFromCache: 0, saveToCache: 0}"
refreshOnSuccess="true"
samePage="true" type="submit"
>
<ion-icon name="fas-chevron-right" slot="end" aria-hidden="true"></ion-icon>
{{ 'plugin.mod_questionnaire.nextpage' | translate }}
</ion-button>
</ion-col>
<%/nextpage%>
</ion-row>
</ion-grid>
<%/hasmorepages%>
<%^nextpage%><%^completed%>
<ion-button expand="block" class="ion-margin" core-site-plugins-new-content component="mod_questionnaire"
method="mobile_view_activity"
[args]="{
questionnaireid: <%id%>,
surveyid: <%surveyid%>,
userid: <%userid%>,
cmid: <%cmid%>,
pagenum: <%pagenum%>,
completed: <%completed%>,
rid: <%rid%>,
submit: 1,
action: 'submit'
}"
[useOtherData]="null"
[preSets]="{getFromCache: 0, saveToCache: 0}"
refreshOnSuccess="true"
samePage="true" type="submit"
>{{ 'plugin.mod_questionnaire.savechanges' | translate }}</ion-button>
<%/completed%><%/nextpage%>
</ion-list>
</ion-card>
</div>
<%#emptypage%>
<%/emptypage%>
</div>