diff --git a/classes/output/mobile.php b/classes/output/mobile.php index 13ea491..ee7c552 100644 --- a/classes/output/mobile.php +++ b/classes/output/mobile.php @@ -54,6 +54,7 @@ class mobile { require_once($CFG->dirroot.'/mod/attendance/locallib.php'); + $versionname = $args['appversioncode'] >= 3950 ? 'latest' : 'ionic3'; $cmid = $args['cmid']; $courseid = $args['courseid']; $takenstatus = empty($args['status']) ? '' : $args['status']; @@ -252,7 +253,7 @@ class mobile { 'templates' => [ [ 'id' => 'main', - 'html' => $OUTPUT->render_from_template('mod_attendance/mobile_view_page', $data), + 'html' => $OUTPUT->render_from_template("mod_attendance/mobile_view_page_$versionname", $data), ], ], 'javascript' => '', @@ -272,6 +273,7 @@ class mobile { require_once($CFG->dirroot.'/mod/attendance/locallib.php'); $args = (object) $args; + $versionname = $args->appversioncode >= 3950 ? 'latest' : 'ionic3'; $cmid = $args->cmid; $courseid = $args->courseid; $sessid = $args->sessid; @@ -352,7 +354,7 @@ class mobile { 'templates' => [ [ 'id' => 'main', - 'html' => $OUTPUT->render_from_template('mod_attendance/mobile_user_form', $data), + 'html' => $OUTPUT->render_from_template("mod_attendance/mobile_user_form_$versionname", $data), 'cache-view' => false ], ], @@ -373,6 +375,7 @@ class mobile { require_once($CFG->dirroot.'/mod/attendance/locallib.php'); $args = (object) $args; + $versionname = $args->appversioncode >= 3950 ? 'latest' : 'ionic3'; $cmid = $args->cmid; $courseid = $args->courseid; $sessid = $args->sessid; @@ -414,10 +417,11 @@ class mobile { foreach ($statuses as $status) { $data['statuses'][] = array('stid' => $status->id, 'acronym' => $status->acronym, - 'description' => $status->description, 'selectall' => ''); + 'description' => $status->description); } $data['users'] = array(); + $data['selectall'] = ''; $users = $att->get_users($att->get_session_info($sessid)->groupid, 0); foreach ($users as $user) { $userpicture = new \user_picture($user); @@ -427,13 +431,7 @@ class mobile { // Generate args to use in submission button here. $data['btnargs'] .= ', status'. $user->id. ': CONTENT_OTHERDATA.status'. $user->id; // Really Hacky way to do a select-all. This really needs to be moved into a JS function within the app. - foreach ($statuses as $status) { - foreach ($data['statuses'] as $id => $st) { // Statuses not ordered by statusid. - if ($st['stid'] == $status->id) { // Find the item that we need to add to. - $data['statuses'][$id]['selectall'] .= "CONTENT_OTHERDATA.status".$user->id."=".$status->id.";"; - } - } - } + $data['selectall'] .= "CONTENT_OTHERDATA.status".$user->id."=CONTENT_OTHERDATA.statusall;"; } if (!empty($data['messages'])) { $data['showmessage'] = true; @@ -443,7 +441,7 @@ class mobile { 'templates' => [ [ 'id' => 'main', - 'html' => $OUTPUT->render_from_template('mod_attendance/mobile_teacher_form', $data), + 'html' => $OUTPUT->render_from_template("mod_attendance/mobile_teacher_form_$versionname", $data), 'cache-view' => false ], ], diff --git a/templates/mobile_teacher_form.mustache b/templates/mobile_teacher_form_ionic3.mustache similarity index 94% rename from templates/mobile_teacher_form.mustache rename to templates/mobile_teacher_form_ionic3.mustache index bd1d8bb..f25374f 100644 --- a/templates/mobile_teacher_form.mustache +++ b/templates/mobile_teacher_form_ionic3.mustache @@ -62,13 +62,13 @@ {{ 'plugin.mod_attendance.setallstatuses' | translate }} - + <%#statuses%> <% acronym %> - + <%/statuses%> @@ -82,7 +82,6 @@

<% fullname %>

- <%#statuses%> diff --git a/templates/mobile_teacher_form_latest.mustache b/templates/mobile_teacher_form_latest.mustache new file mode 100644 index 0000000..4beb511 --- /dev/null +++ b/templates/mobile_teacher_form_latest.mustache @@ -0,0 +1,104 @@ +{{! + 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 . +}} +{{! + @template mod_attendance/mobile_user_form + + The page to take attendance + + Classes required for JS: + * None + + Data attibutes required for JS: + * All data attributes are required + + Context variables required for this template: + * attendance + * summary + * cmid + + Example context (json): + { + "attendance": { + "id": "1", + "course": "2", + "name": "Class Attendance", + "intro": "Intro" + }, + "cmid": "25", + "courseid": "4", + "sessid": "43", + "btnargs" : "" + } +}} +{{=<% %>=}} +
+ + + + <%#showmessage%> + <%#messages%> + + + {{ 'plugin.mod_attendance.<% string %>' | translate }} + + + <%/messages%> + <%/showmessage%> + + + {{ 'plugin.mod_attendance.setallstatuses' | translate }} + + + <%#statuses%> + + + + <% acronym %> + + + + <%/statuses%> + + + <%#users%> + + + + + + + +

<% fullname %>

+
+
+ + <%#statuses%> + + + <% acronym %> + + + + <%/statuses%> + +
+ <%/users%> + + {{ 'plugin.mod_attendance.submitattendance' | translate }} + + +
\ No newline at end of file diff --git a/templates/mobile_user_form.mustache b/templates/mobile_user_form_ionic3.mustache similarity index 100% rename from templates/mobile_user_form.mustache rename to templates/mobile_user_form_ionic3.mustache diff --git a/templates/mobile_user_form_latest.mustache b/templates/mobile_user_form_latest.mustache new file mode 100644 index 0000000..103fdc1 --- /dev/null +++ b/templates/mobile_user_form_latest.mustache @@ -0,0 +1,82 @@ +{{! + 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 . +}} +{{! + @template mod_attendance/mobile_user_form + + The page to take attendance + + Classes required for JS: + * None + + Data attibutes required for JS: + * All data attributes are required + + Context variables required for this template: + * attendance + * summary + * cmid + + Example context (json): + { + "attendance": { + "id": "1", + "course": "2", + "name": "Class Attendance", + "intro": "Intro" + }, + "cmid": "25", + "courseid": "4", + "sessid": "43" + } +}} +{{=<% %>=}} +
+ + <%#showmessage%> + <%#messages%> + + + {{ 'plugin.mod_attendance.<% string %>' | translate }} + + + <%/messages%> + <%/showmessage%> + <%#showpassword%> + + {{ 'plugin.mod_attendance.enterpassword' | translate }}: + + + <%/showpassword%> + <%#showstatuses%> + + <%#statuses%> + + <% description %> + + + <%/statuses%> + + + {{ 'plugin.mod_attendance.submitattendance' | translate }} + + <%/showstatuses%> + <%#disabledduetotime%> + + {{ 'plugin.mod_attendance.somedisabledstatus' | translate }} + + <%/disabledduetotime%> +
\ No newline at end of file diff --git a/templates/mobile_view_page.mustache b/templates/mobile_view_page_ionic3.mustache similarity index 100% rename from templates/mobile_view_page.mustache rename to templates/mobile_view_page_ionic3.mustache diff --git a/templates/mobile_view_page_latest.mustache b/templates/mobile_view_page_latest.mustache new file mode 100644 index 0000000..af7746e --- /dev/null +++ b/templates/mobile_view_page_latest.mustache @@ -0,0 +1,148 @@ +{{! + 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 . +}} +{{! + @template mod_attendance/mobile_view_page + + The main page to view the attendance activity + + Classes required for JS: + * None + + Data attibutes required for JS: + * All data attributes are required + + Context variables required for this template: + * attendance + * summary + * cmid + + Example context (json): + { + "attendance": { + "id": "1", + "course": "2", + "name": "Class Attendance", + "intro": "Intro" + }, + "summary": { + "numtakensessions": "1", + "pointssessionscompleted": "2", + "percentagesessionscompleted": "2" + }, + "cmid": "25", + "timestamp": "1234" + } +}} +{{=<% %>=}} +
+ + <%#showmessage%> + <%#messages%> + + + {{ 'plugin.mod_attendance.<% string %>' | translate }} + + + <%/messages%> + <%/showmessage%> + <%#sessions%> + + +

<% time %>

+

<% groupname %>

+

<% currentstatus %>

+ <%#sessid%> + + {{ 'plugin.mod_attendance.submitattendance' | translate }} + + <%/sessid%> +
+
+ <%/sessions%> + + + + + + {{ 'plugin.mod_attendance.sessionscompleted' | translate }} + + + <% summary.numtakensessions %> + + + + + {{ 'plugin.mod_attendance.pointssessionscompleted' | translate }} + + + <% summary.pointssessionscompleted %> + + + + + {{ 'plugin.mod_attendance.percentagesessionscompleted' | translate }} + + + <% summary.percentagesessionscompleted %> + + + + + + {{ 'plugin.mod_attendance.sessionstotal' | translate }} + + + <% summary.numallsessions %> + + + + + {{ 'plugin.mod_attendance.pointsallsessions' | translate }} + + + <% summary.percentagesessionscompleted %> + + + + + {{ 'plugin.mod_attendance.percentageallsessions' | translate }} + + + <% summary.allsessionspercentage %> + + + + + {{ 'plugin.mod_attendance.maxpossiblepoints' | translate }} + + + <% summary.maxpossiblepoints %> + + + + + {{ 'plugin.mod_attendance.maxpossiblepercentage' | translate }} + + + <% summary.maxpossiblepercentage %> + + + + + + +
\ No newline at end of file