<?php
require_once 'conn.php';
checkLogin();
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>管理区域</title>
    <link rel="stylesheet" href="css/common.css" type="text/css" />
    <link rel="stylesheet" href="css/alert.css" type="text/css" />
    <script src="system/js/jquery-1.7.2.min.js"></script>
    <script src="js/js.js"></script>
    <style>
        body {
            margin: 0;
            padding: 20px;
            background: #fff;
        }
        #man_zone {
            margin-left: 0;
        }
    </style>
</head>
<body class="clear">
<?php // require_once 'panel.php'; ?>
<div id="man_zone">
    <div class="tagclound">
        <h1 class="tagCloundHead">自定义标签云</h1>
        <div class="tagArea">
        <?php
        $result = $conn->query("SELECT tagName, COUNT(DISTINCT c.cs_code) as count 
                               FROM tagtable 
                               LEFT JOIN customer c ON tagtable.customerId=c.id 
                               WHERE employeeId=" . $_SESSION['employee_id'] . " 
                               GROUP BY tagName");
        
        while ($row = $result->fetch_assoc()) {
        ?>
            <a href="tag.php?tagName=<?= urlencode($row['tagName']) ?>" style="font-size:16px;">
                <?= htmlspecialcharsFix($row['tagName']) ?>(<?= $row['count'] ?>)
            </a>
        <?php
        }
        ?>
            <a href="nullTag.php">无标签客户</a>
        </div>
    </div>
</div>
</body>
</html>