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.sql
into your database. - Delete
PAGE-install-calendar.php
itself.
- Import
- If you want “Monday first”, just change
mon : true
inassets/PAGE-calendar.js
. - After installing, access
http://your-site.com/calendar
for 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.php
Calendar library.lib/SQL-Calendar.sql
Calendar events table.
API
lib/API-calendar.php
Calendar API.
ASSETS & PAGES
pages/PAGE-calendar.php
Calendar demo page.assets/PAGE-calendar.js
Calendar Javascript.assets/PAGE-calendar.css
Calendar 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.
$start
String, start date/time in ISO 8601.$end
String, end date/time in ISO 8601.$txt
String, event details.$color
String, text color in hex.$bg
String, background color in hex.$id
Integer, 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.
$id
Integer, event ID.
echo $_CORE->Calendar->del(123) ? "OK" : $_CORE->error ;
Get event details.
$id
Integer, event ID.
$evt = $_CORE->Calendar->get(123);
Get events and “calendar in an array” for the given period.
$month
Integer.$year
Integer.
$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.