<?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{
        padding:.2em;
    }
    .list table th{
        border-width:0px 1px 0px 0px;
        font-size:1.2em;
        line-height:2em;
    }
    .list table td{
        border-width:0px 1px 1px 0px;
        font-size: 1em;
        line-height: 1.8em;
        overflow: hidden;
    }

    .ui-tooltip {
        max-width: 1200px;
        word-break: break-all;
    }

    #del_admin_p{
        top: .5em;
        left: 280px;
    }
    #add_admin_p{
        top: .5em;
        left: 180px;
    }
</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();
        });
        $('.check_all').click(function () {
            if (this.checked) {
                $("input[type='checkbox']").each(function () {
                    this.checked = true;
                });
            } else {
                $("input[type='checkbox']").each(function () {
                    this.checked = false;
                });
            }
        });
        $("input[name='order']").val(order);
        $("." + order).parent().addClass("ui-state-highlight");
        $("th>a").click(function () {
            $("input[name='order']").val(this.className);
            $("form:first").submit();
        });
        $("td").hover(function () {
            $(this).parent().children("td").toggleClass("ui-state-highlight").css({"border-top-width": 0, "border-left-width": 0});
        });

        $("#del_admin_p").click(function () {
            var ids = "";
            $(".check_id:checked").each(function () {
                ids += this.value + " ";
            });
            if (ids) {
                if (confirm("删除即刻生效！无法恢复！您确定要删除所选吗？")) {
                    loading();
                    $.ajax({
                        type: "POST",
                        url: 'sz_admin_p_del.php',
                        data: {menu: 'del', ids: ids},
                        success: function (msg) {
                            loaded();
                            if (msg == '1') {
                                dialog('删除成功！', 1, location.href);
                            } else {
                                dialog(msg);
                            }
                        }
                    });
                }
            }
        });
    });
</script>
<div class="fullScreen">

    <div class="ptb hd rePos ui-widget-content">
        <a href="sz_admin_p_edit.php" class="button absPos" id="add_admin_p" title="增加权限组">新增权限组</a>
        <button class="button absPos" id="del_admin_p" title="删除选择的">删除选择</button>
        <h2 class=""><?php echo $title ?></h2>
    </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 class="order" name="order" type="hidden"></div>
        </form>
    </div>

    <div class="list 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: 1em;"><input type="checkbox" class="check_all" title="全选"></th>
                <th class="ui-widget-header" scope="col" style="width: 4em;"><a href="javascript:void(0)" class="id" title="按此排序">编号</a></th>
                <th class="ui-widget-header" scope="col" style="width: 10em;"><a href="javascript:void(0)" class="name" title="按此排序">名称</a></th>
                <th class="ui-widget-header" scope="col" style="width: 32em;"><a href="javascript:void(0)" class="content" title="按此排序">权限</a></th>
                <th class="ui-widget-header" scope="col" style="width: 4em;">修改</th>
            </tr>
            <?php echo $tmp ?>
        </table>
    </div>

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