Copy from other sessions now also works in list view mode
authorLuis Ramon Lopez <lrlopez@gmail.com>
Fri, 21 Jan 2011 17:03:03 +0000 (18:03 +0100)
committerLuis Ramon Lopez <lrlopez@gmail.com>
Fri, 21 Jan 2011 17:03:03 +0000 (18:03 +0100)
attendances.php

index 00b2eed..e56084a 100644 (file)
                        $table->data[$student->id][] = "<a href=\"view.php?id=$id&amp;student={$student->id}\">".((!$att && $update) ? '<font color="red"><b>' : '').fullname($student).((!$att && $update) ? '</b></font>' : '').'</a>';
 
             foreach($statuses as $st) {
-                 @$table->data[$student->id][] = '<input name="student'.$student->id.'" type="radio" value="'.$st->id.'" '.($st->id == $att->statusid ? 'checked' : '').'>';
+                $copyid = ($copyfrom == "-1") ? $sessionid : $copyfrom;
+                $att = get_record('attendance_log', 'sessionid', $copyid, 'studentid', $student->id);
+                $currentstatusid = $att===false ? -1 : $att->statusid;
+                 @$table->data[$student->id][] = '<input name="student'.$student->id.'" type="radio" value="'.$st->id.'" '.($st->id == $currentstatusid ? 'checked' : '').'>';
             }
             $table->data[$student->id][] = '<input type="text" name="remarks'.$student->id.'" size="" value="'.($att ? $att->remarks : '').'">';
         }