Install sitealizer stats
[selectricity-live] / vendor / plugins / sitealizer / lib / app / views / sitealizer / _monthly_hits.rhtml
diff --git a/vendor/plugins/sitealizer/lib/app/views/sitealizer/_monthly_hits.rhtml b/vendor/plugins/sitealizer/lib/app/views/sitealizer/_monthly_hits.rhtml
new file mode 100644 (file)
index 0000000..dfbb94e
--- /dev/null
@@ -0,0 +1,67 @@
+<br>
+<% 
+unique_max_total = @month_hits.inject(0) {|m,a| a[1].to_i > m ? a[1].to_i : m }
+hits_max_total = @month_hits.inject(0) {|m,a| a[2].to_i > m ? a[2].to_i : m }
+%>
+<table cellpadding=0 cellspacing=0 align=center width=65%>
+<tr valign=bottom>
+<td valign=top align=left width=60 nowrap>
+       <img align="bottom" src="/images/sitealizer/uv.png" height="10" width="4"/> Unique<br>
+       <img align="bottom" src="/images/sitealizer/vh.png" height="10" width="4"/> Hits
+</td>
+<% 
+@month_hits.each do |month_hits|
+unique_height = 0
+hits_height   = 0
+if unique_max_total > 0
+       unique_height = ((month_hits[1].to_f/unique_max_total)*100).round
+       unique_height = 1 if unique_height < 1          
+end
+if hits_max_total > 0
+       hits_height   = ((month_hits[2].to_f/hits_max_total)*100).round
+       hits_height   = 1 if hits_height < 1    
+end
+%>
+<td>
+       <table>
+       <tr valign=bottom nowrap align=center>
+       <td>
+       <img align="bottom" src="/images/sitealizer/uv.png" height="<%=unique_height%>" width="4"/>
+       <img align="bottom" src="/images/sitealizer/vh.png" height="<%=hits_height%>" width="4"/>
+       </td>
+       </tr>
+       <tr valign=bottom nowrap align=center>
+       <td>
+               <span style="font-size:10px"><%=month_hits[0]%></span>
+       </td>
+       </tr>
+       </table>
+</td>
+<%end%>
+</tr>
+</table>
+
+<br><br>
+
+<table align=center width=70% border=1 cellpadding=3>
+<tr align=center nowrap>
+<th align=center>Month</th>
+<th align=center>Hits</th>
+<th align=center>Percentage</th>
+<th align=center>Unique Visits</th>
+</tr>
+<%i=1; @month_hits.each do |month_hits| %>
+<tr nowrap>
+<td align=left><%= month_hits[0] %></td>
+<td align=center><%= month_hits[2] %></td>
+<td align=center><%= sprintf("%000.2f",(month_hits[2].to_f/@year_hits)*100) %>%</td>
+<td align=center><%= month_hits[1] %></td>
+</tr>
+<% i+=1; end %>
+<tr align=center nowrap bgcolor="#DDDDDD">
+<td align=left><b>Totals:</td>
+<td align=center><b><%=@year_hits%></b></td>
+<td></td>      
+<td align=center><b><%=@year_uniq%></b></td>
+</tr>
+</table>
\ No newline at end of file

Benjamin Mako Hill || Want to submit a patch?