summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2013-07-21 23:21:41 +0200
committerDerek Jones <derek.jones@ellislab.com>2013-07-21 23:21:41 +0200
commita756125436884dd622fdeff67084f3a62fc71b98 (patch)
tree1d3a5b97db63d26b95c56e38fb5420b2a865a3ef
parent9046f20a2b34c6b27a86ac34da4e20d836f5e091 (diff)
Updating Calendar lib docs
-rw-r--r--system/libraries/Calendar.php2
-rw-r--r--user_guide_src/source/libraries/calendar.rst108
2 files changed, 106 insertions, 4 deletions
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php
index 23d8ffb42..9c68c94c1 100644
--- a/system/libraries/Calendar.php
+++ b/system/libraries/Calendar.php
@@ -329,7 +329,7 @@ class CI_Calendar {
* Get Day Names
*
* Returns an array of day names (Sunday, Monday, etc.) based
- * on the type. Options: long, short, abrev
+ * on the type. Options: long, short, abr
*
* @param string
* @return array
diff --git a/user_guide_src/source/libraries/calendar.rst b/user_guide_src/source/libraries/calendar.rst
index 3964db25e..d9a336d08 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
======================
@@ -87,7 +98,7 @@ month heading, and the "short" day names. More information regarding
preferences below.
====================== =========== =============================================== ===================================================================
-Preference Default Options Description
+Preference Default Options Description
====================== =========== =============================================== ===================================================================
**template** None None A string containing your calendar template.
See the template section below.
@@ -95,7 +106,7 @@ Preference Default Options Description
**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
+**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.
@@ -171,4 +182,95 @@ 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: config preferences
+ :returns: void
+
+ Initializes the Calendaring preferences. Accepts an associative array as input, containing display preferences.
+
+
+ .. method:: generate([$year = ''[, $month = ''[, $data = array()]]])
+
+ :param int $year: the year
+ :param int $month: the month
+ :param array $data: the data to be shown in the calendar cells
+ :returns: string
+
+ Generate the calendar.
+
+
+ .. method:: get_month_name($month)
+
+ :param int $month: the numeric month
+ :returns: string
+
+ Generates a textual month name based on the numeric month provided.
+
+
+ .. method:: get_day_names($day_type = '')
+
+ :param string $day_type: one of 'long', 'short', or 'abr'
+ :returns: 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: the month
+ :param int $year: the year
+ :returns: array
+
+ This method makes usre 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: the month
+ :param int $year: the year
+ :returns: int
+
+ Total days in a given month::
+
+ echo $this->calendar->get_total_days(2, 2012);
+ // 29
+
+
+ .. method:: default_template()
+
+ :returns: array
+
+ Sets the default template. This method is used when you have not created
+ your own template.
+
+
+ .. method:: parse_template()
+
+ :returns: void
+
+ Harvests the data within the template ``{pseudo-variables}`` used to
+ display the calendar. \ No newline at end of file