From a593e3eb218002a630b7d0cf90002ec4a6fd1db3 Mon Sep 17 00:00:00 2001 From: Marcos SF Filho Date: Wed, 8 Jan 2014 18:22:12 -0200 Subject: Code Corrections for the Calendar Pull Request --- system/libraries/Calendar.php | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'system/libraries') 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++; -- cgit v1.2.3-24-g4f1b