search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

How to add a database and script to handle public holidays.

Related article: PHP Annual Leave Scheduling (JavaScript/HTML5 Frontend, MySQL Database)
Asked by jgaard
2 years ago.

I've been looking at this script for 2 days now... And I can't quite get it working like I want to.

Basically I want to use it with some fixed public holidays (with paid leave), so I want a "leave_vacation" database table. The thing is that I want it to work with multiple countries with different public vacations.

So I have:

  • copied the structure of the leave_event table to a leave_vacation table, and renamed the person_id to country_id.
  • added a country_id to the person DB
  • copied the backend_leave script to a new script called backend_vacation and made changes to the script so that it looks for the leave_vacation DB.

Now I "just" need to rewrite the rest of the script so that:
foreach person with country_id do ..... json_encode($events)

Once that is achieved I think it could be nice to...

  • give public holidays another color (i'm thinking orange)

Kind regards a new follower and fan.

Answer posted by Dan Letecky [DayPilot]
2 years ago.

There is a tutorial available that shows how to display holidays (by setting a custom scheduler cell background color):

https://code.daypilot.org/93068/javascript-scheduler-displaying-holidays

I believe you should be able to use this logic as is, you just need to load the holiday data from the server as JSON.

Let me know if this is not what you are looking for.

Comment posted by jgaard
2 years ago.

Spot on. Thank you. I had not seen that tutorial.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.