<?php defined('InShopNC') or exit('Access Invalid!'); ?>
<style type="text/css">
    .mb-item-edit-content {
        background: #EFFAFE url(<?php echo ADMIN_TEMPLATES_URL;?>/images/cms_edit_bg_line.png) repeat-y scroll 0 0;
    }
</style>
<?php if ($item_edit_flag) { ?>
    <table class="table tb-type2" id="prompt" style="background-color: #FFF; border-bottom: solid 1px #deeffb">
        <tbody>
        <tr class="space odd">
            <th colspan="12" class="nobg">
                <div class="title nomargin">
                    <h5><?php echo $lang['nc_prompts']; ?></h5>
                    <span class="arrow"></span>
                </div>
            </th>
        </tr>
        <tr>
            <td>
                <ul>
                    <li>从右侧筛选按钮，点击添加按钮完成添加</li>
                    <li>鼠标移动到已有商品上，会出现删除按钮可以对商品进行删除</li>
                    <li>操作完成后点击保存编辑按钮进行保存</li>
                </ul>
            </td>
        </tr>
        </tbody>
    </table>
<?php } ?>

<div class="index_block goods-list">
    <?php if ($item_edit_flag) { ?>
        <h3>商品版块</h3>
        <h5>属性: </h5><br/>
        <div nctype="item_property" class="content">
            <img nctype="bg_image" src="<?php echo getMbSpecialImageUrl($output['item_info']['bg_image']); ?>" alt="">
            <?php
            $ret = @getimagesize(getMbSpecialImageUrl($output['item_info']['bg_image']),$info);
            if(!$ret) {
                echo "无法获取当前图片尺寸。";
            } else {
                $width = doubleval($ret[0]);
                $height= doubleval($ret[1]);
                echo $width.'*'.$height;
            }
            ?>
            <br/>
            <a nctype="btn_edit_block_bg" class="btn-edit" data-desc="640*240" href="javascript:;">设置背景属性</a>
            <input nctype="bg_image_name" name="bg_image_name" type="hidden" value="<?php echo $output['item_info']['bg_image']; ?>">
            <input nctype="bg_type" name="bg_type" type="hidden" value="<?php echo $output['item_info']['bg_type']; ?>">
            <input nctype="bg_data" name="bg_data" type="hidden" value="<?php echo $output['item_info']['bg_data']; ?>">
            <input nctype="has_margin" name="has_margin" type="hidden" value="<?php echo $output['item_info']['has_margin']; ?>">
        </div>
    <?php } ?>
    <div class="title">
        <?php if ($item_edit_flag) { ?>
            <h5>标题：</h5>
            <input id="home1_title" type="text" class="txt w200" name="item_data[title]" value="<?php echo $item_data['title']; ?>">
        <?php } else { ?>
            <span><?php echo $item_data['title']; ?></span>
        <?php } ?>
    </div>
    <div nctype="item_content" class="content">
        <?php if ($item_edit_flag) { ?>
            <h5>内容：</h5>
        <?php } ?>
        <?php if (!empty($item_data['item']) && is_array($item_data['item'])) { ?>
            <?php foreach ($item_data['item'] as $item_key => $item_value) { ?>
                <div nctype="item_image" class="item"><img nctype="image" src="<?php echo getMbSpecialImageUrl($item_value['image']); ?>" alt="">
                    <?php if ($item_edit_flag) { ?>
                        <input nctype="image_name" name="item_data[item][<?php echo $item_key; ?>][image]" type="hidden" value="<?php echo $item_value['image']; ?>">
                        <input nctype="image_show_type" name="item_data[item][<?php echo $item_key; ?>][show_type]" type="hidden" value="<?php echo $item_value['show_type']; ?>">
                        <input nctype="image_show_data" name="item_data[item][<?php echo $item_key; ?>][show_data]" type="hidden" value="<?php echo $item_value['show_data']; ?>">
                        <input nctype="image_type" name="item_data[item][<?php echo $item_key; ?>][type]" type="hidden" value="<?php echo $item_value['type']; ?>">
                        <input nctype="image_data" name="item_data[item][<?php echo $item_key; ?>][data]" type="hidden" value="<?php echo $item_value['data']; ?>">
                        <input nctype="image_title" name="item_data[item][<?php echo $item_key; ?>][title]" type="hidden" value="<?php echo $item_value['title']; ?>">
                        <input nctype="image_reserved" name="item_data[item][<?php echo $item_key; ?>][reserved]" type="hidden" value="<?php echo $item_value['reserved']; ?>">

                        <div style="color: red;float: left;">
                            <?php
                                $ret = @getimagesize(getMbSpecialImageUrl($item_value['image']),$info);
                                if(!$ret) {
                                    echo "无法获取当前图片尺寸。";
                                } else {
                                    $width = doubleval($ret[0]);
                                    $height= doubleval($ret[1]);
                                    echo $width.'*'.$height;
                                }
                            ?>
                        </div>
                        <a nctype="btn_edit_item_image" href="javascript:;" class="a2"><i class="icon-edit"></i>编辑</a>
                        <a nctype="btn_del_item_image" href="javascript:;" class="a1"><i class="icon-trash"></i>删除</a>
                    <?php } ?>
                </div>
            <?php } ?>
        <?php } ?>
    </div>
    <?php if ($item_edit_flag) { ?>
        <a nctype="btn_add_item_image" class="btn-add" data-desc="320*85" href="javascript:;">添加新的块内容</a>
    <?php } ?>
</div>

<?php if ($item_edit_flag) { ?>
    <div class="search-goods">
        <h3>选择商品添加</h3>
        <h5>商品关键字：</h5>
        <label>
            类型：
            <select name="search_type" id="search_type">
                <option value="keyword">关键字</option>
            </select>
        </label>
        <input id="txt_goods_name" type="text" class="txt w200" name="">
        <a id="btn_mb_special_goods_search" class="btn-search" href="javascript:;" style="vertical-align: top; margin-left: 5px;" title="搜索"></a>
        <div id="mb_special_goods_list"></div>
    </div>
<?php } ?>