I'm working on a calendaring script right now, and am stuck on a
programmatic way to figure something out.

Basically, the work day is broken down into 15-minute intervals, where the
value of a given interval can be figured as $hour=floor($i/4) and the
minutes can be figured as $minutes=($i%4)*15.  So 32 = 8:00, 33=8:15, etc.

Currently, it's relatively easy to pull up a day, and block out those times
that are already taken up with appointments.  I'm throwing them all into an
array ($available_times).  So, that array would look like:

32=>yes
33=>yes
34=>yes
35=>yes
36=>no
37=>no
38=>yes
39=>yes

etc, for someone who has a meeting from 9:00 to 9:30.

Now, what I'm trying to do is check when they schedule a new meeting so that
they don't overlap their times with something that's already taken up.  So,
in the array given above, if they select 8:30 as the start time, I'd like
them to be able to select 8:45 or 9:00 as the end time, but nothing later
than that, as the time from 9:00 to 9:30 is already taken up.

And I'm stuck trying to figure out an approach to this.  Preferably one that
I can throw into javascript so they can fix their errors before it ever hits
the server.

Any help appreciated.

Bob

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to