leslie.g Posted February 28, 2012 Share Posted February 28, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/257911-php-weekly-schedule-help/ Share on other sites More sharing options...
gizmola Posted February 28, 2012 Share Posted February 28, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/257911-php-weekly-schedule-help/#findComment-1321955 Share on other sites More sharing options...
leslie.g Posted February 28, 2012 Author Share Posted February 28, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/257911-php-weekly-schedule-help/#findComment-1321958 Share on other sites More sharing options...
gizmola Posted February 28, 2012 Share Posted February 28, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/257911-php-weekly-schedule-help/#findComment-1321961 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.