Install sitealizer stats
[selectricity-live] / vendor / plugins / sitealizer / lib / app / views / sitealizer / _daily_stats.rhtml
1 <br>
2 <% 
3 unique_max_total = @daily_hits.inject(0) {|m,a| a[1].to_i > m ? a[1].to_i : m }
4 hits_max_total = @daily_hits.inject(0) {|m,a| a[2].to_i > m ? a[2].to_i : m }
5 %>
6 <table cellpadding=0 cellspacing=0 align=center width=98%>
7 <tr valign=bottom>
8 <td valign=top align=left width=60 nowrap>
9         <img align="bottom" src="/images/sitealizer/uv.png" height="10" width="4"/> Unique<br>
10         <img align="bottom" src="/images/sitealizer/vh.png" height="10" width="4"/> Hits
11 </td>
12 <% 
13 @daily_hits.each do |daily_hits| 
14 unique_height = 0
15 hits_height   = 0
16 if unique_max_total > 0
17         unique_height = ((daily_hits[1].to_f/unique_max_total)*100).round
18         unique_height = 1 if unique_height < 1  
19 end     
20 if hits_max_total > 0
21         hits_height   = ((daily_hits[2].to_f/hits_max_total)*100).round
22         hits_height   = 1 if hits_height < 1    
23 end
24 %>
25 <td>
26         <table>
27         <tr valign=bottom nowrap>
28         <td nowrap>
29         <img align="bottom" src="/images/sitealizer/uv.png" height="<%=unique_height%>" width="4"/>
30         <img align="bottom" src="/images/sitealizer/vh.png" height="<%=hits_height%>" width="4"/>
31         </td>
32         </tr>
33         <tr valign=bottom nowrap>
34         <td>
35                 <%=daily_hits[0]%>
36         </td>
37         </tr>
38         </table>
39 </td>
40 <%end%>
41 </tr>
42 </table>
43
44 <br><br>
45
46 <table align=center width=70% border=1 cellpadding=3>
47 <tr align=center nowrap>
48 <th align=center>Day</th>
49 <th align=center>Hits</th>
50 <th align=center>Percentage</th>
51 <th align=center>Unique Visits</th>
52 </tr>
53 <%i=1; @daily_hits.each do |daily_hits| %>
54 <tr nowrap>
55 <td align=center><%= daily_hits[3] %></td>
56 <td align=center><%= daily_hits[2] %></td>
57 <td align=center><%= sprintf("%000.2f",(daily_hits[2].to_f/@total_hits)*100) %>%</td>
58 <td align=center><%= daily_hits[1] %></td>
59 </tr>
60 <% i+=1; end %>
61 <tr align=center nowrap bgcolor="#DDDDDD">
62 <td align=left><b>Totals:</td>
63 <td align=center><b><%=@total_hits%></b></td>
64 <td></td>       
65 <td align=center><b><%=@unique_hits%></b></td>
66 </tr>
67 </table>

Benjamin Mako Hill || Want to submit a patch?