aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/admin_controller.rb
blob: 4713af8a943774ca33ec6d38ff118a0410d49351 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# app/controllers/admin_controller.rb:
# Controller for admin interface.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
# $Id: admin_controller.rb,v 1.3 2008-03-14 11:08:41 francis Exp $

class AdminController < ApplicationController
    layout "admin"

    def index
        @user_count = User.count
        @public_body_count = PublicBody.count
        @info_request_count = InfoRequest.count

        @events_title = "Events in last week"
        date_back_to = Time.now - 1.week
        if params[:month]
            @events_title = "Events in last month"
            date_back_to = Time.now - 1.month
        end
        if params[:all]
            @events_title = "Events, all time"
            date_back_to = Time.now - 1000.years
        end

        @events = InfoRequestEvent.find(:all, :order => "created_at desc, id desc",
                :conditions => ["created_at > ? ", date_back_to])
    end
end