TABLE OF CONTENTS
DOWNLOAD & INSTALLATION
First, the download links for the module, and also “installation instructions”.
LICENSE & DOWNLOAD
Core Boxx is released under the MIT License. You are free to use it for personal and commercial projects, and modify it as you see fit. On the condition that the software is provided “as-is”. There are no warranties provided and “no strings attached”. Code Boxx and the authors are not liable for any claims, damages, or liabilities.
INSTALLATION
- Copy/unzip this module into your existing Core Boxx project folder.
- Access
http://your-site.com/install/calendar, this will automatically:- Import
lib/SQL-Calendar.sqlinto your database. - Delete
PAGE-install-calendar.phpitself.
- Import
- If you want “Monday first”, just change
mon : trueinassets/PAGE-calendar.js. - After installing, access
http://your-site.com/calendarfor the demo.
SORRY FOR THE ADS...
But someone has to pay the bills, and sponsors are paying for it. I insist on not turning Code Boxx into a "paid scripts" business, and I don't "block people with Adblock". Every little bit of support helps.
Buy Me A Coffee Code Boxx eBooks
FILES LIST
LIBRARIES
lib/LIB-Calendar.phpCalendar library.lib/SQL-Calendar.sqlCalendar events table.
API
lib/API-calendar.phpCalendar API.
ASSETS & PAGES
pages/PAGE-calendar.phpCalendar demo page.assets/PAGE-calendar.jsCalendar Javascript.assets/PAGE-calendar.cssCalendar CSS.
DATABASE REFERENCE
There is only one table to store the calendar events. Feel free to modify this, maybe add a “user-id” or “group id” to separate events for different users and groups.
EVENTS TABLE
| Field | Description |
evt_id |
Primary key, auto-increment. |
evt_start |
Event start date/time. |
evt_end |
Event end date/time. |
evt_text |
Event details. |
evt_color |
Text color. |
evt_bg |
Background color. |
LIBRARY REFERENCE
Lastly, the list of library functions and API endpoints.
CALENDAR LIBRARY FUNCTIONS
Add or update an event.
$startString, start date/time in ISO 8601.$endString, end date/time in ISO 8601.$txtString, event details.$colorString, text color in hex.$bgString, background color in hex.$idInteger, event ID. For updates only.
echo $_CORE->Calendar->save(
"2077-01-01 00:00:00", "2077-01-04 00:00:00",
"TEXT", "#ffffff", "#000000"
) ? "OK" : "NOPE" ;
Delete event.
$idInteger, event ID.
echo $_CORE->Calendar->del(123) ? "OK" : $_CORE->error ;
Get event details.
$idInteger, event ID.
$evt = $_CORE->Calendar->get(123);
Get events and “calendar in an array” for the given period.
$monthInteger.$yearInteger.
$data = $_CORE->Calendar->getPeriod(1, 2077);
CALENDAR API FUNCTIONS
Get event.
$_POST["id"]– Int, event ID.
Get events and “calendar cells in an array” for the given period.
$_POST["month"]– Int, month.$_POST["year"]– Int, year.
Add or update an event.
$_POST["start"]String, ISO 8601 start date.$_POST["end"]String, ISO 8601 end date.$_POST["txt"]String, event details.$_POST["color"]String, text color hex code.$_POST["bg"]String, background color hex code.$_POST["id"]Int, optional. Pass in the event ID to update instead of insert.
Delete an event.
$_POST["id"]Int, the event ID.
