<?php
/**
 * Created by PhpStorm.
 * User: chenkuan
 * Date: 2017/12/14
 * Time: 下午4:34
 */
use yii\helpers\Url;
?>
<!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>BIT System 后台管理平台</title>
    <?php include(Yii::getAlias("@cp_module_views")."/common/css_js_main.php") ?>
    <!--Kindeditor4 end -->
    <script charset="utf-8" src="<?= STATIC_URL ?>/static/cp/editor/kindeditor-min.js"></script>
    <script charset="utf-8" src="<?= STATIC_URL ?>/static/cp/editor/lang/zh_CN.js"></script>
    <script type="text/javascript">
        $().ready(function() {
            $('#imagePath').hide();
        });
    </script>

    <script>
        var editor;
        KindEditor.ready(function(K) {
            editor = K.create('textarea[name="content"]', {
                uploadJson: '<?= Url::to(['/cp/file/upload']); ?>',
                fileManagerJson: '<?= Url::to(['/cp/file/file-manager']) ?>',
                allowFileManager: true,
                height: '400px',
                items: ['source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/', 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image','multiimage', 'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'map', 'code', 'link', 'unlink']
            });

            K('#fileManagerButton').click(function() {
                editor.loadPlugin('filemanager',
                    function() {
                        editor.plugin.filemanagerDialog({
                            viewType: 'VIEW',
                            dirName: 'image',
                            clickFn: function(url, title) {
                                K('#imagePath').val(url);
                                editor.hideDialog();
                                $('#image').hide();
                                $('.file, .ui-input-file').hide();
                                $('#imagePath').show();
                            }
                        });
                    });
            });

        });
    </script>
    <!--Kindeditor4 end -->
</head>
<body id="main">
<div class="main-nav"> <span class="fn-left"><?php if($isAddAction) { ?>添加<?php } else { ?>编辑<?php } ?>首页优势广告</span> <span class="fn-right"><a href="javascript:javascript:history.go(-1);"><i class="icon-chevron-left"></i>返回</a></span>
    <div class="fn-clear"></div>
</div>
<div class="main-content">
    <div class="form-or-table">
        <form class="form-horizontal" id="validateForm" action="<?php if($isAddAction){echo Url::to(['/cp/advantage-rule/save']);} else {echo Url::to(['/cp/advantage-rule/update']);} ?>" method="post" enctype="multipart/form-data">
            <input type="hidden" name="<?= Yii::$app->request->csrfParam ?>" value="<?= Yii::$app->request->getCsrfToken() ?>" />
            <input type="hidden" name="id" value="<?= isset($advantageRule['id']) ? $advantageRule['id'] : '' ?>" />
            <fieldset>
                <div class="blank15"></div>
                <div class="control-group">
                    <label class="control-label"><span class="must-input">*</span>首页优势广告标题</label>
                    <div class="controls">
                        <input type="text" id="title" name="title" class="span5" value="<?= isset($advantageRule['title']) ? $advantageRule['title'] : '' ?>"/>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">首页优势广告内容</label>
                    <div class="controls">
                        <textarea id="content" name="content" rows="20"><?= isset($advantageRule['content']) ? $advantageRule['content'] : '' ?></textarea>
                    </div>
                </div>
                <div class="form-actions">
                    <button type="submit" class="btn btn-primary"><i class="icon-upload"></i> 提交</button>
                    <button type="reset" class="btn" onclick="javascript:history.go(-1);"><i class="icon-repeat"></i> 返回</button>
                </div>
            </fieldset>
        </form>
    </div>
</div>
</body>
</html>
