A very simple, easy to use PHP calendar rendering class.
- php: >=7.0.0
- ext-calendar: *
Install the latest version with:
composer require 'openWebX/simplecalendar'
<?php
$Calendar = new SimpleCalendar\Calendar('June 2010');
$Calendar->show();
or
<?php
$Calendar = new ew SimpleCalendar\Calendar();
$Calendar->setDate('June 5 2010');
$Calendar->show();
Simple Calendar
<?php
namespace donatj;
class SimpleCalendar {
/**
* Array of Week Day Names
* @var array|false
*/
public $wday_names = false;
}
function __construct([ $date_string = null])
Constructor - Calls the setDate function
- null | string
$date_string
function setDate([ $date_string = null])
Sets the date for the calendar
- null | string
$date_string
- Date string parsed by strtotime for the calendar date. If null set to current timestamp.
function addDailyHtml($html, $start_date_string [, $end_date_string = null])
Add a daily event to the calendar
- string
$html
- The raw HTML to place on the calendar for this event - string
$start_date_string
- Date string for when the event starts - null | string
$end_date_string
- Date string for when the event ends. Defaults to start date
function clearDailyHtml()
Clear all daily events for the calendar
function setStartOfWeek($offset)
Sets the first day of the week
- int | string
$offset
- Day to start on, ex: "Monday" or 0-6 where 0 is Sunday
function show([ $echo = true])
Returns/Outputs the Calendar
- bool
$echo
- Whether to echo resulting calendar
- string - HTML of the Calendar