借助于smarty写一个流量分析表
借助于smarty写一个流量分析表,直接上线 别的不多说!
function escape_c(str)
{
str = str.replace(/"/g,escape('"'));
str = str.replace(/'/g,escape("'"));
str = str.replace(/>/g,escape('>'));
str = str.replace(/</g,escape("<"));
str = str.replace(/"/g,escape('"'));
str = str.replace(/'/g,escape("'"));
str = str.replace(/&/g,escape("&"));
str = str.replace(/</g,escape("<"));
str = str.replace(/>/g,escape(">"));
str = str.replace(/\&/g,escape("&"));
return str;
}
</script>
<div class="form-div" style="overflow:hidden;height:1%;">
<form action="index.php" method="get" id='form_id' style="float: left">
<input type='hidden' name='act' value='site.stat'>
开始日期
<input name="start_date" id='start_date_id' value="<%{$smarty.get.start_date}%>" style="width:80px;" />
结束日期
<input name="end_date" id='end_date_id' value="<%{$smarty.get.end_date}%>" style="width:80px;" />
<input type="submit" value=" 查询 " class="button" />
<a href="index.php?act=help.get&h=site_stat&width=450" class="jTip" name="我希望获得更多帮助"><img src='images/help.png'></a>
<input type='hidden' name='searchengine' id='searchengine_id' value='<%{$smarty.get.searchengine}%>' >
<input type='hidden' name='tab_box' id='tab_box_id' >
</form>
<span class="action-span"><a href="index.php?act=site.stat&report_file=1&start_date=<%{$smarty.get.start_date}%>&end_date=<%{$smarty.get.end_date}%>">流量分析报表
下载</a></span>
</div>
<div class="tab-div">
<!-- tab bar -->
<div id="tabbar-div">
<p>
<span id="general-tab" <%{if $smarty.get.tab_box!=''}%>class='tab-back'<%{else}%>class="tab-front"<%{/if}%> > 综合访问量</span><span
class="tab-back" id="area-tab">地区分布</span><span
class="tab-back" id="from-tab">来源网站</span><span
<%{if $smarty.get.tab_box=='keyword_report_box'}%>class='tab-front'<%{else}%>class="tab-back"<%{/if}%> id="keyword-tab"> 关键词来源</span>
</p>
</div>
<!-- tab body -->
<div id="tabbody-div">
<table width="90%" id="general-table" <%{if $smarty.get.tab_box!=''}%>style='display:none;'<%{/if}%> >
<tr><td align="center" id='day_report_box'>
</td>
<script>
var day_xml = '<graph chartRightMargin="60" yAxisName="访问数量" xAxisName="时间" rotateYAxisName="0">';
<%{foreach from=$out.day_report item=val key=k}%>
day_xml += '<set name="<%{$val.time|escape:html}%>" value="<%{$val.count|escape:html}%>" color="<%{$val.chart_color|escape:html}%>"/>';
<%{/foreach}%>
day_xml += '</graph>';
var chart = new FusionCharts("images/charts/line.swf", "ChartId", "700", "350", "0", "0");
chart.setDataXML(escape_c(day_xml));
chart.render("day_report_box");
</script>
</tr>
</table>
<table width="90%" id="area-table" style="display:none">
<tr><td align="center" id='area_report_box'>
</td>
<script>
var country_area_xml = '<chart palette="4" decimals="0" enableSmartLabels="1" enableRotation="0" bgColor="99CCFF,FFFFFF" bgAlpha="40,100" bgRatio="0,100" bgAngle="360" showBorder="1" startingAngle="70">';
<%{foreach item=v key=k from=$out.area_report}%>
country_area_xml += '<set label="<%{$v.area|escape:html}%>" value="<%{$v.count}%>" />';
<%{/foreach}%>
country_area_xml += '</chart>';
var chart = new FusionCharts("images/charts/pie3d.swf", "ChartId", "600", "350", "0", "0");
chart.setDataXML(escape_c(country_area_xml));
chart.render("area_report_box");
</script>
</tr>
</table>
<table width="90%" id="from-table" style="display:none">
<tr><td align="center" id='domin_report_box'>
</td>
<script>
var domin_xml = '<chart palette="4" decimals="0" enableSmartLabels="1" enableRotation="0" bgColor="99CCFF,FFFFFF" bgAlpha="40,100" bgRatio="0,100" bgAngle="360" showBorder="1" startingAngle="70">';
<%{foreach item=v key=k from=$out.domin_report}%>
domin_xml += '<set label="<%{$v.referer_domain|escape:html}%>" value="<%{$v.count}%>" />';
<%{/foreach}%>
domin_xml += '</chart>';
var chart = new FusionCharts("images/charts/pie3d.swf", "ChartId", "600", "350", "0", "0");
chart.setDataXML(escape_c(domin_xml));
chart.render("domin_report_box");
</script>
</tr>
</table>
<table width="90%" id="keyword-table" <%{if $smarty.get.tab_box=='keyword_report_box'}%>style='display:table;'<%{else}%> style="display:none" <%{/if}%>>
<tr><td align='center'>
选择来源 :
<input type='radio' name='searchengine' value='' <%{if $smarty.get.searchengine==''}%>checked=true<%{/if}%> onclick='$("#searchengine_id").val(this.value);$("#tab_box_id").val("keyword_report_box");$("#form_id")[0].submit();' >全部
<%{foreach from=$out.searchengine_type item=v key=k}%>
<input type='radio' value='<%{$v}%>' <%{if $smarty.get.searchengine==$v}%>checked=true<%{/if}%> name='searchengine' onclick='$("#searchengine_id").val(this.value);$("#tab_box_id").val("keyword_report_box");$("#form_id")[0].submit();' ><%{$v}%>
<%{/foreach}%>
</td></tr>
<tr><td align="center" id='keyword_report_box'>
</td>
<script>
var keyword_xml = '<graph><categories>';
<%{foreach item=v key=k from=$out.keyword_arr}%>
keyword_xml += '<category label="<%{$v|escape:html}%>" />';
<%{/foreach}%>
keyword_xml += '</categories>';
<%{foreach from=$out.keyword_report key=k item=v}%>
keyword_xml +='<dataset seriesName="<%{$k}%>" showValues="0">';
<%{foreach from=$v key=v_k item=v_v}%>
keyword_xml +='<set value="<%{$v_v.count}%>"/>';
<%{/foreach}%>
keyword_xml += '</dataset>';
<%{/foreach}%>
keyword_xml +='</graph>';
var chart = new FusionCharts("images/charts/StackedColumn3D.swf", "ChartId", "800", "350", "0", "0");
chart.setDataXML(escape_c(keyword_xml));
chart.render("keyword_report_box");
</script>
</tr>
</table>
</div>
</div>
<script>
$(document).ready(function(){
change_table(['area-tab','general-tab','from-tab','keyword-tab']);
});
$(function(){
$("#start_date_id").datepicker({ dateFormat: 'yy-mm-dd',dayNamesMin: ['一', '二', '三', '四', '五', '六', '日'] ,monthNames: ['一月','二月','三月','四月','五月','六月',' 七月','八月','九月','十月','十一月','十二月']});
$("#end_date_id").datepicker({ dateFormat: 'yy-mm-dd',dayNamesMin: ['一', '二', '三', '四', '五', '六', '日'] ,monthNames: ['一月','二月','三月','四月','五月','六月','七 月','八月','九月','十月','十一月','十二月']});
});
</script>
源码 隐藏一部分,要的我传给他 给我邮箱。。