Hey Guy's,
I'm working on creating a couple of snippits that is going to allow me to display / edit a work schedule using xpdo with a couple custom db's.
Right now I have two database tables the first one is basically an event table, with a few extra columns for filtering / sorting later on it looks similar to this:
id, name, role, group, date, start_time, end_time, total_hours
There will be one row per "event"/scheduled shift.
The second is my user table that includes pertinent details about the users/employees there is/will not be any duplicate rows (one row per user). This table looks similar to:
id, name, avd, rvd, alh, group, role, status, etc, etc ...
I'm looking to have a schedule table that looks similar to what's below, and am having difficulty today trying to get my head around how to loop through the events and display them how I want.
| | Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday
| Name |07/01/12 | 07/02/12 | 07/03/12 | 07/04/12 | 07/05/12 | 07/06/12 | 07/07/12
| John | OFF | 8:30-5:00 | 8:30-5:00 | 8:30-5:00 | 8:30-5:00 |8:30-5:00 | OFF
What I have so far is a snippit that will loop through table 2, and output a list of employees under the name column.
What I am looking to do is under each day column, check to see if the person who's name is in the first column of the particular row is scheduled to work on that day, and return the start and end times.
What I am unclear on is how I could have it check what name is in column one of the same row and pass it as a placeholder to the snippit so that it will loop through each person on that day.
Any ideas? Am I going about this all wrong? Any help would be appreciated.
[ed. note: nick2687 last edited this post 14 years, 3 months ago.]