Browse Source

WIP Take teacher attendance.

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

15
classes/output/mobile.php

@ -75,7 +75,10 @@ class mobile {
// Add stats for this use to output.
$pageparams = new \mod_attendance_view_page_params();
$pageparams->studentid = $USER->id;
if (!empty($takenstatus) && !empty($sessid)) {
$pageparams->group = groups_get_activity_group($cm, true);
if (!empty($sessid) && (!empty($takenstatus) || $isteacher)) {
$session = $DB->get_record('attendance_sessions', array('id' => $sessid));
$pageparams->grouptype = $session->groupid;
$pageparams->sessionid = $sessid;
}
$pageparams->mode = \mod_attendance_view_page_params::MODE_THIS_COURSE;
@ -88,14 +91,16 @@ class mobile {
$userkeys = preg_grep("/status\d+/", $keys);
if (!empty($userkeys)) { // If this is a post from the teacher form.
// Build data to pass to take_from_form_data.
$formdata = new \stdClass();
foreach ($userkeys as $uk) {
$userid = str_replace('status', '', $uk);
$status = $args[$uk];
$formdata->{'remarks'.$userid} = '';
$formdata->{'user'.$userid} = $status;
}
// Call take_from_form_data function.
// $att->take_from_form_data($formdata);
$att->take_from_form_data($formdata);
$data['showmessage'] = true;
$data['messages'][]['string'] = 'attendancesuccess';
}
}

3
db/mobile.php

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

2
templates/mobile_teacher_form.mustache

@ -67,7 +67,7 @@
<%/statuses%>
</ion-list>
<%/users%>
<button ion-button core-site-plugins-new-content component="mod_attendance" method="mobile_view_activity" [args]="{cmid: <% cmid %>, courseid: <% courseid %>, sessid: <% sessid %> <% args %>}">
<button ion-button core-site-plugins-new-content component="mod_attendance" method="mobile_view_activity" [args]="{cmid: <% cmid %>, courseid: <% courseid %>, sessid: <% sessid %><% args %>}">
{{ 'plugin.mod_attendance.submitattendance' | translate }}
</button>

Loading…
Cancel
Save