Browse Source

Hack a way to provide a selectall function on teacher marking.

Fixes #341

This really should be adjusted to implement a new JS function.
MOODLE_36_STABLE
Dan Marsden 6 years ago
parent
commit
a07dfdedc7
  1. 13
      classes/output/mobile.php
  2. 3
      db/mobile.php
  3. 16
      templates/mobile_teacher_form.mustache

13
classes/output/mobile.php

@ -410,9 +410,9 @@ class mobile {
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, 'selectall' => '');
} }
// TODO: Add support for group marking (non-editing teachers etc).
$data['users'] = array(); $data['users'] = array();
$users = $att->get_users($att->get_session_info($sessid)->groupid, 0); $users = $att->get_users($att->get_session_info($sessid)->groupid, 0);
foreach ($users as $user) { foreach ($users as $user) {
@ -422,8 +422,15 @@ class mobile {
$data['users'][] = array('userid' => $user->id, 'fullname' => $user->fullname, 'profileimageurl' => $profileimageurl); $data['users'][] = array('userid' => $user->id, 'fullname' => $user->fullname, 'profileimageurl' => $profileimageurl);
// Generate args to use in submission button here. // Generate args to use in submission button here.
$data['btnargs'] .= ', status'. $user->id. ': CONTENT_OTHERDATA.status'. $user->id; $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.";";
}
}
}
} }
if (!empty($data['messages'])) { if (!empty($data['messages'])) {
$data['showmessage'] = true; $data['showmessage'] = true;
} }

3
db/mobile.php

@ -63,7 +63,8 @@ $addons = [
['subnetwrong', 'attendance'], ['subnetwrong', 'attendance'],
['enterpassword', 'attendance'], ['enterpassword', 'attendance'],
['incorrectpasswordshort', 'attendance'], ['incorrectpasswordshort', 'attendance'],
['attendancesuccess', 'attendance'] ['attendancesuccess', 'attendance'],
['setallstatuses', 'attendance']
], ],
] ]
]; ];

16
templates/mobile_teacher_form.mustache

@ -58,6 +58,22 @@
</span> </span>
<%/messages%> <%/messages%>
<%/showmessage%> <%/showmessage%>
<span class="attendance_selectall">
<ion-item>
{{ 'plugin.mod_attendance.setallstatuses' | translate }}
</ion-item>
<ion-list radio-group>
<%#statuses%>
<span class="radiolabel">
<ion-item>
<ion-label><% acronym %></ion-label>
<ion-radio (ionSelect)="<% selectall %>" value="<% stid %>"></ion-radio>
</ion-item>
</span>
<%/statuses%>
</ion-list>
</span>
<%#users%> <%#users%>
<span class="attendance_user_row"> <span class="attendance_user_row">
<!-- User and status of the submission. --> <!-- User and status of the submission. -->

Loading…
Cancel
Save