diff options
author | Marcos SF Filho <sffmarcos142009z@gmail.com> | 2014-01-08 21:22:12 +0100 |
---|---|---|
committer | Marcos SF Filho <sffmarcos142009z@gmail.com> | 2014-01-08 21:22:12 +0100 |
commit | a593e3eb218002a630b7d0cf90002ec4a6fd1db3 (patch) | |
tree | cdfe5832fe98b71a5e349f17ee89bd2dfbe81391 | |
parent | 7977e1d4859d48be00bb11250446d9abeff6ac35 (diff) |
Code Corrections for the Calendar Pull Request
-rw-r--r-- | system/libraries/Calendar.php | 39 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 4 |
2 files changed, 20 insertions, 23 deletions
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index a2d9db14b..efaa49a34 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -156,7 +156,7 @@ class CI_Calendar { { if (empty($this->next_prev_url)) { - $this->next_prev_url = rtrim($this->CI->config->site_url($this->CI->router->class . '/' . $this->CI->router->method), '/') . '/'; + $this->next_prev_url = rtrim($this->CI->config->site_url($this->CI->router->class.'/'.$this->CI->router->method), '/').'/'; } } } @@ -298,32 +298,29 @@ class CI_Calendar { $out .= ($is_current_month === TRUE && $day == $cur_day) ? $this->temp['cal_cell_end_today'] : $this->temp['cal_cell_end']; } - else + elseif ($this->show_other_days === TRUE) { - if ($this->show_other_days === TRUE) + $out .= $this->temp['cal_cell_start_other']; + + if ($day <= 0) { - $out .= $this->temp['cal_cell_start_other']; - - if ($day <= 0) - { - // Day of previous month - $prev_month = $this->adjust_date(((int) $month) - 1, $year); - $prev_month_days = $this->get_total_days($prev_month['month'], $prev_month['year']); - $out .= str_replace('{day}', $prev_month_days + $day, $this->temp['cal_cell_other']); - } - else - { - // Day of next month - $out .= str_replace('{day}', $day - $total_days, $this->temp['cal_cell_other']); - } - - $out .= $this->temp['cal_cell_end_other']; + // Day of previous month + $prev_month = $this->adjust_date(((int) $month) - 1, $year); + $prev_month_days = $this->get_total_days($prev_month['month'], $prev_month['year']); + $out .= str_replace('{day}', $prev_month_days + $day, $this->temp['cal_cell_other']); } else { - // Blank cells - $out .= $this->temp['cal_cell_start'] . $this->temp['cal_cell_blank'] . $this->temp['cal_cell_end']; + // Day of next month + $out .= str_replace('{day}', $day - $total_days, $this->temp['cal_cell_other']); } + + $out .= $this->temp['cal_cell_end_other']; + } + else + { + // Blank cells + $out .= $this->temp['cal_cell_start'].$this->temp['cal_cell_blank'].$this->temp['cal_cell_end']; } $day++; diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 5da0330e5..ff7c09b48 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -280,8 +280,8 @@ Release Date: Not Released - :doc:`Calendar library <libraries/calendar>` changes include: - - Add configuration to generate days of other months instead of blank cells - - Auto set the *next_prev_url* if is empty and the *show_prev_next* is set to TRUE + - 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. - :doc:`Cart library <libraries/cart>` changes include: |