<?php
/**
 * Created by PhpStorm.
 * User: chenkuan
 * Date: 2017/12/14
 * Time: 下午4:59
 */
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") ?>
</head>
<body id="main">
<div class="main-nav"> <span class="fn-left">文章分类列表</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>
<form id="list-form" action="<?= Url::to(['/cp/article-category/list']) ?>" method="post">
    <div class="main-content">
        <div class="main-action-bar">
            <a class="btn" href="<?= Url::to(['/cp/article-category/add']) ?>"><i class="icon-plus"></i>添加</a>
            <div class="blank10"></div>
        </div>
        <div class="form-or-table">
            <table id="list-table" class="table table-striped table-bordered">
                <thead>
                <tr>
                    <th><a href="#">分类名称</a></th>
                    <th><a href="#">标记</a></th>
                    <th><a href="#">语言</a></th>
                    <th><a href="#">排序</a></th>
                    <th><a href="#">创建时间</a></th>
                    <th class="table-action">操作</th>
                </tr>
                </thead>
                <tbody>
                <?php foreach ($data as $articleCategory) { ?>
                    <tr>
                        <td>
                            <?php if($articleCategory['grade'] == 0) { ?>
                                <label style="margin-left: <?= $articleCategory['grade'] * 20 ?>px;">
                                    <?= $articleCategory['name'] ?>
                                    [<?= $articleCategory['article_count'] ?>]
                                </label>
                                <?php } else { ?>
                                    <label style="margin-left: <?= $articleCategory['grade'] * 20 ?>px;">
                                        <?= $articleCategory['name'] ?>
                                        [<?= $articleCategory['article_count'] ?>]
                                    </label>
                            <?php } ?>
                        </td>
                        <td><?= $articleCategory['sign'] ?></td>
                        <td><?php if ((int)$articleCategory['language'] === 0) {echo 'china';} else {echo 'english';} ?></td>
                        <td><?= $articleCategory['order_list'] ?></td>
                        <td>
                            <?= date('Y-m-d H:i:s', strtotime($articleCategory['create_date']))?>
                        </td>
                        <td>
                            <a href="<?= Url::to(['/cp/article-category/edit?id='.$articleCategory['id']]) ?>"><i class="icon-edit"></i> 编辑</a>
                            <a class="single-delete-button" url="<?= Url::to(['/cp/article-category/delete?id='.$articleCategory['id']]) ?>" href="#"><i class="icon-trash"></i> 删除</a>
                    </tr>
                <?php } ?>
                </tbody>
            </table>
        </div>
    </div>
</form>
<?php if(count($data) > 0) { ?>
    <div id="single-delete-modal" class="modal hide fade" style="display: none; ">
        <div class="modal-header">
            <a class="close" data-dismiss="modal">×</a>
            <h4>您确定要删除吗?</h4>
        </div>
        <div class="modal-body">
            <p>删除之后将不可恢复,请确定!</p>
        </div>
        <div class="modal-footer">
            <a href="#" id="single-delete-modal-sure-btn" class="btn btn-primary">确定</a>
            <a href="#" class="btn" data-dismiss="modal">返回</a>
        </div>
    </div>
<?php } ?>
</body>
</html>
