1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Automating timers

Discussion in 'PHP' started by oo7ml, Sep 26, 2011.

  1. #1
    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.
    SEMrush
    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
     
    oo7ml, Sep 26, 2011 IP
    SEMrush
  2. mfscripts

    mfscripts Banned

    Messages:
    319
    Likes Received:
    4
    Best Answers:
    8
    Trophy Points:
    90
    Digital Goods:
    3
    #2
    Sounds about right to me. Ensure your times in the db are constant i.e. UTC and change them to the relevant timezone when presenting them to the user. (or calculating end/start times)

    I assume each user will have an account in the db of some sort? If so, $time_zone may be better stored against the user rather than the course.
     
    mfscripts, Sep 26, 2011 IP
  3. oo7ml

    oo7ml Well-Known Member

    Messages:
    656
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #3
    Thanks for your reply but i think it would be better to store it against the each course... as if it was assigned in their profile, then they could change it back and forward to suit them if they were running out of time...
     
    oo7ml, Sep 27, 2011 IP
  4. fairuz.ismail

    fairuz.ismail Peon

    Messages:
    232
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I do agree with #2 where time zone should be stored in users table. It's make sense that a user should use the same time zone for every course that he takes.
     
    fairuz.ismail, Sep 27, 2011 IP
  5. oo7ml

    oo7ml Well-Known Member

    Messages:
    656
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #5
    I know, but what if the user is running out of time and changes the timezone to a +5 so they can complete the course in time and then changes it -5 so they can complete it early...
     
    oo7ml, Sep 27, 2011 IP
  6. fairuz.ismail

    fairuz.ismail Peon

    Messages:
    232
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #6
    So you are allowing the user to cheat? =)
     
    fairuz.ismail, Sep 27, 2011 IP
  7. oo7ml

    oo7ml Well-Known Member

    Messages:
    656
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #7
    That is exactly what I am trying to stop users from doing... ;)
     
    oo7ml, Sep 27, 2011 IP
  8. fairuz.ismail

    fairuz.ismail Peon

    Messages:
    232
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Hmm here's an idea... Why don't you block users from changing the time zone if they are taking a course?
     
    fairuz.ismail, Sep 27, 2011 IP
  9. oo7ml

    oo7ml Well-Known Member

    Messages:
    656
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #9
    That's a good idea, thanks... i will look into that...
     
    oo7ml, Sep 28, 2011 IP