Skip to content

CI_Calendar

Mathieu Nayrolles edited this page Jan 20, 2016 · 1 revision

CI_Calendar

CodeIgniter Calendar Class

This class enables the creation of calendars

  • Class name: CI_Calendar
  • Namespace:

Properties

$template

public mixed $template = ''

Calendar layout template

  • Visibility: public

$replacements

public array $replacements = array()

Replacements array for template

  • Visibility: public

$start_day

public string $start_day = 'sunday'

Day of the week to start the calendar on

  • Visibility: public

$month_type

public string $month_type = 'long'

How to display months

  • Visibility: public

$day_type

public string $day_type = 'abr'

How to display names of days

  • Visibility: public

$show_next_prev

public boolean $show_next_prev = FALSE

Whether to show next/prev month links

  • Visibility: public

$next_prev_url

public boolean $next_prev_url = ''

Url base to use for next/prev month links

  • Visibility: public

$show_other_days

public boolean $show_other_days = FALSE

Show days of other months

  • Visibility: public

$CI

protected object $CI

CI Singleton

  • Visibility: protected

Methods

__construct

void CI_Calendar::__construct(array $config)

Class constructor

Loads the calendar language file and sets the default time reference.

  • Visibility: public

Arguments

  • $config array - <p>Calendar options</p>

initialize

\CI_Calendar CI_Calendar::initialize($config)

Initialize the user preferences

Accepts an associative array as input, containing display preferences

  • Visibility: public

Arguments

  • $config mixed

generate

string CI_Calendar::generate($year, $month, $data)

Generate the calendar

  • Visibility: public

Arguments

  • $year mixed
  • $month mixed
  • $data mixed

get_month_name

string CI_Calendar::get_month_name($month)

Get Month Name

Generates a textual month name based on the numeric month provided.

  • Visibility: public

Arguments

  • $month mixed

get_day_names

array CI_Calendar::get_day_names($day_type)

Get Day Names

Returns an array of day names (Sunday, Monday, etc.) based on the type. Options: long, short, abr

  • Visibility: public

Arguments

  • $day_type mixed

adjust_date

array CI_Calendar::adjust_date($month, $year)

Adjust Date

This function makes sure that we have a valid month/year. For example, if you submit 13 as the month, the year will increment and the month will become January.

  • Visibility: public

Arguments

  • $month mixed
  • $year mixed

get_total_days

integer CI_Calendar::get_total_days($month, $year)

Total days in a given month

  • Visibility: public

Arguments

  • $month mixed
  • $year mixed

default_template

array CI_Calendar::default_template()

Set Default Template Data

This is used in the event that the user has not created their own template

  • Visibility: public

parse_template

\CI_Calendar CI_Calendar::parse_template()

Parse Template

Harvests the data within the template {pseudo-variables} used to display the calendar

  • Visibility: public
Clone this wiki locally