Real World PHP / mySQL Coding Example
Calendar Application With Database and Google Integration
You decide to make a custom calendar integrated with Google calendar. In other words, the calendar will grab data from a database and Google Calendar. You explore and discuss the options, and it comes down to a custom script, modified script or purchased script. After browsing the various options, the decision came down to a custom calendar script that will integrate with Google. You surf the web and find this JQuery Plugin called full calendar. The plugin comes with good documentation and it leaves room to do what you want. But, it needs plenty of work and adjustments to make it function exactly as desired.
Initially, the first step is to download the files and test them in wamp or Firefox. After looking into the files, you
Seeing out it output with Google Calendar laid down a lot of groundwork for database preparation. But, some users will not use Google calendar. Therefore, the script must be made to work with a database as well.
In the end, we set up two database tables for the sources and one for the entries. The sources tables had two entries; one for the the Google calendar xml feed and one for a local file which made an array of the various entries for the calendar.
Then, you customize the a few pages so that entries output and you can add, edit, update and delete entries. With a little intensive date coding session; you end up with a robust system to make and adjust appointments with exact dates and times.
Then, you test to confirm the desired results. After creating, updating, editing and deleting a few entries; you have a solid calendar.
Now that the scripts works, you find change the file order around so that the index.php
The file connect.inc was added in order to connect to the ABOOK database.
The file json.html became index.php
A query was written to make an array of the urls for which to get calendar events. At nearly the same time, the database table was made to hold entries which display on the calendar.
Near line 43 we loaded the url sources for events we want to publish by adding eventSources: [<?php echo implode(“,”, $urls); ?> ]
A form was created to allow for adding events into the database.
File: File: events.php
The file json-events.php became events.php
The static array and commented it out and made the entries come out dynamically with the events array.
This file was used to edit and delete entries.