HEX
Server: nginx/1.22.1
System: Linux VM-16-9-centos 3.10.0-1160.99.1.el7.x86_64 #1 SMP Wed Sep 13 14:19:20 UTC 2023 x86_64
User: www (1001)
PHP: 7.3.31
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/oa.sanjiangapp.com/lib/pager/pager.class.php
<?php
/**
 * ZenTaoPHP的分页类。
 * The pager class file of ZenTaoPHP framework.
 *
 * The author disclaims copyright to this source code.  In place of
 * a legal notice, here is a blessing:
 * 
 *  May you do good and not evil.
 *  May you find forgiveness for yourself and forgive others.
 *  May you share freely, never taking more than you give.
 */

helper::import(dirname(dirname(__FILE__)) . '/base/pager/pager.class.php');
/**
 * pager类.
 * Pager class.
 * 
 * @package framework
 */
class pager extends basePager
{
    /**
     * 设置模块名。
     * Set the $moduleName property.
     *
     * @access public
     * @return void
     */
    public function setModuleName()
    {
        /* 如果设置了请求的原始模块名,则把其赋值给$this->moduleName。*/
        /* If the original module name of the request is set, assign it to $this->moduleName. */
        if(isset($this->app->rawModule))
        {
            $this->moduleName = $this->app->rawModule;
        }
        else
        {
            $this->moduleName = $this->app->getModuleName();
        }
    }

    /**
     * 设置方法名。
     * Set the $methodName property.
     *
     * @access public
     * @return void
     */
    public function setMethodName()
    {
        /* 如果设置了请求的原始方法名,则把其赋值给$this->methodName。*/
        /* If the original method name of the request is set, assign it to $this->methodName. */
        if(isset($this->app->rawMethod))
        {
            $this->methodName = $this->app->rawMethod;
        }
        else
        {
            $this->methodName = $this->app->getMethodName();
        }
    }

    /**
     * 如果设置了请求的原始模块名和方法名,则去掉module参数,以便分页功能生成原始请求的URL而不是转换后的工作流URL。
     * If the original module name and method name of the request are set, the module parameter is removed so that
     * the paging function generates the URL of the original request instead of the converted workflow URL. 
     *
     * @access public
     * @return void
     */
    public function setParams()
    {
        if(isset($this->app->rawParams))
        {
            parent::setParams($this->app->rawParams);
        }
        else
        {
            parent::setParams();
        }

        /* If the original module name and method name of the request are set, the module parameter is removed. */
        if($this->app->isFlow) unset($this->params['module']);
    }

    /**
     * 创建limit语句。
     * Create the limit string.
     * 
     * @access public
     * @return string
     */
    public function limit()
    {
        $limit = '';
        if($this->pageTotal > 1) $limit = ' limit ' . ($this->pageID - 1) * $this->recPerPage . ", $this->recPerPage";
        return $limit;
    }

    /**
     * Print show more link
     *
     * @access public
     * @return void
     */
    public function showMore($class = 'pager-more')
    {
        $link = '';
        if($this->recTotal === 0) $link = "<a class='$class disabled'>{$this->lang->pager->noRecord}</a>";
        else if($this->pageTotal <= $this->pageID) $link = "<a class='$class disabled'><span>" . sprintf($this->lang->pager->showTotal, $this->recTotal, $this->recTotal) . " &nbsp; {$this->lang->pager->noMore}</span></a>";
        else
        {
            $this->setParams();
            $this->params['pageID'] = $this->pageID + 1;
            $url  = helper::createLink($this->moduleName, $this->methodName, $this->params);
            $link = "<a class='$class' data-more='$url'><span>" . sprintf($this->lang->pager->showTotal, $this->recPerPage * $this->pageID, $this->recTotal) . " &nbsp; <span class='text-link'>{$this->lang->pager->showMore}</span></span></a>";
        }
        echo $link;
    }

    /**
     * 创建链接。
     * Create link.
     * 
     * @param  string    $title 
     * @access public
     * @return string
     */
    public function createLink($title)
    {
        return html::a(helper::createLink($this->moduleName, $this->methodName, $this->params), $title);
    }
}