Core Boxx – Calendar Module

INTRODUCTION

This is a simple calendar module for Core Boxx. Manage and show events in your project.

 

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.

Download Core Boxx Calendar Module | GitHubSource Forge

 

INSTALLATION

  • Import lib/SQL-Calendar.sql into your database.
  • If you want “Monday first”, just change $sunfirst = false in lib/LIB-Calendar.php.

 

 

FILES LIST

  • lib/LIB-Calendar.php Calendar library.
  • lib/API-calendar.php Calendar API.
  • pages/PAGE-calendar.php Calendar demo page.
  • assets/PAGE-calendar.js Calendar Javascript.
  • assets/PAGE-calendar.css Calendar CSS.

 

LIBRARY REFERENCE

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.

 

CALENDAR LIBRARY FUNCTIONS

save($start, $end, $txt, $color, $bg, $id)

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" ;
del($id)

Delete event.

  • $id Integer, event ID.
echo $_CORE->Calendar->del(123) ? "OK" : $_CORE->error ;
get($id)

Get event details.

  • $id Integer, event ID.
$evt = $_CORE->Calendar->get(123);
getPeriod($month, $year)

Get events and “calendar in an array” for the given period.

  • $month Integer.
  • $year Integer.
$data = $_CORE->Calendar->getPeriod(1, 2077);

 

CALENDAR API FUNCTIONS

Accessible at http://yoursite.com/api/calendar/REQUEST/. These are pretty much a replica of the above library functions, except in REST API format.

api/calendar/get/

Get event.

  • $_POST["id"] – Int, event ID.
api/calendar/getPeriod/

Get events and “calendar cells in an array” for the given period.

  • $_POST["month"] – Int, month.
  • $_POST["year"] – Int, year.
api/calendar/save/

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.
api/calendar/del/

Delete an event.

  • $_POST["id"] Int, the event ID.

 

Leave a Comment

Your email address will not be published.