<?php if (!defined('ROOT')){ echo 'Deny ...'; exit; } extract($data); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>MAIN</title>
        <link href="<?php echo $base_url; ?>static/css/style.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="<?php echo $base_url; ?>static/js/jquery.js"></script>
        <script type="text/javascript" src="<?php echo $base_url; ?>static/js/common.js"></script>
    </head>
    <body>
        <div class="place">
            <span>位置：</span>
            <ul class="placeul">
                <li><a href="<?php echo $base->get_url(array('c' => 'frame', 'm' => 'main')); ?>">首页</a></li>
                <li>用户组</li>
            </ul>
        </div>
        <div class="formbody">
            <div class="usual"> 
                <div class="tabson">
                    <div class="tools">
                        <ul class="toolbar">
                            <li class="click" onclick="location.href = '<?php echo $base->get_url(array('c' => 'group', 'm' => 'create')); ?>';"><span><img src="<?php echo $base_url; ?>static/images/t01.png"></span>新增用户组</li>
                        </ul>
                    </div>
                    <table class="tablelist">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>用户组名称</th>
                                <th>模块</th>
                                <th>权限</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            if ($result['lists']) {
                                foreach ($result['lists'] as $item){
                            ?>
                            <tr>
                                <td><?php echo $item['id'];?></td>
                                <td><?php echo $item['name'];?></td>
                                <td><?php echo $item['model_name'].'('.$item['model'].')';?></td>
                                <td>
                                    <?php if ($item['id'] == 1){ echo '--'; }else{?>
                                    <a href="<?php echo $base->get_url(array('c' => 'group', 'm' => 'perm', 'id' => $item['id']));?>" class="tablelink">[设置]</a>
                                    <?php }?>
                                </td>
                                <td>
                                    <?php if ($item['id'] == 1){ echo '--'; }else{?>
                                    <a href="<?php echo $base->get_url(array('c' => 'group', 'm' => 'edit', 'id' => $item['id']));?>" class="tablelink">[编辑]</a>
                                    <a href="javascript:;" onclick="_delete('<?php echo $item['name'];?>', '<?php echo $item['id'];?>');" class="tablelink">[删除]</a>
                                    <?php }?>
                                </td>
                            </tr>
                            <?php }}?>
                        </tbody>
                    </table>
                    <div style="margin-top: 12px;"><?php echo $result['pager']; ?><br style="clear: both;"/></div>
                </div>  
            </div> 
        </div>
        <?php echo form::alert('deleteGroup', $base_url);?> 
        <?php echo form::alert_confirm('deleteGroup', $base->get_url(array('c' => 'group', 'm' => 'delete')), form::create_nonce($admin['id'], 'deleteGroup'));?>
        <script>
            function _delete(name, id){
                $('.deleteGroup .tipright p').html('确认要删除 <font color="red">' + name + '</font> 吗?');
                $(".deleteGroup").fadeIn(200);
                $('#_id').val(id);
            }
            $(function(){
                $('.tablelist tbody tr:odd').addClass('odd');                
            });
        </script>
    </body>
</html>
