<?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" />
        <link href="<?php echo $base_url; ?>static/css/select.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/select-ui.min.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="itab" style="margin: 12px 0px;">
                    <ul>
                        <?php
                        $channels = service::channels();
                        ksort($channels);
                        foreach ($channels as $c) {
                        ?>
                        <li><a href="<?php echo $base->get_url(array('c' => 'param', 'cid' => $c['id'])); ?>" class="<?php if ($c['id'] == $cid) { ?>selected<?php } ?>"><?php echo $c['name']; ?></a></li> 
                        <?php } ?>
                    </ul>
                </div>
                <div class="tabson">
                    <div class="tools">
                        <ul class="toolbar">
                            <li class="click" onclick="location.href = '<?php echo $base->get_url(array('c' => 'param', 'm' => 'create', 'cid' => $cid)); ?>';"><span><img src="<?php echo $base_url; ?>static/images/t01.png"></span>新增参数</li>
                        </ul>
                    </div>
                    <table class="tablelist">
                        <thead>
                            <tr>
                                <th width="100">ID</th>
                                <th width="120">参数名称</th>
                                <th>参数值</th>
                                <th width="80">参数类型</th>
                                <th width="100">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            if ($result['lists']) {
                                foreach ($result['lists'] as $item){
                            ?>
                            <tr>
                                <td><?php echo $item['id'];?></td>
                                <td><?php echo $item['option_name'];?></td>
                                <td><?php echo $item['_type'] == 2 ? '&lt;html code/&gt;' : $item['option_value'];?></td>
                                <td>
                                    <?php echo $_types[$item['_type']]['name'];?>
                                </td>
                                <td>
                                    <a class="tablelink" href="<?php echo $base->get_url(array('c' => 'param', 'm' => 'edit', 'id' => $item['id'], 'cid' => $cid));?>">[编辑]</a>
                                    <a class="tablelink" href="javascript:;" onclick="_delete('<?php echo $item['option_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('deleteParam', $base_url);?> 
        <?php echo form::alert_confirm('deleteParam', $base->get_url(array('c' => 'param', 'm' => 'delete')), form::create_nonce($admin['id'], 'deleteParam'));?>
        <script>
            function _delete(name, id){
                $('.deleteParam .tipright p').html('确认要删除 <font color="red">' + name + '</font> 吗?');
                $(".deleteParam").fadeIn(200);
                $('#_id').val(id);
            }
            $(function(){
                $('.tablelist tbody tr:odd').addClass('odd');                
            });
        </script>
    </body>
</html>
