From b716b993ac3dd7b0b2cd118ee88f52497160fc9f Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 20 Jun 2014 12:44:25 -0400 Subject: [PATCH] Update Cruise Schedule app set to use all months set output to only show months that have dates --- Toolkit/Schedule/Calendar.php | 5 +++++ Toolkit/Schedule/DepartureCalendar.php | 6 +++++- Toolkit/Schedule/application.ini | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Toolkit/Schedule/Calendar.php b/Toolkit/Schedule/Calendar.php index 3a036b2..d6cf1a8 100644 --- a/Toolkit/Schedule/Calendar.php +++ b/Toolkit/Schedule/Calendar.php @@ -2,6 +2,7 @@ class Toolkit_Schedule_Calendar { + public $months = array(); /** * buildCalendar * @@ -153,6 +154,10 @@ class Toolkit_Schedule_Calendar ); $day->class = 'depart'.$row['departure_id']; $dates[$row['id']] = $day; + $month = $date->getMonth(); + if (!in_array($month, $this->months)) { + $this->months[] = $month; + } } } catch(PDOException $e){ Toolkit_Common::handleError($e); diff --git a/Toolkit/Schedule/DepartureCalendar.php b/Toolkit/Schedule/DepartureCalendar.php index 57038e0..9749da6 100644 --- a/Toolkit/Schedule/DepartureCalendar.php +++ b/Toolkit/Schedule/DepartureCalendar.php @@ -173,6 +173,8 @@ class Toolkit_Schedule_DepartureCalendar } } $selected = $cals->getDepartureDates($scheduleId); +// echo '
'.print_r($selected, true).'
'; +// exit; $year = ($year) ? $year @@ -181,7 +183,9 @@ class Toolkit_Schedule_DepartureCalendar $startingMonth = $this->config->months->start; $endingMonth = $this->config->months->end; for ($i = $startingMonth; $i <= $endingMonth; ++$i) { - $page->calendarsHtml .= $cals->buildCalendar($i, $year, $selected); + if (in_array($i, $cals->months)) { + $page->calendarsHtml .= $cals->buildCalendar($i, $year, $selected); + } } $tpl = new HTML_Template_Flexy($this->flexyOptions); $page->style = $style; diff --git a/Toolkit/Schedule/application.ini b/Toolkit/Schedule/application.ini index 2db38a8..4110284 100644 --- a/Toolkit/Schedule/application.ini +++ b/Toolkit/Schedule/application.ini @@ -9,7 +9,7 @@ flexy.options.templateDir = BASE "Toolkit/Schedule/templates/" flexy.options.compileDir = BASE "Toolkit/Schedule/templates/compiled/" ; the starting month to use in the multiple date picker -months.start = 4 +months.start = 1 ; the ending month to use in the multiple date picker months.end = 12 ; controls the width of the dialog box for the multiple date picker -- 2.17.1