From 9bf3cf2e2b770db17953a8db87ccfa17e438aa2e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 18 Feb 2014 16:39:46 +0200 Subject: [ci skip] Clean-up following PR #2864 --- user_guide_src/source/changelog.rst | 4 +- user_guide_src/source/libraries/calendar.rst | 100 ++++++++++++++------------- 2 files changed, 54 insertions(+), 50 deletions(-) (limited to 'user_guide_src') diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 5d5c5df26..9ec4d0d77 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -299,8 +299,8 @@ Release Date: Not Released - Added method chaining support. - Added configuration to generate days of other months instead of blank cells. - - Auto set *next_prev_url* if it is empty and *show_prev_next* is set to TRUE. - - The template now accepts an array in addition to the encoded string. + - Added auto-configuration for *next_prev_url* if it is empty and *show_prev_next* is set to TRUE. + - Added support for templating via an array in addition to the encoded string. - :doc:`Cart Library ` changes include: diff --git a/user_guide_src/source/libraries/calendar.rst b/user_guide_src/source/libraries/calendar.rst index 792f1d504..b4f95db1b 100644 --- a/user_guide_src/source/libraries/calendar.rst +++ b/user_guide_src/source/libraries/calendar.rst @@ -60,11 +60,11 @@ parameter of the calendar generating function. Consider this example:: $this->load->library('calendar'); $data = array( - 3 => 'http://example.com/news/article/2006/03/', - 7 => 'http://example.com/news/article/2006/07/', - 13 => 'http://example.com/news/article/2006/13/', - 26 => 'http://example.com/news/article/2006/26/' - ); + 3 => 'http://example.com/news/article/2006/03/', + 7 => 'http://example.com/news/article/2006/07/', + 13 => 'http://example.com/news/article/2006/13/', + 26 => 'http://example.com/news/article/2006/26/' + ); echo $this->calendar->generate(2006, 6, $data); @@ -83,11 +83,11 @@ There are seven preferences you can set to control various aspects of the calendar. Preferences are set by passing an array of preferences in the second parameter of the loading function. Here is an example:: - $prefs = array ( - 'start_day' => 'saturday', - 'month_type' => 'long', - 'day_type' => 'short' - ); + $prefs = array( + 'start_day' => 'saturday', + 'month_type' => 'long', + 'day_type' => 'short' + ); $this->load->library('calendar', $prefs); @@ -123,10 +123,10 @@ To allow your calendar to dynamically increment/decrement via the next/previous links requires that you set up your calendar code similar to this example:: - $prefs = array ( - 'show_next_prev' => TRUE, - 'next_prev_url' => 'http://example.com/index.php/calendar/show/' - ); + $prefs = array( + 'show_next_prev' => TRUE, + 'next_prev_url' => 'http://example.com/index.php/calendar/show/' + ); $this->load->library('calendar', $prefs); @@ -147,63 +147,67 @@ Creating a Calendar Template ============================ By creating a calendar template you have 100% control over the design of -your calendar. Using the string method, each component of your calendar will be placed within a -pair of pseudo-variables as shown here:: +your calendar. Using the string method, each component of your calendar +will be placed within a pair of pseudo-variables as shown here:: $prefs['template'] = ' - {table_open}{/table_open} + {table_open}
{/table_open} - {heading_row_start}{/heading_row_start} + {heading_row_start}{/heading_row_start} - {heading_previous_cell}{/heading_previous_cell} - {heading_title_cell}{/heading_title_cell} - {heading_next_cell}{/heading_next_cell} + {heading_previous_cell}{/heading_previous_cell} + {heading_title_cell}{/heading_title_cell} + {heading_next_cell}{/heading_next_cell} - {heading_row_end}{/heading_row_end} + {heading_row_end}{/heading_row_end} - {week_row_start}{/week_row_start} - {week_day_cell}{/week_day_cell} - {week_row_end}{/week_row_end} + {week_row_start}{/week_row_start} + {week_day_cell}{/week_day_cell} + {week_row_end}{/week_row_end} - {cal_row_start}{/cal_row_start} - {cal_cell_start}{/cal_row_start} + {cal_cell_start}{/cal_cell_end} - {cal_cell_end_today}{/cal_cell_end_today} - {cal_cell_end_other}{/cal_cell_end_other} - {cal_row_end}{/cal_row_end} + {cal_cell_end}{/cal_cell_end} + {cal_cell_end_today}{/cal_cell_end_today} + {cal_cell_end_other}{/cal_cell_end_other} + {cal_row_end}{/cal_row_end} - {table_close}
<<{heading}>><<{heading}>>
{week_day}
{week_day}
{/cal_cell_start} - {cal_cell_start_today}{/cal_cell_start_today} - {cal_cell_start_other}{/cal_cell_start_other} + {cal_row_start}
{/cal_cell_start} + {cal_cell_start_today}{/cal_cell_start_today} + {cal_cell_start_other}{/cal_cell_start_other} - {cal_cell_content}{day}{/cal_cell_content} - {cal_cell_content_today}{/cal_cell_content_today} + {cal_cell_content}{day}{/cal_cell_content} + {cal_cell_content_today}{/cal_cell_content_today} - {cal_cell_no_content}{day}{/cal_cell_no_content} - {cal_cell_no_content_today}
{day}
{/cal_cell_no_content_today} + {cal_cell_no_content}{day}{/cal_cell_no_content} + {cal_cell_no_content_today}
{day}
{/cal_cell_no_content_today} - {cal_cell_blank} {/cal_cell_blank} + {cal_cell_blank} {/cal_cell_blank} - {cal_cell_other}{day}{cal_cel_other} + {cal_cell_other}{day}{cal_cel_other} - {cal_cell_end}
{/table_close} + {table_close}{/table_close} '; $this->load->library('calendar', $prefs); echo $this->calendar->generate(); -Using the array method, you will pass `key => value` pairs. You can pass as many or as few values as you'd like. Omitted keys will use the default values inherit in the calendar class. +Using the array method, you will pass `key => value` pairs. You can pass as +many or as few values as you'd like. Omitted keys will use the default values +inherited in the calendar class. - $prefs['template'] = array( - 'table_open' => '', - 'cal_cell_start' => '
', - 'cal_cell_start_today' => '', - ); +Example:: + + $prefs['template'] = array( + 'table_open' => '', + 'cal_cell_start' => '
', + 'cal_cell_start_today' => '' + ); - $this->load->library('calendar', $prefs); + $this->load->library('calendar', $prefs); - echo $this->calendar->generate(); + echo $this->calendar->generate(); *************** Class Reference -- cgit v1.2.3-24-g4f1b