本文整理汇总了PHP中Paginator::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Paginator::instance方法的具体用法?PHP Paginator::instance怎么用?PHP Paginator::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paginator
的用法示例。
在下文中一共展示了Paginator::instance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: instance
/**
* Paginator::instance()
*
* @return
*/
public static function instance()
{
if (!self::$instance) {
self::$instance = new Paginator();
}
return self::$instance;
}
示例2: Filter
require_once BASEPATH . "lib/functions.php";
if (!defined("_PIPN")) {
require_once BASEPATH . "lib/class_filter.php";
$request = new Filter();
}
//Start Core Class
require_once BASEPATH . "lib/class_core.php";
Registry::set('Core', new Core());
$core = Registry::get("Core");
//Start Content Class
require_once BASEPATH . "lib/class_content.php";
Registry::set('Content', new Content());
$content = Registry::get("Content");
//Start Paginator Class
require_once BASEPATH . "lib/class_paginate.php";
$pager = Paginator::instance();
//Start User Class
require_once BASEPATH . "lib/class_user.php";
Registry::set('Users', new Users());
$user = Registry::get("Users");
//Start Membership Class
require_once BASEPATH . "lib/class_membership.php";
Registry::set('Membership', new Membership());
$member = Registry::get("Membership");
//Start Minify Class
require_once BASEPATH . "lib/class_minify.php";
Registry::set('Minify', new Minify());
if (isset($_SERVER['HTTPS'])) {
$protocol = $_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off" ? "https" : "http";
} else {
$protocol = 'http';
示例3: pageBar
/**
* Return page numbers bar
*
* @param object $paginator - current object of type Paginator
* @return string - HTML for page number bar
*/
public function pageBar($paginator = NULL)
{
if (!$paginator) {
$paginator = Paginator::instance();
}
return $paginator->pageBar($this);
}
示例4: getUsers
/**
* Users::getUsers()
*
* @param bool $from
* @return
*/
public function getUsers($from = false)
{
if (isset($_GET['letter']) and isset($_POST['fromdate_submit']) && $_POST['fromdate_submit'] != "" || isset($from) && $from != '') {
$enddate = date("Y-m-d");
$letter = sanitize($_GET['letter'], 2);
$fromdate = empty($from) ? sanitize($_POST['fromdate_submit']) : $from;
if (isset($_POST['enddate_submit']) && $_POST['enddate_submit'] != "") {
$enddate = sanitize($_POST['enddate_submit']);
}
$q = "SELECT COUNT(*) FROM " . self::uTable . " WHERE created BETWEEN '" . trim($fromdate) . "' AND '" . trim($enddate) . " 23:59:59' AND username REGEXP '^" . $letter . "'";
$and = "WHERE created BETWEEN '" . trim($fromdate) . "' AND '" . trim($enddate) . " 23:59:59' AND username REGEXP '^" . $letter . "'";
} elseif (isset($_POST['fromdate_submit']) && $_POST['fromdate_submit'] != "" || isset($from) && $from != '') {
$enddate = date("Y-m-d");
$fromdate = empty($from) ? sanitize($_POST['fromdate_submit']) : $from;
if (isset($_POST['enddate_submit']) && $_POST['enddate_submit'] != "") {
$enddate = sanitize($_POST['enddate_submit']);
}
$q = "SELECT COUNT(*) FROM " . self::uTable . " WHERE created BETWEEN '" . trim($fromdate) . "' AND '" . trim($enddate) . " 23:59:59'";
$and = "WHERE created BETWEEN '" . trim($fromdate) . "' AND '" . trim($enddate) . " 23:59:59'";
} elseif (isset($_GET['letter'])) {
$letter = sanitize($_GET['letter'], 2);
$and = "WHERE username REGEXP '^" . $letter . "'";
$q = "SELECT COUNT(*) FROM " . self::uTable . " WHERE username REGEXP '^" . $letter . "' LIMIT 1";
} else {
$q = "SELECT COUNT(*) FROM " . self::uTable;
$and = null;
}
$record = self::$db->query($q);
$total = self::$db->fetchrow($record);
$counter = $total[0];
if (isset($_GET['order'])) {
list($sort, $order) = explode("-", $_GET['order']);
$sort = sanitize($sort, 10);
$order = sanitize($order, 4);
if (in_array($sort, array("username", "fname", "email", "active"))) {
$ord = $order == 'DESC' ? " DESC" : " ASC";
$sorting = $sort . $ord;
} else {
$sorting = " created DESC";
}
} else {
$sorting = " created DESC";
}
$pager = Paginator::instance();
$pager->items_total = $counter;
$pager->default_ipp = Registry::get("Core")->perpage;
$pager->paginate();
$sql = "SELECT u.*, CONCAT(u.fname,' ',u.lname) as name, m.title, m.id as mid, c.name as cname" . "\n FROM " . self::uTable . " as u" . "\n LEFT JOIN " . Membership::mTable . " as m ON m.id = u.membership_id" . "\n LEFT JOIN " . Content::cTable . " as c ON c.abbr = u.country" . "\n {$and}" . "\n ORDER BY " . $sorting . $pager->limit;
$row = self::$db->fetch_all($sql);
return $row ? $row : 0;
}
示例5: getPayments
/**
* Membership::getPayments()
*
* @param bool $from
* @return
*/
public function getPayments($from = false)
{
if (isset($_GET['letter']) and isset($_POST['fromdate_submit']) && $_POST['fromdate_submit'] != "" || isset($from) && $from != '') {
$enddate = date("Y-m-d");
$letter = sanitize($_GET['letter'], 2);
$fromdate = empty($from) ? sanitize($_POST['fromdate_submit']) : $from;
if (isset($_POST['enddate_submit']) && $_POST['enddate_submit'] != "") {
$enddate = sanitize($_POST['enddate_submit']);
}
$q = "SELECT u.username, COUNT(*) FROM " . self::pTable . " as p LEFT JOIN " . Users::uTable . " as u ON u.id = p.user_id WHERE date BETWEEN '" . trim($fromdate) . "' AND '" . trim($enddate) . " 23:59:59' AND username REGEXP '^" . $letter . "'";
$and = "WHERE date BETWEEN '" . trim($fromdate) . "' AND '" . trim($enddate) . " 23:59:59' AND username REGEXP '^" . $letter . "'";
} elseif (isset($_POST['fromdate_submit']) && $_POST['fromdate_submit'] != "" || isset($from) && $from != '') {
$enddate = date("Y-m-d");
$fromdate = empty($from) ? sanitize($_POST['fromdate_submit']) : $from;
if (isset($_POST['enddate_submit']) && $_POST['enddate_submit'] != "") {
$enddate = sanitize($_POST['enddate_submit']);
}
$q = "SELECT COUNT(*) FROM " . self::pTable . " WHERE date BETWEEN '" . trim($fromdate) . "' AND '" . trim($enddate) . " 23:59:59'";
$and = "WHERE date BETWEEN '" . trim($fromdate) . "' AND '" . trim($enddate) . " 23:59:59'";
} elseif (isset($_GET['letter'])) {
$letter = sanitize($_GET['letter'], 2);
$and = "WHERE username REGEXP '^" . $letter . "'";
$q = "SELECT u.username, COUNT(*) FROM " . self::pTable . " as p LEFT JOIN " . Users::uTable . " as u ON u.id = p.user_id WHERE username REGEXP '^" . $letter . "' LIMIT 1";
} else {
$q = "SELECT COUNT(*) FROM " . self::pTable;
$and = null;
}
$record = self::$db->query($q);
$total = self::$db->fetchrow($record);
$counter = $total[0];
$pager = Paginator::instance();
$pager->items_total = $counter;
$pager->default_ipp = Registry::get("Core")->perpage;
$pager->paginate();
$sql = "SELECT p.*, p.id as id, p.date as created, u.username, m.title" . "\n FROM " . self::pTable . " as p" . "\n LEFT JOIN " . Users::uTable . " as u ON u.id = p.user_id" . "\n LEFT JOIN " . self::mTable . " as m ON m.id = p.membership_id" . "\n {$and}" . "\n ORDER BY created DESC" . $pager->limit;
$row = self::$db->fetch_all($sql);
return $row ? $row : 0;
}