Browse Source

WIP show currently selected status in form.

MOODLE_36_STABLE
Dan Marsden 6 years ago
parent
commit
dc6df98aa5
  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.
$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
];
}

3
templates/mobile_teacher_form.mustache

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

Loading…
Cancel
Save