diff --git a/classes/output/mobile.php b/classes/output/mobile.php index 02c45e0..11f9029 100644 --- a/classes/output/mobile.php +++ b/classes/output/mobile.php @@ -365,6 +365,15 @@ class mobile { $data['args'] = ''; // Stores list of userid status args that should be added to form post. $statuses = $att->get_statuses(); + $otherdata = array(); + $existinglog = $DB->get_records('attendance_log', + array('sessionid' => $sessid), '', 'studentid,statusid'); + foreach ($existinglog as $log) { + if (!empty($log->statusid)) { + $otherdata['status'.$log->studentid] = $log->statusid; + } + } + foreach ($statuses as $status) { $data['statuses'][] = array('stid' => $status->id, 'acronym' => $status->acronym, 'description' => $status->description); @@ -374,7 +383,8 @@ class mobile { $users = $att->get_users(0, 0); foreach ($users as $user) { $data['users'][] = array('userid' => $user->id, 'fullname' => $user->fullname); - $data['args'] .= ', status'. $user->id. ': status'. $user->id; + // Generate args to use in submission button here. + $data['args'] .= ', status'. $user->id. ': CONTENT_OTHERDATA.status'. $user->id; } if (!empty($data['messages'])) { @@ -390,7 +400,7 @@ class mobile { ], ], 'javascript' => '', - 'otherdata' => '' + 'otherdata' => $otherdata ]; } diff --git a/templates/mobile_teacher_form.mustache b/templates/mobile_teacher_form.mustache index a3ce11b..6dd12ef 100644 --- a/templates/mobile_teacher_form.mustache +++ b/templates/mobile_teacher_form.mustache @@ -41,6 +41,7 @@ "cmid": "25", "courseid": "4", "sessid": "43" + "args" : ", status4: CONTENT_OTHERDATA.status4" } }} {{=<% %>=}} @@ -64,7 +65,7 @@ - + <%#statuses%>