public function hook_calendar($userId)
 {
     $date = new w2p_Utilities_Date(w2PgetParam($_GET, 'date', null));
     $date->setTime(0, 0, 0);
     $start = $date->duplicate();
     $end = $date->duplicate();
     $view = w2PgetParam($_GET, 'a', 'month_view');
     switch ($view) {
         case 'day_view':
             break;
         case 'week_view':
             $end->addDays(6);
             break;
         case 'index':
         case 'month_view':
             $start->setDay(1);
             $end->setDay($date->getDaysInMonth());
             break;
         case 'year_view':
             $start->setMonth(1);
             $start->setDay(1);
             $end->setMonth(12);
             $end->setDay(31);
             break;
     }
     $end->setTime(23, 59, 59);
     $holidays = HolidayFunctions::getHolidaysForDatespan($start, $end, $userId);
     $itemsList = array();
     foreach ($holidays as $i => $holiday) {
         $date = $holiday['startDate'];
         $end = $holiday['endDate'];
         while (!$date->after(clone $end)) {
             $itemsList[] = array('id' => $holiday['id'], 'name' => $holiday['name'], 'startDate' => $date->format(FMT_TIMESTAMP_DATE), 'endDate' => $date->format(FMT_TIMESTAMP_DATE), 'description' => $holiday['description']);
             $date = $date->getNextDay();
         }
     }
     return $itemsList;
 }