Jump to content

PHP Weekly Schedule Help


leslie.g

Recommended Posts

Hi everyone

I need some help on how to go about designing a script for a high school. It is for teachers so that they can book periods for the computer lab, studio etc.

 

I want it so when they go to the page it has this week with all the slots taken.

What I'm having trouble with is I want them to also be able to go to any date they wish and bring up that weeks schedule because they need to be able to book in advance.

 

Would anyone be able to explain a technique on how I can go about this

 

Thanks in advance

Link to comment
Share on other sites

I'd suggest you start with a database design.  The general idea is that you will want to store a reservation.  What entities are involved in this reservation?  Mostly likely your entites are:

-Persons (the people who can reserve the rooms)

-The Rooms themselves

-A Reservation by a person for a room

 

An individual reservation could be simplifed to look something like this:

 

person: Coach Smith

room: Auditorium

from: 2012-03-02 10:00AM

to: 2012-03-02 1:00PM

 

Assuming your system was able to create records, you'd be able read these out of the database, overlay them on a calender, and display the time that was reserved.  Clicking on an empty block would spawn a form that would allow the person making the reservation to add a new reservation record.

 

Without getting into a longer discussion on database design, the typical way to break this apart is to have a table for each of the "entities" described above.  So you'd have a user table:

 

user

-------

user_id integer

firstname varchar

lastname varchar

 

room

------------

room_id integer

name varchar

roomNbr varchar

 

reservation

--------------

reservation_id integer

user_id integer

room_id integer

fromDate dateTime

toDate dateTime

createdDate timestamp

 

Just off the top of my head, fleshing this out in the database of your choice would be the way you would start to attack this problem and would provide a blueprint for the rest of your development.

Link to comment
Share on other sites

Thanks for the reply! This helps a lot.

 

Do you know how I could get the system to automatically know what the week is based on a specified date?

So if its tuesday 28th i need it to bring up monday 27-friday 2. or any other date inputted so they can book in advance

 

thanks for ur help

Link to comment
Share on other sites

Databases have rich functionality in most cases that allow you to take date/time functions and do those sorts of conversions.  PHP has similar capabilities.  So you typically have the option of getting this type of information from the query itself, or to have the serverside code do it.  There is also the possibility of having the front end build in javascript, and use ajax calls to get the reservations from the database as you navigate through your ui.  In essence each language has functions that allow you to work with dates, and to for example, extract the week/month or year from a date.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.