<?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' => 'channel', '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>
                            <tr>
                                <td>内置</td>
                                <td>系统设置</td>
                                <td><?php echo ROOT_ADMIN;?></td>
                                <td><font color="green">已启用</font></td>
                                <td>---</td>
                            </tr>
                            <?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['path'];?></td>
                                <td><?php echo $item['status'] ? '<font color="green">已激活</font>' : '<del>已禁用</del>'; ?></td>
                                <td width="200">
                                    <a href="" class="tablelink">[<?php echo $item['installed'] ? '卸载' : '安装';?>]</a>
                                    <a class="tablelink" href="<?php echo $base->get_url(array('c' => 'channel', 'm' => 'open', 'id' => $item['id']));?>">[<?php echo $item['status'] ? '禁用' : '启用';?>]</a>
                                    <a class="tablelink" href="<?php echo $base->get_url(array('c' => 'channel', 'm' => 'edit', 'id' => $item['id']));?>">[编辑]</a>
                                    <a class="tablelink" href="javascript:;" onclick="_delete('<?php echo $item['name'];?>', '<?php echo $item['id'];?>');">[删除]</a>
                                </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('deleteChannel', $base_url);?> 
        <?php echo form::alert_confirm('deleteChannel', $base->get_url(array('c' => 'channel', 'm' => 'delete')), form::create_nonce($admin['id'], 'deleteChannel'));?>
        
        <script>
            function _delete(name, id){
                $('.tip .tipright p').html('确认要删除 <font color="red">' + name + '</font> 吗?');
                $(".tip").fadeIn(200);
                $('#_id').val(id);
            }
            $(function(){
                $('.tablelist tbody tr:odd').addClass('odd');                
            });
        </script>
    </body>
</html>
