<?php
/*
 * ----------------------------------------------------
 * 程序名称: 牛叉广告管理系统(NiuXams)
 * 程序功能: 实现专业的广告投放、管理和统计等管理系统！
 * 程序开发: 牛叉软件(NiuXSoft.com)
 * 版权所有: [NiuXams] (C)2013-2099 NiuXSoft.com
 * 官方网站: www.niuxsoft.com  Email: niuxsoft@163.com
 * ----------------------------------------------------
 * 使用条款:
 * 1.为构建创新型经济社会,请尊重保护知识产权！
 * 2.该软件个人非商业用途免费使用.
 * 3.免费使用禁止修改版权信息和官方推广链接.
 * 4.禁止任何衍生版本.禁止任何非法修改源代码贩卖.
 * ----------------------------------------------------
 */

defined('NIUX_INCLUDED') or exit('Access Denied.');

require './mo_head.php';
?>
<style>
    .nav{
        margin: .4em 0;
        padding: .7em .3em .3em .7em;
    }
    .desc,.searchdiv{
        margin-top: .1em;
    }
    .search{
        width: 10em;
        padding: .48em .5em;
    }
    .fenye{
        padding-left: .4em;
    }
    .fenye a,.fenye span,.fenye input{
        margin-left: 1px;
        padding: .48em 2px;
    }
    .fenye a,.fenye span{
        display: inline-block;
        text-align: center;
        min-width: 1.3em;
    }
    .limit{
        width: 1.4em;
    }
    .page{
        width: 1.4em;
    }

    .list th{
        border-width:0px 1px 0px 0px;
        font-size:1.2em;
        line-height:2em;
    }

    .listtable{
        padding:.2em;
    }
    .listtable table th{
        border-width:0px 1px 0px 0px;
        font-size:1.2em;
        line-height:2em;
    }
    .listtable table td{
        border-width:0px 1px 1px 0px;
        font-size: 1em;
        line-height: 1.8em;
        overflow: hidden;
    }
    .ui-tooltip{
        min-width: 4.4em;
        max-width: 64em;
        word-break: break-all;
    }
    #tj{
        top: .5em;
        left: 360px;
    }
</style>
<script>
    $(function () {
        var order = '<?php echo $order ?>';
        $(".limit").blur(function () {
            $(this).parent().parent().submit();
        });
        $(".limit").keydown(function (event) {
            if (event.keyCode == 13) {
                $(this).blur();
            }
        });
        $(".page").blur(function () {
            $(this).parent().parent().submit();
        });
        $(".page").keydown(function (event) {
            if (event.keyCode == 13) {
                $(this).blur();
            }
        });
        $(".search").blur(function () {
            $(this).parent().parent().submit();
        });
        $(".search").keydown(function (event) {
            if (event.keyCode == 13) {
                $(this).blur();
            }
        });
        $(":radio").click(function () {
            $(this).parent().parent().submit();
        });
        $("input[name='order']").val(order);
        $("." + order).parent().addClass("ui-state-highlight");
        $(".listtable th>a").click(function () {
            $("input[name='order']").val(this.className);
            $("form:first").submit();
        });
        $(".listtable td").hover(function () {
            $(this).parent().children("td").toggleClass("ui-state-highlight").css({"border-top-width": 0, "border-left-width": 0});
        });

        $("#tj").click(function () {
            if (confirm("您确定清理日志、统计结果吗？")) {
                loading();
                $.ajax({
                    type: "POST",
                    url: 'tj_gg_id.php',
                    data: {menu: 'tj'},
                    success: function (msg) {
                        loaded();
                        if (msg == '1') {
                            dialog('已经是最新统计结果！', 1, location.href);
                        } else if (msg == '2') {
                            dialog('只有一天日志记录了！', 1, location.href);
                        } else if (msg == '3') {
                            dialog('清理日志、统计结果成功！', 1, location.href);
                        } else {
                            dialog(msg);
                        }
                    }
                });
            }
        });
    });
