本文整理汇总了PHP中Paging::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Paging::fetch方法的具体用法?PHP Paging::fetch怎么用?PHP Paging::fetch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paging
的用法示例。
在下文中一共展示了Paging::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTrashCommentsWithPagingForOwner
function getTrashCommentsWithPagingForOwner($blogid, $category, $name, $ip, $search, $page, $count)
{
global $database;
$sql = "SELECT c.*, e.title, c2.name AS parentName \n\t\tFROM {$database['prefix']}Comments c \n\t\tLEFT JOIN {$database['prefix']}Entries e ON c.blogid = e.blogid AND c.entry = e.id AND e.draft = 0 \n\t\tLEFT JOIN {$database['prefix']}Comments c2 ON c.parent = c2.id AND c.blogid = c2.blogid \n\t\tWHERE c.blogid = {$blogid} AND c.isfiltered > 0";
$postfix = '';
if ($category > 0) {
$categories = POD::queryColumn("SELECT id FROM {$database['prefix']}Categories WHERE parent = {$category}");
array_push($categories, $category);
$sql .= ' AND e.category IN (' . implode(', ', $categories) . ')';
$postfix .= '&category=' . rawurlencode($category);
} else {
$sql .= ' AND (e.category >= 0 OR c.entry = 0)';
}
if (!empty($name)) {
$sql .= ' AND c.name = \'' . POD::escapeString($name) . '\'';
$postfix .= '&name=' . rawurlencode($name);
}
if (!empty($ip)) {
$sql .= ' AND c.ip = \'' . POD::escapeString($ip) . '\'';
$postfix .= '&ip=' . rawurlencode($ip);
}
if (!empty($search)) {
$search = escapeSearchString($search);
$sql .= " AND (c.name LIKE '%{$search}%' OR c.homepage LIKE '%{$search}%' OR c.comment LIKE '%{$search}%')";
$postfix .= '&search=' . rawurlencode($search);
}
$sql .= ' ORDER BY c.written DESC';
list($comments, $paging) = Paging::fetch($sql, $page, $count);
if (strlen($postfix) > 0) {
$paging['postfix'] .= $postfix . '&withSearch=on';
}
return array($comments, $paging);
}
示例2: getNoticesWithPaging
function getNoticesWithPaging($blogid, $search, $page, $count)
{
$context = Model_Context::getInstance();
$pool = getDefaultDBModelOnNotice($blogid);
if ($search !== true && $search) {
$search = escapeSearchString($search);
$pool->setQualifierSet(array("title", "like", $search, true), "OR", array("content", "like", $search, true));
}
return Paging::fetch($pool, $page, $count, $context->getProperty("uri.folder") . "/" . $context->getProperty("suri.value"));
}
示例3: getKeywordsWithPaging
function getKeywordsWithPaging($blogid, $search, $page, $count)
{
$ctx = Model_Context::getInstance();
$aux = '';
if ($search !== true && $search) {
$search = POD::escapeString($search);
$aux = "AND (title LIKE '%{$search}%' OR content LIKE '%{$search}%')";
}
$visibility = doesHaveOwnership() ? '' : 'AND visibility > 0';
$sql = "SELECT * \n\t\tFROM " . $ctx->getProperty('database.prefix') . "Entries \n\t\tWHERE blogid = {$blogid} \n\t\t\tAND draft = 0 {$visibility} \n\t\t\tAND category = -1 {$aux} \n\t\tORDER BY published DESC";
return Paging::fetch($sql, $page, $count, $ctx->getProperty('uri.folder') . "/" . $ctx->getProperty('suri.value'));
}
示例4: getLinksWithPagingForOwner
function getLinksWithPagingForOwner($blogid, $page, $count)
{
$pool = DBModel::getInstance();
$pool->init("Links");
$pool->setAlias("Links", "l");
$pool->setAlias("LinkCategories", "lc");
$pool->join("LinkCategories", "left", array(array("lc.blogid", "eq", "l.blogid"), array("lc.id", "eq", "l.category")));
$pool->setQualifier("l.blogid", "eq", $blogid);
$pool->setOrder("l.name", "desc");
$pool->setProjection("l.*", "lc.name AS categoryName");
return Paging::fetch($pool, $page, $count);
}
示例5: getKeywordsWithPaging
function getKeywordsWithPaging($blogid, $search, $page, $count)
{
global $database, $folderURL, $suri;
$aux = '';
if ($search !== true && $search) {
$search = POD::escapeString($search);
$aux = "AND (title LIKE '%{$search}%' OR content LIKE '%{$search}%')";
}
$visibility = doesHaveOwnership() ? '' : 'AND visibility > 0';
$sql = "SELECT * \n\t\tFROM {$database['prefix']}Entries \n\t\tWHERE blogid = {$blogid} \n\t\t\tAND draft = 0 {$visibility} \n\t\t\tAND category = -1 {$aux} \n\t\tORDER BY published DESC";
return Paging::fetch($sql, $page, $count, "{$folderURL}/{$suri['value']}");
}
示例6: getKeywordsWithPaging
function getKeywordsWithPaging($blogid, $search, $page, $count)
{
$context = Model_Context::getInstance();
$pool = DBModel::getInstance();
$pool->init("Entries");
$aux = '';
if ($search !== true && $search) {
$pool->setQualifierSet(array(array("title", "like", $search, true), "OR", array("content", "like", $search, true)));
}
if (!doesHaveOwnership()) {
$pool->setQualifier("visibility", ">", 0);
}
$pool->setQualifier("blogid", "eq", $blogid);
$pool->setQualifier("draft", "eq", 0);
$pool->setQualifier("category", "eq", -1);
$pool->setOrder("published", "desc");
return Paging::fetch($pool, $page, $count, $context->getProperty('uri.folder') . "/" . $context->getProperty('suri.value'));
}
示例7: getCommentsWithPaging
function getCommentsWithPaging($blogid, $page, $count, $url = null, $prefix = '?page=', $postfix = '', $countItem = null)
{
$context = Model_Context::getInstance();
$pool = DBModel::getInstance();
$comments = array();
$pool->reset("Comments");
$pool->setAlias("Comments", "r");
$pool->join("Entries", "inner", array(array("r.blogid", "eq", "e.blogid"), array("r.entry", "eq", "e.id"), array("e.draft", "eq", 0)));
$pool->setAlias("Entries", "e");
$pool->join("Categories", "left", array(array("e.blogid", "eq", "c.blogid"), array("e.category", "eq", "c.id")));
$pool->setAlias("Categories", "c");
$pool->setQualifier("r.blogid", "eq", $blogid);
$pool->setQualifier("e.draft", "eq", 0);
$pool->setQualifier("r.parent", "eq", null);
if (!doesHaveOwnership()) {
$pool->setQualifier("e.visibility", ">=", 2);
}
$pool->setQualifier("r.entry", ">", 0);
$pool->setQualifier("r.isfiltered", "eq", 0);
$pool->setOrder("r.written", "desc");
$pool = getPrivateCategoryExclusionQualifier($pool, $blogid);
list($comments, $paging) = Paging::fetch($pool, $page, $count, $url, $prefix, $countItem);
$paging['postfix'] = $postfix;
$comments = coverComments($comments);
return array($comments, $paging);
}
示例8: getRemoteResponseLogsWithPagingForOwner
function getRemoteResponseLogsWithPagingForOwner($blogid, $category, $site, $ip, $search, $page, $count, $type = null)
{
$pool = DBModel::getInstance();
$postfix = '&status=sent';
if ($category > 0) {
// Perform before RemoteResponse pool call to prevent DBModel spoofing.
$pool->init("Categories");
$pool->setQualifier("blogid", "eq", $blogid);
$pool->setQualifier("parent", "eq", $category);
$categories = $pool->getColumn("id");
array_push($categories, $category);
}
$pool->init("RemoteResponses");
$pool->setAlias("RemoteResponses", "t");
$pool->setAlias("Entries", "e");
$pool->setAlias("Categories", "c");
$pool->join("Entries", "left", array(array("t.blogid", "eq", "e.blogid"), array("t.entry", "eq", "e.id"), array("e.draft", "eq", 0)));
$pool->join("Categories", "left", array(array("t.blogid", "eq", "c.blogid"), array("e.category", "eq", "c.id")));
$pool->setQualifier("t.blogid", "eq", $blogid);
if ($category > 0) {
$pool->setQualifier("e.category", "hasoneof", $categories);
$postfix .= '&category=' . rawurlencode($category);
} else {
$pool->setQualifier("e.category", ">=", 0);
}
if (!is_null($type)) {
$pool->setQualifier("t.responsetype", "eq", $type, true);
}
if (!empty($search)) {
$search = escapeSearchString($search);
$pool->setQualifierSet(array("e.title", "like", $search, true), "OR", array("e.content", "like", $search, true));
$postfix .= '&search=' . rawurlencode($search);
}
$pool->setOrder("t.written", "desc");
$pool->setProjection("t.*", "e.title AS subject", "c.name AS categoryName");
list($responses, $paging) = Paging::fetch($pool, $page, $count);
if (strlen($postfix) > 0) {
$paging['postfix'] .= $postfix . '&withSearch=on';
}
return array($responses, $paging);
}
示例9: MT_Cover_getRecentEntries
function MT_Cover_getRecentEntries($parameters)
{
global $skin;
$context = Model_Context::getInstance();
$data = $context->getProperty('plugin.config');
importlib("model.blog.entry");
importlib("model.blog.tag");
$data['coverMode'] = !isset($data['coverMode']) ? 1 : $data['coverMode'];
if (Utils_Misc::isMetaBlog() != true) {
$data['coverMode'] = 1;
}
$data['screenshot'] = !isset($data['screenshot']) ? 1 : $data['screenshot'];
$data['screenshotSize'] = !isset($data['screenshotSize']) ? 90 : $data['screenshotSize'];
$data['paging'] = !isset($data['paging']) ? '2' : $data['paging'];
$data['contentLength'] = !isset($data['contentLength']) ? 250 : $data['contentLength'];
if (isset($parameters['preview'])) {
// preview mode
$retval = '표지에 최신 글 목록을 추가합니다.';
return htmlspecialchars($retval);
}
$entryLength = isset($parameters['entryLength']) ? $parameters['entryLength'] : 10;
if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail")) {
@mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail");
@chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail", 0777);
}
if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id'))) {
@mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id'));
@chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id'), 0777);
}
if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id') . "/coverPostThumbnail/")) {
@mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id') . "/coverPostThumbnail/");
@chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id') . "/coverPostThumbnail/", 0777);
}
$page = $data['paging'] == '1' && !empty($_GET['page']) ? intval($_GET['page']) : 1;
$cache = new PageCache();
$cache->name = 'MT_Cover_RecentPS';
if ($cache->load()) {
//If successful loads
$cache->contents = unserialize($cache->contents);
// If coverpage is single mode OR coverpage is coverblog and cache is not expired, return cache contents.
if (($data['coverMode'] == 1 || $data['coverMode'] == 2) && array_key_exists($page, $cache->contents) && Timestamp::getUNIXtime() - $cache->dbContents < 300) {
return $cache->contents[$page];
}
}
$pool = DBModel::getInstance();
$pool->reset("BlogSettings");
$pool->setQualifier("name", "eq", 'visibility', true);
$pool->setQualifier("value", "<", 2);
$privateBlogId = $pool->getCell("blogid");
$pool->reset("Entries");
$pool->join("Categories", "left", array(array("e.blogid", "eq", "c.blogid"), array("e.category", "eq", "c.id")));
$pool->setQualifier("e.draft", "eq", 0);
$pool->setQualifier("e.category", "beq", 0);
if ($privateBlogId) {
$pool->setQualifier("e.blogid", "hasnoneof", $privateBlogId);
}
if (Utils_Misc::isMetaBlog() == true && doesHaveOwnership() && $context->getProperty('service.type', 'single') != 'single') {
$pool->setQualifier("e.visibility", ">", 1);
$pool->setQualifierSet(array("c.visibility", ">", 1), "OR", array("e.category", "eq", 0));
} else {
if (!doesHaveOwnership()) {
$pool->setQualifier("e.visibility", ">", 1);
$pool->setQualifierSet(array("c.visibility", ">", 1), "OR", array("e.category", "eq", 0));
}
}
if ($data['coverMode'] != 2) {
$pool->setQualifier("e.blogid", "eq", $context->getProperty("blog.id"));
}
list($entries, $paging) = Paging::fetch($pool, $page, $entryLength);
$html = '';
foreach ((array) $entries as $entry) {
$tagLabelView = "";
$blogid = $data['coverMode'] == 2 ? $entry['blogid'] : $context->getProperty('blog.id');
$entryTags = getTags($blogid, $entry['id']);
$defaultURL = getDefaultURL($blogid);
if (sizeof($entryTags) > 0) {
$tags = array();
foreach ($entryTags as $entryTag) {
$tags[$entryTag['name']] = "<a href=\"{$defaultURL}/tag/" . (Setting::getBlogSettingGlobal('useSloganOnTag', true) ? URL::encode($entryTag['name'], $service['useEncodedURL']) : $entryTag['id']) . '">' . htmlspecialchars($entryTag['name']) . '</a>';
}
$tagLabelView = "<div class=\"post_tags\"><span>TAG : </span>" . implode(",\r\n", array_values($tags)) . "</div>";
}
if (empty($entry['category'])) {
$entry['label'] = _text('분류없음');
$entry['link'] = "{$defaultURL}/category";
} else {
$entry['link'] = "{$defaultURL}/category/" . (Setting::getBlogSettingGlobal('useSloganOnCategory', true) ? URL::encode($entry['label'], $service['useEncodedURL']) : $entry['category']);
}
$permalink = "{$defaultURL}/" . (Setting::getBlogSettingGlobal('useSloganOnPost', true) ? "entry/" . URL::encode($entry['slogan'], $context->getProperty('service.useEncodedURL', false)) : $entry['id']);
$html .= '<div class="coverpost">' . CRLF;
if ($imageName = MT_Cover_getAttachmentExtract($entry['content'])) {
if (($tempImageSrc = MT_Cover_getImageResizer($blogid, $imageName, $data['screenshotSize'])) && $data['screenshot'] == 1) {
$html .= '<div class="img_preview"><a href="' . $permalink . '"><img src="' . $tempImageSrc . '" alt="" /></a></div>' . CRLF;
}
}
$html .= ' <div class="content_box">';
$html .= ' <h2><a href="' . $permalink . '">' . htmlspecialchars($entry['title']) . '</a></h2>' . CRLF;
$html .= ' <div class="post_info">' . CRLF;
$html .= ' <span class="category"><a href="' . htmlspecialchars($entry['link']) . '">' . htmlspecialchars($entry['label']) . '</a></span>' . CRLF;
$html .= ' <span class="date">' . Timestamp::format5($entry['published']) . '</span>' . CRLF;
//.........这里部分代码省略.........
示例10: getSubscriptionLogsWithPage
function getSubscriptionLogsWithPage($page, $count)
{
global $database;
$blogid = getBlogId();
requireComponent("Textcube.Model.Paging");
return Paging::fetch("SELECT ip, host, useragent, referred FROM {$database['prefix']}SubscriptionLogs WHERE blogid = {$blogid} ORDER BY referred DESC", $page, $count);
}
示例11: getSubscriptionLogsWithPage
function getSubscriptionLogsWithPage($page, $count)
{
$blogid = getBlogId();
$pool = DBModel::getInstance();
$pool->reset("SubscriptionLogs");
$pool->setQualifier("blogid", "eq", $blogid);
$pool->setOrder("referred", "DESC");
$pool->setProjection('ip', 'host', 'useragent', 'referred');
return Paging::fetch($pool, $page, $count);
//return Paging::fetch("SELECT ip, host, useragent, referred FROM {$database['prefix']}SubscriptionLogs WHERE blogid = $blogid ORDER BY referred DESC", $page, $count);
}
示例12: getEntriesWithPagingForOwner
function getEntriesWithPagingForOwner($blogid, $category, $search, $page, $count, $visibility = null, $starred = null, $draft = null, $tag = null)
{
global $database, $suri;
$teamMemberFilter = "";
if (!Acl::check("group.editors", "entry.list")) {
$teamMemberFilter = " AND e.userid = " . getUserId();
}
$sqlTable = "SELECT e.*, c.label AS categoryLabel, d.id AS draft \n\t\tFROM {$database['prefix']}Entries e \n\t\tLEFT JOIN {$database['prefix']}Categories c ON e.category = c.id AND e.blogid = c.blogid \n\t\tLEFT JOIN {$database['prefix']}Entries d ON e.blogid = d.blogid AND e.id = d.id AND d.draft = 1 ";
$sql = " WHERE e.blogid = {$blogid} AND e.draft = 0" . $teamMemberFilter;
if ($category > 0) {
$categories = POD::queryColumn("SELECT id FROM {$database['prefix']}Categories WHERE blogid = {$blogid} AND parent = {$category}");
array_push($categories, $category);
$sql .= ' AND e.category IN (' . implode(', ', $categories) . ')';
} else {
if ($category == -3) {
$sql .= ' AND e.category = 0';
} else {
if ($category == -5) {
$sql .= ' AND e.category >= -2';
} else {
if ($category == 0) {
$sql .= ' AND e.category >= 0';
} else {
$sql .= ' AND e.category = ' . $category;
}
}
}
}
if (isset($visibility)) {
if (Validator::isInteger($visibility, 0, 3)) {
$sql .= ' AND e.visibility = ' . $visibility;
} else {
$sql .= ' AND e.visibility ' . $visibility;
}
}
if (isset($starred)) {
if (Validator::isInteger($starred, 0, 3)) {
$sql .= ' AND e.starred = ' . $starred;
} else {
$sql .= ' AND e.starred ' . $starred;
}
}
if (!empty($search)) {
$search = escapeSearchString($search);
$sql .= " AND (e.title LIKE '%{$search}%' OR e.content LIKE '%{$search}%')";
}
if (!empty($tag)) {
$sqlTable .= " LEFT JOIN {$database['prefix']}TagRelations t ON e.id = t.entry AND e.blogid = t.blogid ";
$sql .= ' AND t.tag = ' . $tag;
}
$sql .= ' ORDER BY e.published DESC';
return Paging::fetch($sqlTable . $sql, $page, $count);
}
示例13: fetchWithPaging
function fetchWithPaging($sql, $page, $count, $url = null, $prefix = '?page=', $countItem = null)
{
return Paging::fetch($sql, $page, $count, $url, $prefix, $countItem);
}
示例14: getEntriesWithPagingForOwner
function getEntriesWithPagingForOwner($blogid, $category, $search, $page, $count, $visibility = null, $starred = null, $draft = null, $tag = null)
{
$pool = DBModel::getInstance();
if ($category > 0) {
$categories = getChildCategoryId($blogid, $category);
array_push($categories, $category);
}
$pool->reset("Entries");
$pool->setAlias("Entries", "e");
$pool->extend("Categories", "LEFT", array(array('e.blogid', 'eq', 'c.blogid'), array('e.category', '=', 'c.id')));
$pool->setAlias("Categories", "c");
$pool->extend("Entries d", "LEFT", array(array('e.blogid', 'eq', 'd.blogid'), array('e.id', 'eq', 'd.id'), array("d.draft", "eq", 1)));
if (!Acl::check("group.editors", "entry.list")) {
$pool->setQualifier("e.userid", "eq", getUserId());
}
$pool->setQualifier("e.blogid", "eq", $blogid);
$pool->setQualifier("e.draft", "eq", 0);
$pool->setProjection("e.*", "c.label AS categoryLabel", "d.id AS draft");
$pool->setOrder("e.published", "DESC");
if (!Acl::check("group.editors", "entry.list")) {
$pool->setQualifier("e.userid", "eq", getUserId());
}
if ($category > 0) {
$pool->setQualifier("e.category", "hasoneof", $categories);
} else {
if ($category == -3) {
$pool->setQualifier("e.category", "eq", 0);
} else {
if ($category == -5) {
$pool->setQualifier("e.category", ">=", -3);
} else {
if ($category == 0) {
$pool->setQualifier("e.category", ">=", 0);
} else {
$pool->setQualifier("e.category", "eq", $category);
}
}
}
}
if (isset($visibility)) {
if (Validator::isInteger($visibility, 0, 3)) {
$pool->setQualifier("e.visibility", "eq", $visibility);
}
}
if (isset($starred)) {
if (Validator::isInteger($starred, 0, 3)) {
$pool->setQualifier("e.starred", "eq", $starred);
}
}
if (!empty($search)) {
$search = escapeSearchString($search);
$pool->setQualifierSet(array("e.title", "like", $search, true), "OR", array("e.content", "like", $search, true));
}
if (!empty($tag)) {
$pool->join("TagRelations", "left", array(array("e.id", "eq", "t.entry"), array("e.blogid", "eq", "t.blogid")));
$pool->setAlias("TagRelations", "t");
$pool->setQualifier("t.tag", "eq", $tag, true);
}
return Paging::fetch($pool, $page, $count);
}
示例15: getCommentsWithPaging
function getCommentsWithPaging($blogid, $page, $count, $url = null, $prefix = '?page=', $postfix = '', $countItem = null)
{
global $database;
$comments = array();
$sql = "SELECT r.*\n\t\tFROM\n\t\t\t{$database['prefix']}Comments r\n\t\t\tINNER JOIN {$database['prefix']}Entries e ON r.blogid = e.blogid AND r.entry = e.id AND e.draft = 0\n\t\t\tLEFT OUTER JOIN {$database['prefix']}Categories c ON e.blogid = c.blogid AND e.category = c.id\n\t\tWHERE\n\t\t\tr.blogid = {$blogid} AND e.draft = 0 AND r.parent IS NULL" . (doesHaveOwnership() ? "" : " AND e.visibility >= 2") . getPrivateCategoryExclusionQuery($blogid) . "\n\t\t\tAND r.entry > 0 AND r.isfiltered = 0\n\t\tORDER BY\n\t\t\tr.written DESC";
list($comments, $paging) = Paging::fetch($sql, $page, $count, $url, $prefix, $countItem);
$paging['postfix'] = $postfix;
$comments = coverComments($comments);
return array($comments, $paging);
}