Building a one week calendar / schedule - php

My website involves scheduling recurring lessons and events. At present I have built a table using php and javascript which scans through my mysql DB, time slot by timeslot, day by day to see if there is an event scheduled or if the timeslot is free.
It works fine, but is quite clunky and ugly and to be honest, not user friendly enough. I have now built the rest of the site using JQuery along with php, JS, HTML.
I have searched far and wide for a JQuery module to sort me out for this, but every calendar/scheduler I find is for ongoing time, i.e. like the Outlook Calendar.
I want one that ONLY displays Monday - Sunday, with time intervals of a half hour - what's the best way for me to achieve this?
Many thanks in advance,
Brett

may be this can be of help if you haven checked it out already https://github.com/robmonie/jquery-week-calendar/wiki/

Related

Job planification: looking for UI design to make my own

I'm developping an admin panel with ExtJS.
I've almost finished it except one thing: I need the "partner" who logs in to be able to configure when he/she works.
I'm like re-inventing the wheel, but thanks to ExtJS and my structure this won't be a problem.
The actual problem is about UI design:
I want to make very simple so that it's possible to enter very simple values like "I'm working each working days from 8 to 12 then 14 to 18"
I want to make it more configurable and be able to precise "I'm on vacation from july,1st until august,31th"
I want to make it even more configurable and be able to precise "the month of january, I'm working every single day from 8 to 20 non-stop".
I was looking for some inspiration with Microsoft Scheduler but to be honest, a basic user will never ever (ever x 87) be able to use such a UI to configure when he/she works
Same for unix cronjob. From my point of view, this is very hard to understand from a basic user's point of view.
So my question is: do you know where I could find some inspiration for this? And maybe if there are some Php components well written out there to handle such things...
Here's the way I did it: a "list" of rows that contains:
start hour
end hour
start date
end date
and a list of associated days.
This way it's possible to configure any kind of scenarii, even though it requires a bit of thinking, because you do not have to enter it a "natural" way (= you usually think first days of week you work, the hours and maybe the start/end days = it's the opposite of my configuration).

PHP / MySQL timetable comparison

I have an idea for a project that I am currently working on, I am however struggling to find a way to implement this in PHP/MySQL.
I have a database with a list of activities that a tattoo parlour has, basically he works from 9 to 5 and when an event is added it is added to the database using date and time
| --- DATE----- | TIME |
2012-11-02 ---| 10:00:00
What I am trying to do is list all the times and dates within the tattooist timetable in the following week that does not already have events going on, this will also ensure the tattooist doesn't double book too!
any assistance will help guys, any assistance will help
The best way to create the application is to store each scheduled event into a database and "black out" dates that are already taken by the applications "events" table (per say)... You will probably want to do your event creation checks during the point that the event would be created or written to the mysql db.... You will probably want to have an events table with a start and end time for each event.... when you go to schedule an event (assuming user input dictates event time and date) just write a mysql query that selects the event where the DATE(a.lastevent) = DATE(NOW())... let me know if you have further questions
Edit:
I would build the front end of the application calendar style using a JavaScript interface. In the long run it will be much more user friendly and much easier to create, I've implemented them in a day.
The framework I suggest using is ExtJS, there are many tutorials and extensions for calendars, I know that ExtJS 3 has a calendar built into it and you can view a tutorial on that here: http://www.sencha.com/learn/using-calendar
Additionally, if you decide to use ExtJS4, you can use this plugin: https://github.com/bmoeskau/Extensible/downloads or this one http://www.sencha.com/forum/showthread.php?142488-Extjs-4-based-open-source-Calendar-application
The second link is open source, the demo looks to be Spanish (it does what you need and more), but if you use Chrome you'll get a bar at the top asking if you want the page translated, click yes, it does a great job. From there you can do find and replaces to get it to English.
The ExtJS 3 tutorial will show you how to interface the calendar with a PHP page so that you can update your MySQL database via AJAX. It is much simpler than you might think, and you'll save a ton of time trying to code it from scratch.
Sometimes it depends on how long each scheduled event might be. Are you adding these events with just a timestamp or are you also tracking how long of a block is being assigned?
you could have an appointment set using a start and stop time and some math..
I have a annoying tendency to use a epoch timestamp instead of a mysql date time. then you can make calculations to see if an appointment overlaps or find the gaps. just have to learn to count in seconds or provide math to adjust :).