</script>
<div class="fullScreen">
    <div class="ptb hd rePos ui-widget-content">
        <button class="button absPos<?php echo $cfg_autoTj ? ' hide' : '' ?>" id="tj" title="清理日志、统计结果">手动统计</button>
        <h2><?php echo $title ?></h2>
    </div>

    <div class="plr ptb">
        <p>
            <strong>独立访客数：</strong><?php echo $num_UV ?>（人） 其中 
            <strong>新访客数：</strong><?php echo $num_NUV ?>（人）
            <strong>老访客数：</strong><?php echo $num_UV - $num_NUV ?>（人）。
            <strong>独立IP数：</strong><?php echo $num_IP ?>（个）
        </p>
    </div>
    <div class="plr ptb">
        <p>
            <strong>广告投放页面数：</strong><?php echo $num_P ?>（页）
            <strong>页面浏览量：</strong><?php echo $num_PV ?>（次）
            <strong>展示广告数：</strong><?php echo $num_SHOW ?>（次）。
            <strong>页面广告率：</strong><?php echo round($num_SHOW / ($num_PV ? $num_PV : 1), 2) ?>（广告/页）
            <strong>访客页面率：</strong><?php echo round($num_PV / ($num_UV ? $num_UV : 1), 2) ?>（页/人）
            <strong>访客广告率：</strong><?php echo round($num_SHOW / ($num_UV ? $num_UV : 1), 2) ?>（广告/人）
        </p>
    </div>
    <div class="plr ptb">
        <p>
            <strong>异常广告页面浏览量：</strong><?php echo $num_NPV ?>（页）
            <strong>异常广告数：</strong>>= <?php echo $num_NSHOW ?>（次）。
            <strong>异常广告率：</strong><?php echo round($num_NPV / ($num_PV ? $num_PV : 1), 4) * 100 ?>%
        </p>
    </div>
    <div class="plr ptb">
        <p>
            <strong>广告点击数：</strong><?php echo $num_CK ?>（次）。
            <strong>广告点击率：</strong><?php echo round($num_CK / ($num_SHOW ? $num_SHOW : 1), 4) * 100 ?>%（点击/广告）
            <strong>访客点击率：</strong><?php echo round($num_CK / ($num_UV ? $num_UV : 1), 4) * 100 ?>%（点击/访客）
        </p>
    </div>

    <div class="ui-widget-content">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">页面展现 TOP 10</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_ur_s ?>
                    </table>
                </td><td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">页面点击 TOP 10</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_ur_c ?>
                    </table>
                </td>
            </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">来源展现 TOP 10</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_fr_s ?>
                    </table>
                </td><td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">来源点击 TOP 10</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_fr_c ?>
                    </table>
                </td>
            </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">广告位展现 TOP 10</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_ggw_s ?>
                    </table>
                </td><td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">广告位点击 TOP 10</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_ggw_c ?>
                    </table>
                </td>
            </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">广告展现 TOP 10</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_gg_s ?>
                    </table>
                </td><td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">广告点击 TOP 10</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_gg_c ?>
                    </table>
                </td>
            </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">屏幕展现 TOP 10</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_sc_s ?>
                    </table>
                </td><td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">屏幕点击 TOP 10</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_sc_c ?>
                    </table>
                </td>
            </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">浏览器展现 TOP 10</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_b_s ?>
                    </table>
                </td><td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">浏览器点击 TOP 10</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_b_c ?>
                    </table>
                </td>
            </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">操作系统展现 TOP 10</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_os_s ?>
                    </table>
                </td><td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">操作系统点击 TOP 10</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_os_c ?>
                    </table>
                </td>
            </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">语言展现 TOP 5</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_la_s ?>
                    </table>
                </td><td width="50%" valign="top">
                    <table class="list" width="100%" border="0" cellspacing="1" cellpadding="1">
                        <tr>
                            <th class="ui-widget-header" scope="col">语言点击 TOP 5</th>
                            <th class="ui-widget-header" scope="col" style="width: 5em;">数量</th>
                        </tr>
                        <?php echo $top_la_c ?>
                    </table>
                </td>
            </tr>
        </table>
    </div>

    <div class="nav ui-widget-content ui-corner-all">
        <form method="get">
            <div class="fenye fl">历史统计<?php echo $fenye->result ?></div>
            <div class="desc buttonset fl mlr">
                <input type="radio" id="desc1" value="1" name="desc"<?php echo ($desc ? '' : ' checked="checked"') ?>><label for="desc1" title="升序排列">升</label>
                <input type="radio" id="desc2" value="0" name="desc"<?php echo ($desc ? ' checked="checked"' : '') ?>><label for="desc2" title="降序排列">降</label>
            </div>
            <div class="searchdiv fl">
                <input class="search ui-widget-content ui-corner-all" name="search" title="按回车或失去焦点" value="<?php echo htmlspecialchars($search) ?>" placeholder="输入搜索内容">
            </div>
            <div class="clear"><input name="ggid" type="hidden" value="<?php echo $ggid ?>"><input name="ggwid" type="hidden" value="<?php echo $ggwid ?>"><input class="order" name="order" type="hidden"></div>
        </form>
    </div>

    <div class="listtable ui-widget-content ui-corner-all">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ui-widget-content" style="border-width:0px 0px 0px 1px;">
            <tr>
                <th class="ui-widget-header" scope="col" style="width: 6em;"><a href="javascript:void(0)" class="date" title="按此排序">日期</a></th>
                <th class="ui-widget-header" scope="col" style="width: 7em;"><a href="javascript:void(0)" class="num01" title="按此排序">独立访客</a></th>
                <th class="ui-widget-header" scope="col" style="width: 6em;"><a href="javascript:void(0)" class="num03" title="按此排序">新访客</a></th>
                <th class="ui-widget-header" scope="col" style="width: 6em;">老访客</th>
                <th class="ui-widget-header" scope="col" style="width: 7em;"><a href="javascript:void(0)" class="num02" title="按此排序">独立IP</a></th>
                <th class="ui-widget-header" scope="col" style="width: 5em;"><a href="javascript:void(0)" class="num04" title="按此排序">广告页面</a></th>
                <th class="ui-widget-header" scope="col" style="width: 8em;"><a href="javascript:void(0)" class="num05" title="按此排序">页面浏览量</a></th>
                <th class="ui-widget-header" scope="col" style="width: 9em;"><a href="javascript:void(0)" class="num06" title="按此排序">展示广告</a></th>
                <th class="ui-widget-header" scope="col" style="width: 7em;"><a href="javascript:void(0)" class="num07" title="按此排序">异常页浏量</a></th>
                <th class="ui-widget-header" scope="col" style="width: 7em;"><a href="javascript:void(0)" class="num08" title="按此排序">异常广告</a></th>
                <th class="ui-widget-header" scope="col" style="width: 7em;"><a href="javascript:void(0)" class="num09" title="按此排序">点击广告</a></th>
                <th class="ui-widget-header" scope="col" style="width: 5.6em;">广告点击率</th>
                <th class="ui-widget-header" scope="col" style="width: 5.6em;">访客点击率</th>
            </tr>
            <?php echo $list ?>
        </table>
    </div>

</div>
<?php
require './mo_foot.php';

