123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- <?php
- require_once 'conn.php';
- checkLogin();
- $act = $_GET['act'] ?? '';
- if ($act == 'postchk') {
- $keys = urlencode($_GET['Keys'] ?? '');
- $page = $_GET['Page'] ?? '';
- $chkact = $_POST['chkact'] ?? '';
-
- $sqlStr = "";
- if (isset($_POST['chkbox'])) {
- foreach ($_POST['chkbox'] as $id) {
- $sqlStr .= ($sqlStr ? " OR id=" : " WHERE id=") . intval($id);
- }
- }
-
- switch ($chkact) {
- case "0":
- case "1":
- case "2":
- $sqlStr = "UPDATE customer SET cs_deal=" . intval($chkact) . $sqlStr;
- break;
- default:
- $chkact = str_replace('t', '', $chkact);
- $sqlStr = "UPDATE customer SET cs_belong=" . intval($chkact) . $sqlStr;
- }
-
- $conn->query($sqlStr);
- header("Location: ?Keys=" . $keys . "&Page=" . $page);
- exit;
- }
- $keys = $_GET['Keys'] ?? '';
- $keys = str_replace([' ', '+'], '', $keys);
- $keyscode = textEncode($keys);
- $page = $_GET['Page'] ?? '';
- $filterCountry = $_GET['fliterCountry'] ?? '';
- $filterQudao = $_GET['fliterQudao'] ?? '';
- $filterDeal = $_GET['fliterDeal'] ?? '';
- $filterBusiness = $_GET['fliterBusiness'] ?? '';
- $filterContact = $_GET['fliterContact'] ?? '';
- $filterStr = "";
- $urlStr = "";
- if (!empty($filterCountry)) {
- $filterStr .= " AND c.cs_country=" . intval($filterCountry);
- $urlStr .= "&fliterCountry=" . $filterCountry;
- }
- if (!empty($filterQudao)) {
- $filterStr .= " AND c.cs_from=" . intval($filterQudao);
- $urlStr .= "&fliterQudao=" . $filterQudao;
- }
- if (!empty($filterDeal)) {
- $filterStr .= " AND c.cs_deal=" . intval($filterDeal);
- $urlStr .= "&fliterDeal=" . $filterDeal;
- }
- if (!empty($filterBusiness)) {
- $filterStr .= " AND c.cs_type=" . intval($filterBusiness);
- $urlStr .= "&fliterBusiness=" . $filterBusiness;
- }
- if (!empty($filterContact)) {
- switch ($filterContact) {
- case "1":
- $filterStr .= " AND (cc.tel_1<>'' OR cc.tel_2<>'' OR cc.tel_3<>'')";
- break;
- case "2":
- $filterStr .= " AND (cc.wechat_1<>'' OR cc.wechat_2<>'' OR cc.wechat_3<>'')";
- break;
- case "3":
- $filterStr .= " AND (cc.whatsapp_1<>'' OR cc.whatsapp_2<>'' OR cc.whatsapp_3<>'')";
- break;
- case "4":
- $filterStr .= " AND (cc.email_1<>'' OR cc.email_2<>'' OR cc.email_3<>'')";
- break;
- case "5":
- $filterStr .= " AND (cc.linkedin_1<>'' OR cc.linkedin_2<>'' OR cc.linkedin_3<>'')";
- break;
- case "6":
- $filterStr .= " AND (cc.facebook_1<>'' OR cc.facebook_2<>'' OR cc.facebook_3<>'')";
- break;
- default:
- $filterStr .= " AND (cc.alibaba_1<>'' OR cc.alibaba_2<>'' OR cc.alibaba_3<>'')";
- }
- $urlStr .= "&fliterContact=" . $filterContact;
- }
- $keys = urlencode($keys);
- $hrefstr = "?keys=" . $keys;
- ?>
- <!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">
- <form id="form1" method="post" action="?act=postchk&Keys=<?= $keys ?>&Page=<?= $page ?>" onSubmit="return false">
- <div class="fastSelect clear">
- <H1>静默客户</H1>
- <div class="selectItem">
- <label>区域</label>
- <select name="fliterCountry" class="filterSearch">
- <option value="">请选择国家地区</option>
- <?php
- $result = $conn->query("SELECT id, countryName FROM country");
- while ($row = $result->fetch_assoc()) {
- $selected = ($filterCountry == $row['id']) ? ' selected="selected"' : '';
- echo "<option value=\"{$row['id']}\"{$selected}>{$row['countryName']}</option>";
- }
- ?>
- </select>
- </div>
- <div class="selectItem">
- <label>来源渠道</label>
- <select name="fliterQudao" class="filterSearch">
- <option value="">请选择渠道</option>
- <?php
- $result = $conn->query("SELECT id, ch_name FROM qudao");
- while ($row = $result->fetch_assoc()) {
- $selected = ($filterQudao == $row['id']) ? ' selected="selected"' : '';
- echo "<option value=\"{$row['id']}\"{$selected}>{$row['ch_name']}</option>";
- }
- ?>
- </select>
- </div>
- <div class="selectItem">
- <label>跟进阶段</label>
- <select name="fliterDeal" class="filterSearch">
- <option value="">请选择</option>
- <option value="0"<?= ($filterDeal == "0") ? ' selected="selected"' : '' ?>>无响应</option>
- <option value="1"<?= ($filterDeal == "1") ? ' selected="selected"' : '' ?>>背景调查</option>
- <option value="2"<?= ($filterDeal == "2") ? ' selected="selected"' : '' ?>>明确需求</option>
- <option value="3"<?= ($filterDeal == "3") ? ' selected="selected"' : '' ?>>已成交</option>
- </select>
- </div>
- <div class="selectItem">
- <label>客户类型</label>
- <select name="fliterBusiness" class="filterSearch">
- <option value="">请选择</option>
- <?php
- $result = $conn->query("SELECT id, businessType FROM clienttype");
- while ($row = $result->fetch_assoc()) {
- $selected = ($filterBusiness == $row['id']) ? ' selected="selected"' : '';
- echo "<option value=\"{$row['id']}\"{$selected}>{$row['businessType']}</option>";
- }
- ?>
- </select>
- </div>
- <div class="selectItem">
- <label>联系方式</label>
- <select name="fliterContact" class="filterSearch">
- <option value="">请选择</option>
- <option value="1"<?= ($filterContact == "1") ? ' selected="selected"' : '' ?>>电话</option>
- <option value="2"<?= ($filterContact == "2") ? ' selected="selected"' : '' ?>>微信</option>
- <option value="3"<?= ($filterContact == "3") ? ' selected="selected"' : '' ?>>WhatsApp</option>
- <option value="4"<?= ($filterContact == "4") ? ' selected="selected"' : '' ?>>邮箱</option>
- <option value="5"<?= ($filterContact == "5") ? ' selected="selected"' : '' ?>>领英</option>
- <option value="6"<?= ($filterContact == "6") ? ' selected="selected"' : '' ?>>Facebook</option>
- <option value="7"<?= ($filterContact == "7") ? ' selected="selected"' : '' ?>>阿里巴巴</option>
- </select>
- </div>
- <div class="inputSearch">
- <input type="text" id="keys" class="inputTxt"
- value="<?= empty($keyscode) ? '请输入搜索关键词' : htmlspecialcharsFix($keyscode) ?>"
- onFocus="if(this.value == '<?= empty($keyscode) ? '请输入搜索关键词' : htmlspecialcharsFix($keyscode) ?>'){this.value='';}"
- onBlur="if(this.value == ''){this.value='<?= empty($keyscode) ? '请输入搜索关键词' : htmlspecialcharsFix($keyscode) ?>';}"
- onKeyDown="if(event.keyCode==13){location.href='?Keys='+encodeURIComponent(document.getElementById('keys').value)}" />
- <input type="button" id="searchgo" class="searchgo" value="go"
- onClick="location.href='?Keys='+encodeURIComponent(document.getElementById('keys').value)" />
- </div>
- </div>
- <div width="100%" border="0" cellpadding="3" cellspacing="1" class="table2 em<?= $_SESSION['employee_id'] ?>">
- <div class="theader">
- <div class="col2">序号</div>
- <div class="col3">客户编号</div>
- <div class="col10">渠道来源</div>
- <div class="col10">区域</div>
- <div class="col10">客户类型</div>
- <div class="col10">跟进阶段</div>
- <div class="col6">录入时间</div>
- <div class="col6">操作</div>
- </div>
- <?php
- // 使用GROUP BY和GROUP_CONCAT来聚合多个联系人的信息
- $sqlStr = "SELECT c.id, MAX(c.cs_code) as cs_code, MAX(c.cs_from) as cs_from,
- MAX(c.cs_country) as cs_country, MAX(c.cs_type) as cs_type, MAX(c.cs_deal) as cs_deal,
- MAX(c.cs_addtime) as cs_addtime, MAX(c.colortag) as colortag,
- MAX(c.cs_note) as cs_note, MAX(c.cs_claimFrom) as cs_claimFrom,
- MAX(c.cs_belong) as cs_belong, MAX(c.cs_chain) as cs_chain,
- GROUP_CONCAT(cc.contact_name SEPARATOR '<br>') as contact_names,
- GROUP_CONCAT(DISTINCT NULLIF(cc.tel_1, '') SEPARATOR '<br>') as tel_1,
- GROUP_CONCAT(DISTINCT NULLIF(cc.tel_2, '') SEPARATOR '<br>') as tel_2,
- GROUP_CONCAT(DISTINCT NULLIF(cc.tel_3, '') SEPARATOR '<br>') as tel_3,
- GROUP_CONCAT(DISTINCT NULLIF(cc.tel_1_format, '') SEPARATOR '<br>') as tel_1_format,
- GROUP_CONCAT(DISTINCT NULLIF(cc.tel_2_format, '') SEPARATOR '<br>') as tel_2_format,
- GROUP_CONCAT(DISTINCT NULLIF(cc.tel_3_format, '') SEPARATOR '<br>') as tel_3_format,
- GROUP_CONCAT(DISTINCT NULLIF(cc.email_1, '') SEPARATOR '<br>') as email_1,
- GROUP_CONCAT(DISTINCT NULLIF(cc.email_2, '') SEPARATOR '<br>') as email_2,
- GROUP_CONCAT(DISTINCT NULLIF(cc.email_3, '') SEPARATOR '<br>') as email_3,
- GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_1, '') SEPARATOR '<br>') as whatsapp_1,
- GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_2, '') SEPARATOR '<br>') as whatsapp_2,
- GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_3, '') SEPARATOR '<br>') as whatsapp_3,
- GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_1_format, '') SEPARATOR '<br>') as whatsapp_1_format,
- GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_2_format, '') SEPARATOR '<br>') as whatsapp_2_format,
- GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_3_format, '') SEPARATOR '<br>') as whatsapp_3_format,
- GROUP_CONCAT(DISTINCT NULLIF(cc.wechat_1, '') SEPARATOR '<br>') as wechat_1,
- GROUP_CONCAT(DISTINCT NULLIF(cc.wechat_2, '') SEPARATOR '<br>') as wechat_2,
- GROUP_CONCAT(DISTINCT NULLIF(cc.wechat_3, '') SEPARATOR '<br>') as wechat_3,
- GROUP_CONCAT(DISTINCT NULLIF(cc.linkedin_1, '') SEPARATOR '<br>') as linkedin_1,
- GROUP_CONCAT(DISTINCT NULLIF(cc.linkedin_2, '') SEPARATOR '<br>') as linkedin_2,
- GROUP_CONCAT(DISTINCT NULLIF(cc.linkedin_3, '') SEPARATOR '<br>') as linkedin_3,
- GROUP_CONCAT(DISTINCT NULLIF(cc.facebook_1, '') SEPARATOR '<br>') as facebook_1,
- GROUP_CONCAT(DISTINCT NULLIF(cc.facebook_2, '') SEPARATOR '<br>') as facebook_2,
- GROUP_CONCAT(DISTINCT NULLIF(cc.facebook_3, '') SEPARATOR '<br>') as facebook_3,
- GROUP_CONCAT(DISTINCT NULLIF(cc.alibaba_1, '') SEPARATOR '<br>') as alibaba_1,
- GROUP_CONCAT(DISTINCT NULLIF(cc.alibaba_2, '') SEPARATOR '<br>') as alibaba_2,
- GROUP_CONCAT(DISTINCT NULLIF(cc.alibaba_3, '') SEPARATOR '<br>') as alibaba_3
- FROM customer c
- LEFT JOIN customer_contact cc ON c.id = cc.customer_id
- WHERE (c.is_silent=1 OR (c.cs_deal=0 AND c.cs_belong=" . intval($_SESSION['employee_id']) . "))";
- // 添加搜索条件
- if (!empty($keyscode)) {
- $sqlStr .= " AND (c.cs_code LIKE '%" . $conn->real_escape_string($keyscode) . "%'
- OR cc.contact_name LIKE '%" . $conn->real_escape_string($keyscode) . "%'
- OR cc.email_1 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
- OR cc.email_2 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
- OR cc.email_3 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
- OR cc.wechat_1 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
- OR cc.wechat_2 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
- OR cc.wechat_3 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
- OR cc.tel_1_format LIKE '%" . $conn->real_escape_string($keyscode) . "%'
- OR cc.tel_2_format LIKE '%" . $conn->real_escape_string($keyscode) . "%'
- OR cc.tel_3_format LIKE '%" . $conn->real_escape_string($keyscode) . "%'
- OR cc.whatsapp_1_format LIKE '%" . $conn->real_escape_string($keyscode) . "%'
- OR cc.whatsapp_2_format LIKE '%" . $conn->real_escape_string($keyscode) . "%'
- OR cc.whatsapp_3_format LIKE '%" . $conn->real_escape_string($keyscode) . "%')";
- }
- // 添加其他筛选条件
- $sqlStr .= $filterStr;
- // 分组和排序
- $sqlStr .= " GROUP BY c.id ORDER BY MAX(c.colortag) DESC, c.id DESC";
- $result = $conn->query($sqlStr);
- if ($result && $result->num_rows > 0) {
- $pageSize = 20;
- $page = empty($page) ? 1 : $page;
- $page = ($page === 'end') ? ceil($result->num_rows / $pageSize) : $page;
- $page = (!is_numeric($page) || $page < 1) ? 1 : (int)$page;
- $totalPages = ceil($result->num_rows / $pageSize);
- $page = ($page > $totalPages) ? $totalPages : $page;
- $offset = $pageSize * ($page - 1);
-
- $rows = [];
- while ($row = $result->fetch_assoc()) {
- $rows[] = $row;
- }
-
- $paginatedRows = array_slice($rows, $offset, $pageSize);
- $tempNum = $offset;
-
- foreach ($paginatedRows as $row) {
- $tempNum++;
- ?>
- <div class="tline color<?= $row['colortag'] ?>">
- <div class="col2"><?= $tempNum ?></div>
- <div class="col3 slidepanel">
- <?= htmlspecialcharsFix($row['cs_code']) ?>
- <?php if ($row['cs_claimFrom'] > 0): ?>
- <img src="../images/yijiao.png" class="handover" title="来自认领">
- <?php endif; ?>
- </div>
- <div class="col10">
- <?php
- $qudaoResult = $conn->query("SELECT ch_name FROM qudao WHERE id=" . intval($row['cs_from']));
- echo ($qudaoRow = $qudaoResult->fetch_assoc()) ? htmlspecialcharsFix($qudaoRow['ch_name']) : '未填写';
- ?>
- </div>
- <div class="col10">
- <?php
- $countryResult = $conn->query("SELECT countryName FROM country WHERE id=" . intval($row['cs_country']));
- echo ($countryRow = $countryResult->fetch_assoc()) ? htmlspecialcharsFix($countryRow['countryName']) : '未填写';
- ?>
- </div>
- <div class="col10">
- <?php
- $typeResult = $conn->query("SELECT businessType FROM clienttype WHERE id=" . intval($row['cs_type']));
- echo ($typeRow = $typeResult->fetch_assoc()) ? htmlspecialcharsFix($typeRow['businessType']) : '未填写';
- ?>
- </div>
- <div class="col10">
- <?php
- if ($row['cs_deal'] == 3) {
- echo "<span style='color:red;'>成交</span>";
- } elseif ($row['cs_deal'] == 2) {
- echo "明确需求";
- } elseif ($row['cs_deal'] == 1) {
- echo "背景调查";
- } else {
- echo "无响应";
- }
- ?>
- </div>
- <div class="col6"><?= $row['cs_addtime'] ?></div>
- <div class="col6">
- <?php if ($row['cs_belong'] == $_SESSION['employee_id']): ?>
- <a href="customerEdit.php?id=<?= $row['id'] ?>" class="ico_edit ico">修改</a>
- <?php endif; ?>
- </div>
- </div>
- <div class="notepanel clear">
- <div class="noteItem">联系方式</div>
- <div class="lx">
- <div class="tel">
- <?php
- $tels = [];
- if (!empty($row['tel_1'])) $tels[] = htmlspecialcharsFix($row['tel_1']);
- if (!empty($row['tel_2'])) $tels[] = htmlspecialcharsFix($row['tel_2']);
- if (!empty($row['tel_3'])) $tels[] = htmlspecialcharsFix($row['tel_3']);
- echo implode('<br>', $tels);
- ?>
- </div>
- <div class="mail">
- <?php
- $emails = [];
- if (!empty($row['email_1'])) $emails[] = '<a href="mailto:' . htmlspecialcharsFix($row['email_1']) . '">' . htmlspecialcharsFix($row['email_1']) . '</a>';
- if (!empty($row['email_2'])) $emails[] = '<a href="mailto:' . htmlspecialcharsFix($row['email_2']) . '">' . htmlspecialcharsFix($row['email_2']) . '</a>';
- if (!empty($row['email_3'])) $emails[] = '<a href="mailto:' . htmlspecialcharsFix($row['email_3']) . '">' . htmlspecialcharsFix($row['email_3']) . '</a>';
- echo implode('<br>', $emails);
- ?>
- </div>
- <div class="whatsapp">
- <?php
- $whatsapps = [];
- if (!empty($row['whatsapp_1'])) $whatsapps[] = htmlspecialcharsFix($row['whatsapp_1']);
- if (!empty($row['whatsapp_2'])) $whatsapps[] = htmlspecialcharsFix($row['whatsapp_2']);
- if (!empty($row['whatsapp_3'])) $whatsapps[] = htmlspecialcharsFix($row['whatsapp_3']);
- echo implode('<br>', $whatsapps);
- ?>
- </div>
- <div class="wechat">
- <?php
- $wechats = [];
- if (!empty($row['wechat_1'])) $wechats[] = htmlspecialcharsFix($row['wechat_1']);
- if (!empty($row['wechat_2'])) $wechats[] = htmlspecialcharsFix($row['wechat_2']);
- if (!empty($row['wechat_3'])) $wechats[] = htmlspecialcharsFix($row['wechat_3']);
- echo implode('<br>', $wechats);
- ?>
- </div>
- <div class="linkedin">
- <?php
- $linkedins = [];
- if (!empty($row['linkedin_1'])) $linkedins[] = htmlspecialcharsFix($row['linkedin_1']);
- if (!empty($row['linkedin_2'])) $linkedins[] = htmlspecialcharsFix($row['linkedin_2']);
- if (!empty($row['linkedin_3'])) $linkedins[] = htmlspecialcharsFix($row['linkedin_3']);
- echo implode('<br>', $linkedins);
- ?>
- </div>
- <div class="facebook">
- <?php
- $facebooks = [];
- if (!empty($row['facebook_1'])) $facebooks[] = htmlspecialcharsFix($row['facebook_1']);
- if (!empty($row['facebook_2'])) $facebooks[] = htmlspecialcharsFix($row['facebook_2']);
- if (!empty($row['facebook_3'])) $facebooks[] = htmlspecialcharsFix($row['facebook_3']);
- echo implode('<br>', $facebooks);
- ?>
- </div>
- <div class="alibaba">
- <?php
- $alibabas = [];
- if (!empty($row['alibaba_1'])) $alibabas[] = htmlspecialcharsFix($row['alibaba_1']);
- if (!empty($row['alibaba_2'])) $alibabas[] = htmlspecialcharsFix($row['alibaba_2']);
- if (!empty($row['alibaba_3'])) $alibabas[] = htmlspecialcharsFix($row['alibaba_3']);
- echo implode('<br>', $alibabas);
- ?>
- </div>
- </div>
- <div class="noteItem2">备注</div>
- <div class="notecontent">
- <div class="chain">
- 流转记录:
- <?php
- if (!empty($row['cs_chain'])) {
- $myArray = explode(',', $row['cs_chain']);
- $chainEmployees = [];
-
- foreach ($myArray as $employeeId) {
- $sqlStr = "SELECT em_user FROM employee WHERE id=" . intval($employeeId);
- $chainResult = $conn->query($sqlStr);
- if ($chainRow = $chainResult->fetch_assoc()) {
- $chainEmployees[] = htmlspecialcharsFix($chainRow['em_user']);
- }
- }
-
- echo implode(" > ", $chainEmployees);
- }
- ?>
- </div>
- <?= htmlUnCode($row['cs_note']) ?>
- </div>
- </div>
- <?php
- }
- } else {
- if (empty($keys)) {
- ?>
- <tr>
- <div align="center">当前暂无沉默客户</div>
- </tr>
- <?php
- } else {
- ?>
- <tr>
- <div align="center"><a href="?">Sorry,没有找到"<?= htmlspecialcharsFix($keyscode) ?>"相关的信息,点击返回</a></div>
- </tr>
- <?php
- }
- }
- ?>
- <div colspan="9">
- <div class="showpagebox">
- <?php
- if (isset($totalPages) && $totalPages > 1) {
- $pageName = "?Keys=" . $keys . $urlStr . "&";
- $pagelen = 3;
-
- if ($page > 1) {
- echo "<a href=\"{$pageName}Page=1\">首页</a>";
- echo "<a href=\"{$pageName}Page=" . ($page - 1) . "\">上一页</a>";
- }
-
- if ($pagelen * 2 + 1 >= $totalPages) {
- $startPage = 1;
- $endPage = $totalPages;
- } else {
- if ($page <= $pagelen + 1) {
- $startPage = 1;
- $endPage = $pagelen * 2 + 1;
- } else {
- $startPage = $page - $pagelen;
- $endPage = $page + $pagelen;
- }
- if ($page + $pagelen > $totalPages) {
- $startPage = $totalPages - $pagelen * 2;
- $endPage = $totalPages;
- }
- }
-
- for ($i = $startPage; $i <= $endPage; $i++) {
- if ($i == $page) {
- echo "<a class=\"current\">{$i}</a>";
- } else {
- echo "<a href=\"{$pageName}Page={$i}\">{$i}</a>";
- }
- }
-
- if ($page < $totalPages) {
- if ($totalPages - $page > $pagelen) {
- echo "<a href=\"{$pageName}Page={$totalPages}\">...{$totalPages}</a>";
- }
- echo "<a href=\"{$pageName}Page=" . ($page + 1) . "\">下一页</a>";
- echo "<a href=\"{$pageName}Page={$totalPages}\">尾页</a>";
- }
-
- echo "<input type=\"text\" id=\"Pagego\" value=\"{$page}\"
- onFocus=\"if(this.value == '{$page}'){this.value='';}\"
- onBlur=\"if(this.value == ''){this.value='{$page}';}\"
- onKeyUp=\"this.value=this.value.replace(/\D/g,'')\"
- onKeyDown=\"if(event.keyCode==13){location.href='{$pageName}Page='+document.getElementById('Pagego').value}\" />";
- }
- ?>
- </div>
- </div>
- </div>
- </form>
- </div>
- </body>
- </html>
|