var appConfig = getAppConfig(); var retQry = QueryNew("temp"); var dateRangeStruct = StructNew(); var filterData = StructNew(); var startDate = ""; var endDate = ""; var useVerboseOutput = getVerboseOutputStatus(); // Process the selected dates from the request.params and setup the request.ptCalendar date struct var selectedDates = processSelectedDate(); // Get dateRange based on viewRangeType dateRangeStruct = application.ptCalendar.calEventsService.getDateRangefromRangeType(dateRangeType=arguments.viewRangeType); if ( StructKeyExists(dateRangeStruct,"startDate") ) startDate = dateRangeStruct.startDate; if ( StructKeyExists(dateRangeStruct,"endDate") ) endDate = dateRangeStruct.endDate; // Display dates used to filter the events query (if verbose output is turned on) if ( useVerboseOutput ) { WriteOutput('
(Start Date: #startDate#) (End Date: #endDate#)
'); } // Get the Events from the getEvents methohd (either cached or uncached) retQry = application.ptCalendar.calEventsDAO.getEvents( startDate = startDate ,endDate = endDate ,useCache = useEventsCache ); // TODO: Find a better place to output this cache status information // Output Cache Status (if verbose output is turned on) if ( useVerboseOutput ) { application.ptCalendar.calEventsCacheService.renderCalendarCacheStatusHTML(); } // Filtering from the Display Properties Global Custom Element if ( ArrayLen(arguments.displayPropsArray) AND StructKeyExists(arguments.displayPropsArray[1],"values") ) { // Get Filter Fields and Values to be used in the filterEvents method filterData = application.ptCalendar.calEventsService.buildCleanFilterStruct(arguments.displayPropsArray[1].values); //application.ptCalendar.utils.doDump(filterStruct,"filterStruct",0); if ( !StructIsEmpty(filterData) ) { // Filter the query by fields and values from the display properties element retQry = application.ptCalendar.calEventsService.filterEvents(eventsQuery=retQry,filterStruct=filterData); //application.ptCalendar.utils.doDump(retQry,"retQry (Filterd)",0); if ( retQry.RecordCount AND useVerboseOutput ) { WriteOutput('
(Filtered: 1)
'); } } } return retQry;