Update Cruise Schedule app
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 20 Jun 2014 16:44:25 +0000 (12:44 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 20 Jun 2014 16:44:25 +0000 (12:44 -0400)
set to use all months
set output to only show months that have dates

Toolkit/Schedule/Calendar.php
Toolkit/Schedule/DepartureCalendar.php
Toolkit/Schedule/application.ini

index 3a036b2..d6cf1a8 100644 (file)
@@ -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);
index 57038e0..9749da6 100644 (file)
@@ -173,6 +173,8 @@ class Toolkit_Schedule_DepartureCalendar
             }
         }
         $selected = $cals->getDepartureDates($scheduleId);
+//        echo '<pre>'.print_r($selected, true).'</pre>';
+//        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;
index 2db38a8..4110284 100644 (file)
@@ -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