Browse Source

WIP show currently selected status in form.

MOODLE_35_STABLE
Dan Marsden 6 years ago
parent
commit
1be1851416
  1. 14
      classes/output/mobile.php
  2. 3
      templates/mobile_teacher_form.mustache

14
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. $data['args'] = ''; // Stores list of userid status args that should be added to form post.
$statuses = $att->get_statuses(); $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) { foreach ($statuses as $status) {
$data['statuses'][] = array('stid' => $status->id, 'acronym' => $status->acronym, $data['statuses'][] = array('stid' => $status->id, 'acronym' => $status->acronym,
'description' => $status->description); 'description' => $status->description);
@ -374,7 +383,8 @@ class mobile {
$users = $att->get_users(0, 0); $users = $att->get_users(0, 0);
foreach ($users as $user) { foreach ($users as $user) {
$data['users'][] = array('userid' => $user->id, 'fullname' => $user->fullname); $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'])) { if (!empty($data['messages'])) {
@ -390,7 +400,7 @@ class mobile {
], ],
], ],
'javascript' => '', 'javascript' => '',
'otherdata' => '' 'otherdata' => $otherdata
]; ];
} }

3
templates/mobile_teacher_form.mustache

@ -41,6 +41,7 @@
"cmid": "25", "cmid": "25",
"courseid": "4", "courseid": "4",
"sessid": "43" "sessid": "43"
"args" : ", status4: CONTENT_OTHERDATA.status4"
} }
}} }}
{{=<% %>=}} {{=<% %>=}}
@ -64,7 +65,7 @@
</span> </span>
</ion-item> </ion-item>
<ion-list radio-group [(ngModel)]="status<% userid %>"> <ion-list radio-group [(ngModel)]="CONTENT_OTHERDATA.status<% userid %>">
<%#statuses%> <%#statuses%>
<span class="radiolabel"> <span class="radiolabel">
<ion-item> <ion-item>

Loading…
Cancel
Save