calendar Question with PHP, reading your computer calendar

So I am really stumped because I have basic ideas but I am looking for some of your expertise.
What I am trying to do: I want to basically write an app using Twilio which you dont really need to know about because that is another issue. What that app does is call on a php file in my web host and "triggers the php code"
What I need help with here is how can I keep record in php of the calendar of the week for my computer. What I mean by that is if someone like an admin has a specific code that I have written for them, and that code runs automatically all week, but a specific week they dont want that code to run, instead they want a different code to run that week. How can I use php to find when a week has ended or keep track of the week using that calendar in bottom right of your computer screen so that my program will know after an admin wants a different code run from the usual code that the week is over no need to run that admin irregular code any more go back to your usual automated running code.
If you still dont know what I am talking. I will try to explain more. Think of 2 separate codes. One Custom and the other automated. The automated runs all the time automatically. But one day the admin chooses for that week he doesnt want to follow the regular shcedule of running the automated code as usual, instead for that week he would like to run the custom code and after the week is over go back to running the automated code as usual.
I hope that makes it more clear. I know that in PHP gives the date. But I really need expert opinion on how to do this.
Generally for something like this, I'd generate a "nextrun_datetime" for each and every script/user combination. By default it would have a repeat interval, in your case, 7 days.
If a user doesn't want to run it this week, they can "push" it out N days and the normal update interval would apply afterwards. To get the one-time shot, I'd allow an update interval of 0 or -1 to denote that.
With this sort of thing, whenever a script is updated (or saved, run, rescheduled), you can calculate the next date if there is one. From there, it's a relatively simple cron job that should check the last N minutes for any scripts to be run.
Unless your client machines are running on a completely different calendar than the server, why bother with wondering what the client's date is? Unless the client and server are in different time zones, the client date is going to be the same as the server date, except for a few hours around midnight.
As well, why depend on the client to trigger the server-side code? If this is a regularly occuring thing, use cron or whatever's available on the server to run the code automatically. If an admin wants to override WHICH code gets run, then you can provide an interface to change what's executed. Click a button on a site and a flag is set somewhere that tells the timed job to run script B instead of script A.
I've done something similar. Based on the day (e.g. monday, sunday) I would do something different in php.
this is how I did it:
$today = date('w');
if ($today== 0){
//its sunday
exec('rmdir C:\myApp\oldLogs');
}
else{
echo '1 -> monday, 2-> tuesday etc...'
}
you can also make a date from a string for example
$date = strtotime("8 days ago 14:00");
/*
or "Monday next week", "+1 week 2 days 4 hours 2 seconds","yesterday noon","10 September 2000" etc...
*/

PHP Date Booking and Review methods

A bit of brainstorming is required.
We are building a booking system that allows users to book a date and a half an hour time slot on that day. Some days however based on a weekly timetable will not be available and others may be unavailable at certain time.
What would be the best way to go about something like this. There should be some information in the database saying what day of the week certain times are not available but I am not sure what the best way of going about this is.
Any ideas?
Marvellous

Handling Reoccurring Events in PHP/MySQL

Example
7.30pm, second Monday each month
or
7.30pm, first & third Thursday each month.
Basically I want a upcoming events list for the next month.
How do I handle reoccurring events in PHP/MySQL?
Assuming a linux like environment: Have a cron job execute your php script.
I think cron has a pretty flexible way of recording schedules for repeating tasks, it might be worth diving into how it works (it is open source).
I also found this class for parsing crontab entries - http://www.phpclasses.org/browse/package/2568.html - I can't vouch for how good the code is, it's quite old (but crontab doesn't change much). The example given uses a MySQL database to store the tasks, so it might be worth at least looking at for ideas.

Categories