Sha256: 58782b7d7b9b5aafbe5161807bb6cacdc322bb0ed6607d323cda700c2de561f0

Contents?: true

Size: 930 Bytes

Versions: 5

Compression:

Stored size: 930 Bytes

Contents

load File.join(Gem.loaded_specs['forgeos_core'].full_gem_path, 'app', 'controllers', 'admin', 'statistics_controller.rb')
Admin::StatisticsController.class_eval do
  before_filter :pages_most_viewed, :only => :index

  # generates the ofc2 graph
  def graph
    get_date
    # visitors
    visitors = @date.collect{|day| Forgeos::Statistics.total_of_visitors(day)}

    # Bar for visitors
    bar = OpenFlashChart::Bar.new
    bar.values  = visitors
    bar.tooltip = "#val# #{I18n.t('visitor', :count => 2)}"
    bar.colour  = '#F2B833'

    # Conf for Y left axis
    # calculates max number of visitors
    max_visitors = visitors.flatten.compact.max.to_i
    max_count_visitors = max_visitors > 0 ? max_visitors : 5

    return render :json => generate_graph([bar], [max_count_visitors], '#F7BD2E')
  end

private
  def pages_most_viewed
    @pages_most_viewed = Forgeos::Cms::Statistics.pages_most_viewed(@date,10)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
forgeos_cms-1.9.5.rc1 app/controllers/admin/statistics_controller.rb
forgeos_cms-1.9.4 app/controllers/admin/statistics_controller.rb
forgeos_cms-1.9.2 app/controllers/admin/statistics_controller.rb
forgeos_cms-1.9.1 app/controllers/admin/statistics_controller.rb
forgeos_cms-1.9.0 app/controllers/admin/statistics_controller.rb