Esempio n. 1
0
function format_Time($timeStr, $nType)
{
    $y = '';
    $m = '';
    $d = '';
    $h = '';
    $mi = '';
    $s = '';
    $format_Time = '';
    if (isDate($timeStr) == false) {
        return @$format_Time;
    }
    $y = cStr(year($timeStr));
    $m = cStr(month($timeStr));
    if (len($m) == 1) {
        $m = '0' . $m;
    }
    $d = cStr(day($timeStr));
    //在vb.net里要这样用  D = CStr(CDate(timeStr).Day)
    if (len($d) == 1) {
        $d = '0' . $d;
    }
    $h = cStr(hour($timeStr));
    if (len($h) == 1) {
        $h = '0' . $h;
    }
    $mi = cStr(minute($timeStr));
    if (len($mi) == 1) {
        $mi = '0' . $mi;
    }
    $s = cStr(second($timeStr));
    if (len($s) == 1) {
        $s = '0' . $s;
    }
    switch ($nType) {
        case 1:
            //yyyy-mm-dd hh:mm:ss
            $format_Time = $y . '-' . $m . '-' . $d . ' ' . $h . ':' . $mi . ':' . $s;
            break;
        case 2:
            //yyyy-mm-dd
            $format_Time = $y . '-' . $m . '-' . $d;
            break;
        case 3:
            //hh:mm:ss
            $format_Time = $h . ':' . $mi . ':' . $s;
            break;
        case 4:
            //yyyy年mm月dd日
            $format_Time = $y . '年' . $m . '月' . $d . '日';
            break;
        case 5:
            //yyyymmdd
            $format_Time = $y . $m . $d;
            break;
        case 6:
            //yyyymmddhhmmss
            $format_Time = $y . $m . $d . $h . $mi . $s;
            break;
        case 7:
            //mm-dd
            $format_Time = $m . '-' . $d;
            break;
        case 8:
            //yyyy年mm月dd日
            $format_Time = $y . '年' . $m . '月' . $d . '日' . ' ' . $h . ':' . $mi . ':' . $s;
            break;
        case 9:
            //yyyy年mm月dd日H时mi分S秒 早上
            $format_Time = $y . '年' . $m . '月' . $d . '日' . ' ' . $h . '时' . $mi . '分' . $s . '秒,' . getDayStatus($h, 1);
            break;
        case 10:
            //yyyy年mm月dd日H时
            $format_Time = $y . '年' . $m . '月' . $d . '日' . $h . '时';
            break;
        case 11:
            //yyyy年mm月dd日H时mi分S秒
            $format_Time = $y . '年' . $m . '月' . $d . '日' . ' ' . $h . '时' . $mi . '分' . $s . '秒';
            break;
        case 12:
            //yyyy年mm月dd日H时mi分
            $format_Time = $y . '年' . $m . '月' . $d . '日' . ' ' . $h . '时' . $mi . '分';
            break;
        case 13:
            //yyyy年mm月dd日H时mi分 早上
            $format_Time = $m . '月' . $d . '日' . ' ' . $h . ':' . $mi . ' ' . getDayStatus($h, 0);
            break;
        case 14:
            //yyyy年mm月dd日
            $format_Time = $y . '/' . $m . '/' . $d;
            break;
        case 15:
            //yyyy年mm月 第1周
            $format_Time = $y . '年' . $m . '月 第' . GetCountPage($d, 7) . '周';
    }
    return @$format_Time;
}
Esempio n. 2
0
function getThisIdPage($tableName, $id, $nPageSize)
{
    if ($id == '') {
        return 1;
    }
    $nCount = '';
    if ($nPageSize == '') {
        $nPageSize = 10;
    }
    $nCount = connexecute('select count(*) from ' . $tableName . ' where id<=' . $id)[0];
    $getThisIdPage = GetCountPage(cint($nCount), $nPageSize);
    //call echo("tableName=" & tableName & "id=" & id &",ncount=" & ncount,npagesize & "               ," & getThisIdPage)
    return @$getThisIdPage;
}
Esempio n. 3
0
function webPageControl($nRecrodCount, $nPageSize, $nPage, $configPageUrl, $action)
{
    $c = '';
    $nCountPage = '';
    $i = '';
    $nDisplay = '';
    $nDispalyOK = '';
    $nTemp = '';
    $cPages = '';
    $url = '';
    $selStr = '';
    $previousPage = '';
    $nextPage = '';
    //定义上一页,下一页
    $isDisplayTip = '';
    //是否显示提示翻页信息
    $isDisplayTip = true;
    $sPageStart = '';
    $sPageEnd = '';
    $sHomePage = '';
    $sHomePageFocus = '';
    $sUpPage = '';
    $sUpPageFocus = '';
    $sNextPage = '';
    $sNextPageFocus = '';
    $sForPage = '';
    $sForPageFocus = '';
    $sTailPage = '';
    $sTailPageFocus = '';
    if ($action != '') {
        $sPageStart = getStrCut($action, '[sPageStart]', '[/sPageStart]', 2);
        //页头部分
        $sPageEnd = getStrCut($action, '[sPageEnd]', '[/sPageEnd]', 2);
        //页尾部分
        $sHomePage = getStrCut($action, '[sHomePage]', '[/sHomePage]', 2);
        //首页
        $sHomePageFocus = getStrCut($action, '[sHomePageFocus]', '[/sHomePageFocus]', 2);
        //首页交点
        $sUpPage = getStrCut($action, '[sUpPage]', '[/sUpPage]', 2);
        //上一页
        $sUpPageFocus = getStrCut($action, '[sUpPageFocus]', '[/sUpPageFocus]', 2);
        //上一页交点
        $sNextPage = getStrCut($action, '[sNextPage]', '[/sNextPage]', 2);
        //下一页
        $sNextPageFocus = getStrCut($action, '[sNextPageFocus]', '[/sNextPageFocus]', 2);
        //下一页交点
        $sForPage = getStrCut($action, '[sForPage]', '[/sForPage]', 2);
        //循环页
        $sForPageFocus = getStrCut($action, '[sForPageFocus]', '[/sForPageFocus]', 2);
        //循环页交点
        $sTailPage = getStrCut($action, '[sTailPage]', '[/sTailPage]', 2);
        //最后页
        $sTailPageFocus = getStrCut($action, '[sTailPageFocus]', '[/sTailPageFocus]', 2);
        //最后页交点
    }
    //页头部分
    if ($sPageStart == '') {
        $sPageStart = '<ul class="pagecontrolwrap">' . vbCrlf() . '<li class="pageinfo">共[$nRecrodCount$]条 [$nPage$]/[$nCountPage$]页</li>' . vbCrlf();
    }
    //页尾部分
    if ($sPageEnd == '') {
        $sPageEnd = '</ul><div class="clear"></div>' . vbCrlf();
    }
    //首页
    if ($sHomePage == '') {
        $sHomePage = '<li><a href="[$url$]">首页</a></li>' . vbCrlf();
    }
    //首页交点
    if ($sHomePageFocus == '') {
        $sHomePageFocus = '<li class="pageli">首页</li>' . vbCrlf();
    }
    //上一页
    if ($sUpPage == '') {
        $sUpPage = '<li><a href="[$url$]">上一页</a></li>' . vbCrlf();
    }
    //上一页交点
    if ($sUpPageFocus == '') {
        $sUpPageFocus = '<li class="pageli">上一页</li>' . vbCrlf();
    }
    //下一页
    if ($sNextPage == '') {
        $sNextPage = '<li><a href="[$url$]">下一页</a></li>' . vbCrlf();
    }
    //下一页交点
    if ($sNextPageFocus == '') {
        $sNextPageFocus = '<li class="pageli">下一页</li>' . vbCrlf();
    }
    //循环页
    if ($sForPage == '') {
        $sForPage = '<li class="pagefocus">[$i$]</li>' . vbCrlf();
    }
    //循环页交点
    if ($sForPageFocus == '') {
        $sForPageFocus = '<li><a href="[$url$]">[$i$]</a></li>' . vbCrlf();
    }
    //最后页
    if ($sTailPage == '') {
        $sTailPage = '<li><a href="[$url$]">末页</a></li>' . vbCrlf();
    }
    //最后页交点
    if ($sTailPageFocus == '') {
        $sTailPageFocus = '<li class="pageli">末页</li>' . vbCrlf();
    }
    //测试时用到20160630
    if (1 == 2) {
        $c = '[sPageStart]' . vbCrlf() . $sPageStart . '[/sPageStart]' . vbCrlf() . vbCrlf();
        $c = $c . '[sHomePage]' . vbCrlf() . $sHomePage . '[/sHomePage]' . vbCrlf() . vbCrlf();
        $c = $c . '[sHomePageFocus]' . vbCrlf() . $sHomePageFocus . '[/sHomePageFocus]' . vbCrlf() . vbCrlf();
        $c = $c . '[sUpPage]' . vbCrlf() . $sUpPage . '[/sUpPage]' . vbCrlf() . vbCrlf();
        $c = $c . '[sUpPageFocus]' . vbCrlf() . $sUpPageFocus . vbCrlf() . '[/sUpPageFocus]' . vbCrlf();
        $c = $c . '[sForPage]' . vbCrlf() . $sForPage . '[/sForPage]' . vbCrlf() . vbCrlf();
        $c = $c . '[sForPageFocus]' . vbCrlf() . $sForPageFocus . '[/sForPageFocus]' . vbCrlf() . vbCrlf();
        $c = $c . '[sNextPage]' . vbCrlf() . $sNextPage . '[/sNextPage]' . vbCrlf() . vbCrlf();
        $c = $c . '[sNextPageFocus]' . vbCrlf() . $sNextPageFocus . '[/sNextPageFocus]' . vbCrlf() . vbCrlf();
        $c = $c . '[sTailPage]' . vbCrlf() . $sTailPage . '[/sTailPage]' . vbCrlf() . vbCrlf();
        $c = $c . '[sTailPageFocus]' . vbCrlf() . $sTailPageFocus . '[/sTailPageFocus]' . vbCrlf() . vbCrlf();
        $c = $c . '[sPageEnd]' . vbCrlf() . $sPageEnd . '[/sPageEnd]' . vbCrlf();
        rwEnd('[page]' . vbCrlf() . vbCrlf() . $c . vbCrlf() . '[/page]');
    }
    //配置页为空则
    if ($configPageUrl == '') {
        $configPageUrl = getUrlAddToParam(getUrl(), '?page=[id]', 'replace');
    }
    $nDisplay = 6;
    //显示数
    $nDispalyOK = 0;
    //显示成功数
    $nPage = handleNumberType($nPage);
    if ($nPage == '') {
        $nPage = 1;
    } else {
        $nPage = CInt($nPage);
    }
    //获得总页数
    $nCountPage = GetCountPage($nRecrodCount, $nPageSize);
    $previousPage = $nPage - 1;
    $nextPage = $nPage + 1;
    //处理上一页
    if ($previousPage <= 0) {
        $previousPage = '';
    }
    //处理下一页
    if ($nextPage > $nCountPage) {
        $nextPage = '';
    }
    //页开始
    $c = $sPageStart;
    //首页
    if ($nPage > 1) {
        $c = $c . replace($sHomePage, '[$url$]', replace($configPageUrl, '[id]', ''));
    } else {
        if ($isDisplayTip == true) {
            $c = $c . $sHomePageFocus;
        }
    }
    //上一页
    if ($previousPage != '') {
        $nTemp = $previousPage;
        if ($previousPage <= 1) {
            $nTemp = '';
        }
        $c = $c . replace($sUpPage, '[$url$]', replace($configPageUrl, '[id]', $nTemp));
    } else {
        if ($isDisplayTip == true) {
            $c = $c . $sUpPageFocus;
        }
    }
    $n = '';
    //call echo(npage,ncountpage)
    $n = $nPage - 3;
    //call echo("n",n)
    //翻页循环
    for ($i = $n; $i <= $nCountPage; $i++) {
        if ($i >= 1) {
            $nDispalyOK = $nDispalyOK + 1;
            //call echo(i,nPage)
            if ($i == $nPage) {
                $c = $c . replace($sForPage, '[$i$]', $i);
            } else {
                $nTemp = $i;
                if ($i <= 1) {
                    $nTemp = '';
                }
                $c = $c . replace(replace($sForPageFocus, '[$url$]', replace($configPageUrl, '[id]', $nTemp)), '[$i$]', $i);
            }
            if ($nDispalyOK > $nDisplay) {
                break;
            }
        }
    }
    //下一页
    if ($nCountPage > $nPage) {
        $c = $c . replace($sNextPage, '[$url$]', replace($configPageUrl, '[id]', $nextPage));
    } else {
        if ($isDisplayTip == true) {
            $c = $c . $sNextPageFocus;
        }
    }
    //末页
    if ($nCountPage > $nPage) {
        $c = $c . replace($sTailPage, '[$url$]', replace($configPageUrl, '[id]', $nCountPage));
    } else {
        if ($isDisplayTip == true) {
            $c = $c . $sTailPageFocus;
        }
    }
    $c = $c . $sPageEnd;
    $c = replaceValueParam($c, 'nRecrodCount', $nRecrodCount);
    $c = replaceValueParam($c, 'nPage', $nPage);
    if ($nCountPage == '0') {
        $nCountPage = 1;
    }
    $c = replaceValueParam($c, 'nCountPage', $nCountPage);
    if (inStr($c, '[$page-select-openlist$]') > 0) {
        for ($i = 1; $i <= $nCountPage; $i++) {
            $url = replace($configPageUrl, '[id]', $i);
            $selStr = '';
            if ($i == $nPage) {
                $selStr = ' selected';
            }
            $cPages = $cPages . '<option value="' . $url . '"' . $selStr . '>' . $i . '</option>' . vbCrlf();
        }
        $c = replace($c, '[$page-select-openlist$]', $cPages);
    }
    $webPageControl = $c . vbCrlf();
    return @$webPageControl;
}