Install sitealizer stats
[selectricity-live] / vendor / plugins / sitealizer / lib / app / views / sitealizer / hourly_stats.rhtml
diff --git a/vendor/plugins/sitealizer/lib/app/views/sitealizer/hourly_stats.rhtml b/vendor/plugins/sitealizer/lib/app/views/sitealizer/hourly_stats.rhtml
new file mode 100644 (file)
index 0000000..436c886
--- /dev/null
@@ -0,0 +1,39 @@
+<div style="margin-top:12px">
+<table align=center width=95% cellpadding=0>
+</tr>
+<td>
+<div id='border'>
+<div id='title'>Hourly Statistics - <%=params[:month]%>-<%=params[:year]%></div>
+
+<% hits_max_total = @hourly_hits.inject(0) {|m,a| a[2].to_i > m ? a[2].to_i : m } %>
+<br><br>
+<table align=center border=1 width=70% cellpadding=3>
+<tr>
+<th>Hour</th>
+<th>Hits</th>
+<th>Percentage</th>
+
+<th></th>
+</tr>
+<% 
+@hourly_hits.each do |hourly_hits| 
+width = 0
+if hits_max_total > 0
+       width = ((hourly_hits[2].to_f/hits_max_total)*200).round 
+       width = 1 if width < 1
+end
+%>
+<tr>
+<td align=center><%= hourly_hits[0] %></td>
+<td align=center><%= hourly_hits[2] %></td>
+<td align=center><%= sprintf("%000.2f",(hourly_hits[2].to_f/@total_hits)*100) %>%</td>
+
+<td align=left><%=image_tag 'sitealizer/bar.gif', :width => width, :height => 3%></td>
+</tr>
+<% end %>
+</table>
+</div>
+</td>
+</tr>
+</table>
+</div>
\ No newline at end of file

Benjamin Mako Hill || Want to submit a patch?