Solved

Automating timers

Posted on 2011-09-26
2
221 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:oo7ml
2 Comments
 
LVL 13

Assisted Solution

by:Hugh McCurdy
Hugh McCurdy earned 150 total points
Comment Utility
I fear that I misunderstand the question.  This doesn't seem like automatic timing.

Related to control of access, the user will make page load requests throughout the day and the request will either be inside or outside the window (the day).  It's a simple comparison of the current to the boundary times for the daily window.

I am concerned about your data and what I view as a lack of flexibility.  

I would expand the daily status to an array of size 14 so that you can track each day.  Instead of just complete/incomplete, perhaps you should record the date and time it was completed.  I would also avoid hard coding 14 to much into the code especially considering that PHP is loosely typed.  At some point, someone may ask you to setup a 10 day or 21 day class.

Another, and I think more important, flexibility concern is that people have lives and things happen in those lives.  While you can state the rule that they must complete the tutorial, once per day for 14 days in a row, I think that plan is going to get you into trouble with unhappy customers, lost business, etc.

One simple observation is that some people's beliefs prevent them from working on a particular day of the week or on certain holidays.  How many Christians are going to schedule the tutorial if the 14 days spans Good Friday and Easter?  If nothing else, the strict plan creates a revenue hole based on the calendar.

Another problem is that, because people have lives, surprise events happen.  People get sick.  Do you really want to deal with a mother who completed 13 sessions but on the 14th day her daughter ended up in the emergency room?  Of course, she's going with her daughter to the ER.

What if the student encounters a power failure that lasts several hours and is truly unable to take the class one day because of it?  Or what if there's a hurricane and much of the east coast of the US evacuates?  (Or Katrina in New Orleans a few years ago?)

You customers will have good reasons and will almost certainly become angry with you if you don't accept those good reasons.  Even if you want to accept the good reason, your software design doesn't yet accommodate.  

Part of the solution is to track each day as an independent event (the "14" element array).  Another is to not insist (include a test) that day 13's work has to actually be done on day 13 but that it could be done on day 15.
0
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 350 total points
Comment Utility
You can learn the way to handle the DATETIME things from this article.  Clients in different time zones are a fairly common issue.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html

Please read that over and then post back with any specific questions.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now