app/controllers/schedules_controller.rb
# Default action.
#
# == Params:
#
# - <tt>:date_schedule</tt>
#   When set, it will override the current date inside the week to be displayed.
#
Default action.
Params.

:date_schedule
When set, it will override the current date inside the week to be displayed.
Default action . Params . : date_schedule When set it will override the current date inside the week to be displayed .
def index
    ap = AppParameter.get_parameter_row_for( :schedules )
    @max_view_height = ap.get_view_height()
    if ( params[:date_schedule].blank? || params[:date_schedule].nil? )
      start_date = DateTime.now.strftime( ap.get_filtering_resolution )
      @filtering_date_start  = ( Date.parse( start_date ) - ap.get_filtering_radius ).strftime( AGEX_FILTER_DATE_FORMAT_SQL )
      @filtering_date_end    = ( Date.parse( start_date ) + ap.get_filtering_radius ).strftime( AGEX_FILTER_DATE_FORMAT_SQL )
      @override_filtering    = nil
    else
      begin
        curr_date = Date.parse params[:date_schedule]
      rescue
        logger.warn("**[W]** - #{controller_name()}.index(): Warning: invalid date specified as paramaters! (params=#{params.inspect})")
        curr_date = Date.today
      end
      @filtering_date_start = Schedule.get_week_start( curr_date ).strftime( AGEX_FILTER_DATE_FORMAT_SQL )
      @filtering_date_end = Schedule.get_week_end( curr_date ).strftime( AGEX_FILTER_DATE_FORMAT_SQL )
      @override_filtering    = true
    end
    @context_title = I18n.t(:schedules_list, {:scope=>[:schedule]})
  end
def index ap = AppParameter . get_parameter_row_for ( :schedules ) @max_view_height = ap . get_view_height ( ) if ( params [ :date_schedule ] . blank? || params [ :date_schedule ] . nil? ) start_date = DateTime . now . strftime ( ap . get_filtering_resolution ) @filtering_date_start = ( Date . parse ( start_date ) - ap . get_filtering_radius ) . strftime ( AGEX_FILTER_DATE_FORMAT_SQL ) @filtering_date_end = ( Date . parse ( start_date ) + ap . get_filtering_radius ) . strftime ( AGEX_FILTER_DATE_FORMAT_SQL ) @override_filtering = nil else begin curr_date = Date . parse params [ :date_schedule ] rescue logger . warn ( "**[W]** - #{controller_name()}.index(): Warning: invalid date specified as paramaters! (params=#{params.inspect})" ) curr_date = Date . today end @filtering_date_start = Schedule . get_week_start ( curr_date ) . strftime ( AGEX_FILTER_DATE_FORMAT_SQL ) @filtering_date_end = Schedule . get_week_end ( curr_date ) . strftime ( AGEX_FILTER_DATE_FORMAT_SQL ) @override_filtering = true end @context_title = I18n . t ( :schedules_list , { :scope => [ :schedule ] } ) end
Default action.
Default action .
# DEBUG #    logger.debug( "\r\n\r\n---[ #{controller_name()}.index ] ---" ) #    logger.debug( "Params: #{params.inspect()}" ) # Having the parameters, apply the resolution and the radius backwards: # Set the (default) parameters for the scope configuration: (actual used value will be stored inside component_session[]) # Compute actual date range for the SQL data extraction query: # [20130212] We must use the AGEX_FILTER_DATE_FORMAT_SQL for the filtering dates used by # the custom Netzke component for the date filtering, because the result text from the # method Schedule.get_week_start/end_for_mysql_param() uses a DateTime instance instead of a simple Date # (used inside the FilteringDateRangePanel) # DEBUG #    logger.debug( "@filtering_date_start: #{@filtering_date_start.inspect()}" ) #    logger.debug( "@filtering_date_end:   #{@filtering_date_end.inspect()}" )