Creating the attendance sessions automatically

Creating the attendance sessions automatically

by Grant Carmichael -
Number of replies: 2

Well, we didn't want our instructors to take the time to create their attendance sessions for each class, so this script creates the attendance sessions and adds the activity to the class automatically.


Let me know if anyone finds any issues with it. Be sure to test it on a test system...


Grant

Average of ratings: -
In reply to Grant Carmichael

Re: Creating the attendance sessions automatically

by Richard Webb -
Before I try this on my test server I want to make sure I don't really mess things up. So I have a few questions:

  1. Does this work with the attendance block and module or is this a separate item?
  2. Is this installed in the blocks folder, the mod folder, the mod/attforblock folder, or the blocks/attendance folder?
  3. How does it work? Does it create a new attendance record every time you go to take attendance? The first time you go to take attendance on a given day, or is there a new button to add a new attendance event for today?
I'd like to give it a try, but I'm kind of concerned about just diving in without knowing what I'm doing.

Thanks,

Richard


In reply to Richard Webb

Re: Creating the attendance sessions automatically

by Grant Carmichael -
I'm running Moodle 1.8 and the attendance module version 2.0.2. (I think this is still the beta version)

So, a teacher must first add the block to a course. After that, they must go into attendance and create the sessions for each class. We have way too many courses to do this manually. So, this script does the following:

Get all course id's.

For each course id, add the block to the course and create all the attendance sessions based on the course start date and the number of sections.

The result is, for each course, the attendance block is added and all the attendance sessions are created for each section date.

Like the notes in the script say, on a test instance of moodle, drop the file into $CFG->dirroot/courses and execute. For me, that is /usr/local/apache/htdocs/moodle/moodle182/course/shorter_attendance.php

So, it might look like this:

shell> cp shorter_attendance.php /usr/local/apache/htdocs/moodle/moodle182/courses/
shell> cd /usr/local/apache/htdocs/moodle/moodle182/courses
shell> php shorter_attendance.php

Let me know how it works for you before I run it on my stuff... (Just kidding...) Its working fine for us.