Automating Timers

Hi, my site allows people to buy e-learning courses for other people. As soon as a person receives and starts a course, they must complete daily tutorials every day for the period of the course.
Most courses take 2 weeks to complete, so this means the person will have to login and complete a tutorial every day for 2 weeks (14 days)

When a user logins to complete a tutorial each day, they will have to read several course notes and then at the end, they will have to complete a very easy interactive task, such as dragging a round ball and dropping it into a round hole. This small interactive task is very important as it marks the tutorial for that day as “complete” for that day. If they do not complete the interactive task, then the tutorial will not be completed for that day and they will fail the entire course.

Once a user has completed the daily tutorial, they cannot start the next (tomorrows) tutorial until the start of a new day (00:00) and they must complete each tutorial before the end of their day (23:59)

Considering users will be from different time zones, they must choose their timezone before starting their very first course. This will allow the site to calculate the start and end time of a user’s day.

My question is:
How should I create and automate this function so that the site can monitor and control the timing and completion of tutorials. I was thinking I need to add additional fields to the course table in the database such as:

$duration (the length of the course)
$start_date (the date the user starts the first tutorial of the course)
$end_date (the $start_date + ($duration (2 weeks) ))
$time_zone (this will be used to calculate the users time, in order to signify the start and end of their day)
$daily_status (incomplete, completed)

I am sure I need more fields, but first I need to establish how I can automate all of this

P.S – I am not worried about how I will automate what notes or interactive task need to be displayed and completed each day… I am only looking for help on how I can automate the time and completion of each tutorial each day, thanks in advance for your help

cron a script to run on the hour every hour.

Find any user who’s timezone makes (current_server_time +/- timezoneadjustment) = 00:00.
Foreach such user, if daily_status = completed, day++, daily_status = incomplete.
Use day to determine which tasks the user may access.

I dont know how you want to react when a user hasnt completed their assignment for a given day, but

Thanks for your reply… if a user does not complete a tutorial for a given day, the overall course status is set to “failed”…

Can you elaborate as to why you would use and increment days…

Because it’s all your system cares about? It’s also a little bit easier (imo) than making the system do date math every time it runs or displays the client. I dont care when you started the course; If you’ve completed 7 days and your status is incomplete, then the first 7 lessons are done, the 8th is open and outstanding. If your status is complete, the first 7 lessons are done, and today’s lesson is done. If you hit 14, you’ve completed the whole course.

Ok cool, thanks…