global $HTTP_POST_VARS, $PUBLIC_IMAGE_PATH, $INCLUDE_PATH, $AGENCY_PARTNER_ACTIVE_TYPES; global $objCurrUser; require_once("$INCLUDE_PATH/views/public/OccurrenceView.php"); $color1 = "E7E7E7"; $color2 = "6DB478"; $color3 = "B4B4B4"; $color4 = "FFFFFF"; $color5 = "C3C3C3"; $color6 = "6A6A6A"; $color6 = "000000"; $color7 = "CECECE"; // Calendar manipulation and generation code: $year = $HTTP_POST_VARS["year"]; $month = $HTTP_POST_VARS["month"]; $day = $HTTP_POST_VARS["day"]; $parseDate = getdate(); $year = ($year == '' || $year == '0')?$parseDate['year']:$year; $month = ($month == '' || $month == '0')?$parseDate['mon']:$month; $day = ($day == '' || $day == '0')?$parseDate['mday']:$day; $arFilters = array('filter_corporateProjects','filter_impactArea','filter_attributes','filter_region','_setFlag','_clearFlag'); $arExtraParameters = array(); foreach($arFilters as $sFilter) { if($HTTP_POST_VARS[$sFilter]) $arExtraParameters[] = $sFilter . '=' . $HTTP_POST_VARS[$sFilter]; } $monthLink = getenv('SCRIPT_NAME').'?_mode=calendar&_type=month&_action=calendar&year='.$year.'&month='.$month.'&'.implode('&',$arExtraParameters); $weekLink = getenv('SCRIPT_NAME').'?_mode=calendar&_type=week&_action=calendar&year='.$year.'&month='.$month.'&day='.$day.'&'.implode('&',$arExtraParameters); $baseLink = getenv('SCRIPT_NAME').'?_mode=calendar&_type=day&_action=calendar'.'&'.implode('&',$arExtraParameters); $selectedDate = getdate(strtotime($month.'/'.$day.'/'.$year)); $day_offset = $selectedDate['wday']; $month_text = $selectedDate['month']; $next_month = ($day + 1 > getDaysInMonth($month,$year))?(($month == 12)?1:$month+1):$month; $prev_month = ($day - 1 == 0)?(($month == 1)?12:$month-1):$month; $next_year = ($month != $next_month && $next_month == 1)?$year+1:$year; $prev_year = ($month != $prev_month && $prev_month == 12)?$year-1:$year; $next_day = ($day + 1 > getDaysInMonth($month,$year))?1:$day+1; $prev_day = ($day - 1 == 0)?getDaysInMonth($prev_month, $prev_year):$day - 1; $arProjectFilters['ixaffiliatemarketingcategory'] = $HTTP_POST_VARS['filter_attributes']; $arProjectFilters['iximpactarea'] = $HTTP_POST_VARS['filter_impactArea']; $arProjectFilters['sregion'] = $HTTP_POST_VARS['filter_region']; $objOccurrence = new Occurrence( array() ); $objOccurrenceFactory = new OccurrenceFactory(); // We need to retrieve all occurrences this day. So we specify the max // range to be the first second of the next day. $arDateRange = array($year.'-'.$month.'-'.$day,$next_year.'-'.$next_month.'-'.$next_day); list ($arOccurrence, $iNumOngoingReferrals) = $objOccurrenceFactory->searchByProjectFilters( $arProjectFilters, $arDateRange, true, true ); $objOccurrenceView = new OccurrenceView( $objOccurrence ); $sTypeName = (checkFlag('course') ? 'course' : 'project'); $sFlipFlags = (checkFlag('course') ? '_clearFlag=course' : '_setFlag=course'); // Generate what the possible error message should be: $sErrorMsg = ''; if ($arProjectFilters) { while (list($key,$val) = each($arProjectFilters)) { if ($val != '') { $sErrorMsg = 'There are no '.$sTypeName.' sessions scheduled for this day given the selected filters. Please choose another '.$sTypeName.' attribute or impact area.'; } } } $objSlug = SlugManagerFactory::get('Ongoing Referrals Button Area'); if(is_object($objSlug)) { $sReferralButtonText = $objSlug->printSlug(); } ?>