CI_Calendar

class CI_Calendar

initialize([$config = array()])
Parameters:
  • $config (array) – Configuration parameters
Returns:

CI_Calendar instance (method chaining)

Return type:

CI_Calendar

Initializes the Calendaring preferences. Accepts an associative array as input, containing display preferences.

generate([$year = ''[, $month = ''[, $data = array()]]])
Parameters:
  • $year (int) – Year
  • $month (int) – Month
  • $data (array) – Data to be shown in the calendar cells
Returns:

HTML-formatted calendar

Return type:

string

Generate the calendar.

get_month_name($month)
Parameters:
  • $month (int) – Month
Returns:

Month name

Return type:

string

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

get_day_names($day_type = '')
Parameters:
  • $day_type (string) – ‘long’, ‘short’, or ‘abr’
Returns:

Array of day names

Return type:

array

Returns an array of day names (Sunday, Monday, etc.) based on the type provided. Options: long, short, abr. If no $day_type is provided (or if an invalid type is provided) this method will return the “abbreviated” style.

adjust_date($month, $year)
Parameters:
  • $month (int) – Month
  • $year (int) – Year
Returns:

An associative array containing month and year

Return type:

array

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

print_r($this->calendar->adjust_date(13, 2014));

outputs:

Array
(
        [month] => '01'
        [year] => '2015'
)
get_total_days($month, $year)
Parameters:
  • $month (int) – Month
  • $year (int) – Year
Returns:

Count of days in the specified month

Return type:

int

Total days in a given month:

echo $this->calendar->get_total_days(2, 2012);
// 29

Note

This method is an alias for Date Helper function days_in_month().

default_template()
Returns: An array of template values
Return type: array

Sets the default template. This method is used when you have not created your own template.

parse_template()
Returns: CI_Calendar instance (method chaining)
Return type: CI_Calendar

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

doc_CodeIgniter
2016-10-15 16:30:57
Comments
Leave a Comment

Please login to continue.