summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/libraries/calendar.rst
diff options
context:
space:
mode:
Diffstat (limited to 'user_guide_src/source/libraries/calendar.rst')
-rw-r--r--user_guide_src/source/libraries/calendar.rst141
1 files changed, 123 insertions, 18 deletions
diff --git a/user_guide_src/source/libraries/calendar.rst b/user_guide_src/source/libraries/calendar.rst
index ed2a14c8c..65a447a3d 100644
--- a/user_guide_src/source/libraries/calendar.rst
+++ b/user_guide_src/source/libraries/calendar.rst
@@ -7,6 +7,17 @@ calendars can be formatted through the use of a calendar template,
allowing 100% control over every aspect of its design. In addition, you
can pass data to your calendar cells.
+.. contents::
+ :local:
+
+.. raw:: html
+
+ <div class="custom-index container"></div>
+
+***************************
+Using the Calendaring Class
+***************************
+
Initializing the Class
======================
@@ -86,23 +97,23 @@ The above code would start the calendar on saturday, use the "long"
month heading, and the "short" day names. More information regarding
preferences below.
-====================== ================= =============================================== ===================================================================
-Preference Default Options Description
-====================== ================= =============================================== ===================================================================
-**template** None None A string containing your calendar template.
- See the template section below.
-**local_time** time() None A Unix timestamp corresponding to the current time.
-**start_day** sunday Any week day (sunday, monday, tuesday, etc.) Sets the day of the week the calendar should start on.
-**month_type** long long, short Determines what version of the month name to use in the header.
- long = January, short = Jan.
-**day_type** abr long, short, abr Determines what version of the weekday names to use in
- the column headers. long = Sunday, short = Sun, abr = Su.
-**show_next_prev** FALSE TRUE/FALSE (boolean) Determines whether to display links allowing you to toggle
- to next/previous months. See information on this feature below.
-**next_prev_url** controller/method A URL Sets the basepath used in the next/previous calendar links.
-**show_other_days** FALSE TRUE/FALSE (boolean) Determines whether to display days of other months that share the
- first or last week of the calendar month.
-====================== ================= =============================================== ===================================================================
+====================== ================= ============================================ ===================================================================
+Preference Default Options Description
+====================== ================= ============================================ ===================================================================
+**template** None None A string containing your calendar template.
+ See the template section below.
+**local_time** time() None A Unix timestamp corresponding to the current time.
+**start_day** sunday Any week day (sunday, monday, tuesday, etc.) Sets the day of the week the calendar should start on.
+**month_type** long long, short Determines what version of the month name to use in the header.
+ long = January, short = Jan.
+**day_type** abr long, short, abr Determines what version of the weekday names to use in
+ the column headers. long = Sunday, short = Sun, abr = Su.
+**show_next_prev** FALSE TRUE/FALSE (boolean) Determines whether to display links allowing you to toggle
+ to next/previous months. See information on this feature below.
+**next_prev_url** controller/method A URL Sets the basepath used in the next/previous calendar links.
+**show_other_days** FALSE TRUE/FALSE (boolean) Determines whether to display days of other months that share the
+ first or last week of the calendar month.
+====================== ================= ============================================ ===================================================================
Showing Next/Previous Month Links
@@ -180,4 +191,98 @@ pair of pseudo-variables as shown here::
$this->load->library('calendar', $prefs);
- echo $this->calendar->generate(); \ No newline at end of file
+ echo $this->calendar->generate();
+
+***************
+Class Reference
+***************
+
+.. class:: CI_Calendar
+
+ .. method:: initialize([$config = array()])
+
+ :param array $config: Configuration parameters
+ :returns: CI_Calendar instance (method chaining)
+ :rtype: CI_Calendar
+
+ Initializes the Calendaring preferences. Accepts an associative array as input, containing display preferences.
+
+ .. method:: generate([$year = ''[, $month = ''[, $data = array()]]])
+
+ :param int $year: Year
+ :param int $month: Month
+ :param array $data: Data to be shown in the calendar cells
+ :returns: HTML-formatted calendar
+ :rtype: string
+
+ Generate the calendar.
+
+
+ .. method:: get_month_name($month)
+
+ :param int $month: Month
+ :returns: Month name
+ :rtype: string
+
+ Generates a textual month name based on the numeric month provided.
+
+ .. method:: get_day_names($day_type = '')
+
+ :param string $day_type: 'long', 'short', or 'abr'
+ :returns: Array of day names
+ :rtype: 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.
+
+ .. method:: adjust_date($month, $year)
+
+ :param int $month: Month
+ :param int $year: Year
+ :returns: An associative array containing month and year
+ :rtype: 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, 2013));
+
+ outputs::
+
+ Array
+ (    
+ [month] => '01'
+ [year] => '2014'
+ )
+
+ .. method:: get_total_days($month, $year)
+
+ :param int $month: Month
+ :param int $year: Year
+ :returns: Count of days in the specified month
+ :rtype: int
+
+ Total days in a given month::
+
+ echo $this->calendar->get_total_days(2, 2012);
+ // 29
+
+ .. method:: default_template()
+
+ :returns: An array of template values
+ :rtype: array
+
+ Sets the default template. This method is used when you have not created
+ your own template.
+
+
+ .. method:: parse_template()
+
+ :returns: CI_Calendar instance (method chaining)
+ :rtype: CI_Calendar
+
+ Harvests the data within the template ``{pseudo-variables}`` used to
+ display the calendar. \ No newline at end of file