mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
fixed another foreach problem in lib.
Added a todo section to the README
This commit is contained in:
parent
6b7deae418
commit
51383e2cdf
2 changed files with 55 additions and 43 deletions
|
@ -21,3 +21,10 @@ Quick install instructions
|
|||
|
||||
4) Go to the site configuration page -> modules section -> attendance
|
||||
to specify your preferences for the module (optional)
|
||||
|
||||
New Feature and fix list:
|
||||
|
||||
Automatic attendance loggin based on IP address range
|
||||
Attendance logging by email/Imode (via cel phone)
|
||||
Specify a range of attendance times for automatic attendance logging.
|
||||
Tighter integration with the new calendar features.
|
||||
|
|
|
@ -226,8 +226,9 @@ function attendance_user_complete($course, $user, $mod, $attendance) {
|
|||
|
||||
$attrecs=attendance_get_records("attendance_roll", "dayid", $attendance->id, "userid", $user->id, "", "", "hour ASC");
|
||||
// fill an array with the absences and tardies, as those are the only records actually stored
|
||||
|
||||
$grid = array();
|
||||
foreach ($attrecs as $attrec) { $grid[$attrec->hour]=$attrec->status; }
|
||||
if ($attrecs) { foreach ($attrecs as $attrec) { $grid[$attrec->hour]=$attrec->status; } }
|
||||
echo "<table><tr><th>Hour:</th>\n";
|
||||
// echo out the table header
|
||||
for($j=1;$j<=$attendance->hours;$j++) {
|
||||
|
@ -277,6 +278,7 @@ function attendance_cron () {
|
|||
$courses[$attendance->course]->students =
|
||||
attendance_get_course_students($attendance->course, "u.lastname ASC");
|
||||
}
|
||||
if ($courses[$attendance->course]->students) {
|
||||
foreach ($courses[$attendance->course]->students as $student) {
|
||||
// first, clear out the records that may be there already
|
||||
delete_records("attendance_roll",
|
||||
|
@ -296,6 +298,7 @@ function attendance_cron () {
|
|||
} // for loop to mark all hours absent
|
||||
} // if student has no activity
|
||||
} // foreach student in the list
|
||||
} // if students exist
|
||||
} // if the attendance roll is for today
|
||||
} // for each attendance in the system
|
||||
return true;
|
||||
|
@ -308,6 +311,7 @@ function attendance_grades($attendanceid) {
|
|||
$attendance = get_record("attendance", "id", $attendanceid);
|
||||
if ($attendance->grade == "1") {
|
||||
$students = get_course_students($attendance->course);
|
||||
if ($students) {
|
||||
foreach ($students as $student) {
|
||||
$rolls = attendance_get_records("attendance_roll",
|
||||
"dayid",$attendance->id,
|
||||
|
@ -317,12 +321,13 @@ function attendance_grades($attendanceid) {
|
|||
foreach ($rolls as $roll) {
|
||||
if ($roll->status == 1) {$tar++;}
|
||||
elseif ($roll->status == 2) {$abs++;}
|
||||
}
|
||||
} // if rolls
|
||||
$total = $attendance->hours - attendance_tally_overall_absences_decimal($abs, $tar);
|
||||
$percent = ($total != 0)?$total/$attendance->hours:0;
|
||||
$return->grades[$student->id] = ($percent == 0)?0.0:$attendance->maxgrade * $percent;
|
||||
} else { $return->grades[$student->id] = $attendance->maxgrade; }
|
||||
} // foreach student
|
||||
} // if students
|
||||
$return->maxgrade = $attendance->maxgrade;
|
||||
} else { // if attendance->grade == "1"
|
||||
$return->grades = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue