Class: CalendarsController

Inherits:
ApplicationController show all
Includes:
QueriesHelper, SortHelper
Defined in:
app/controllers/calendars_controller.rb

Overview

– copyright ChiliProject is a project management system.

Copyright (C) 2010-2013 the ChiliProject Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

See doc/COPYRIGHT.rdoc for more details. ++

Instance Method Summary (collapse)

Methods included from SortHelper

#sort_clause, #sort_clear, #sort_header_tag, #sort_init, #sort_link, #sort_name, #sort_update

Methods included from QueriesHelper

#column_content, #column_header, #operators_for_select, #retrieve_query

Methods included from Redmine::MenuManager::MenuController

#current_menu_item, included, #menu_items, #redirect_to_project_menu_item

Methods included from Redmine::Search::Controller

#default_search_scope, #default_search_scopes, included

Methods included from Redmine::I18n

#current_language, #day_name, #find_language, #format_date, #format_time, included, #l, #l_hours, #l_or_humanize, #ll, #month_name, #set_language_if_valid, #valid_languages

Instance Method Details

- (Object) show



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/calendars_controller.rb', line 24

def show
  if params[:year] and params[:year].to_i > 1900
    @year = params[:year].to_i
    if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13
      @month = params[:month].to_i
    end
  end
  @year ||= Date.today.year
  @month ||= Date.today.month

  @calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), current_language, :month)
  retrieve_query
  @query.group_by = nil
  if @query.valid?
    events = []
    events += @query.issues(:include => [:tracker, :assigned_to, :priority],
                            :conditions => ["((#{Issue.table_name}.start_date BETWEEN ? AND ?) OR (#{Issue.table_name}.due_date BETWEEN ? AND ?))", @calendar.startdt, @calendar.enddt, @calendar.startdt, @calendar.enddt]
                            )
    events += @query.versions(:conditions => ["#{Version.table_name}.effective_date BETWEEN ? AND ?", @calendar.startdt, @calendar.enddt])

    @calendar.events = events
  end

  render :action => 'show', :layout => false if request.xhr?
end

- (Object) update



50
51
52
# File 'app/controllers/calendars_controller.rb', line 50

def update
  show
end