RE: [PHP] Algorithm....
| From: | Martin Towell | Date: | Tue, 17 Feb 2004 05:11:22 +0000 |
| Subject: | RE: [PHP] Algorithm.... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-177902@lists.php.net to get a copy of this message | ||
Hiya,
Work out the start array position, keep incrementing by 1 until you find a
"yes"
From this you'll know the allowable end times.
HTH
Martin
> -----Original Message-----
> From: Bob Eldred [mailto:bobathome@aqfl.com]
> Sent: Tuesday, 17 February 2004 4:04 PM
> To: php-general@lists.php.net
> Subject: [PHP] Algorithm....
>
>
> 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
> __________ Information from NOD32 1.617 (20040206) __________
>
> This message was checked by NOD32 for Exchange e-mail monitor.
> http://www.nod32.com
>
>
>
>