本文整理汇总了PHP中pager::make_from_offset方法的典型用法代码示例。如果您正苦于以下问题:PHP pager::make_from_offset方法的具体用法?PHP pager::make_from_offset怎么用?PHP pager::make_from_offset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pager
的用法示例。
在下文中一共展示了pager::make_from_offset方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: outputUniidSelectionForm
function outputUniidSelectionForm($uniSql, $options)
{
global $tpl;
// settings
global $locline, $secondlocationname;
$urlparamString = prepareLocSelectionForm($options);
sql_temp_table_slave('uniids');
sql_slave('CREATE TEMPORARY TABLE &uniids ENGINE=MEMORY ' . $uniSql);
sql_slave('ALTER TABLE &uniids ADD PRIMARY KEY (`uni_id`)');
// locidsite
$locidsite = isset($_REQUEST['locidsite']) ? $_REQUEST['locidsite'] : 0;
if (!is_numeric($locidsite)) {
$locidsite = 0;
}
$count = sql_value_slave('SELECT COUNT(*) FROM &uniids', 0);
$tpl->assign('resultscount', $count);
// create page browser
$pager = new pager('search.php?' . $urlparamString . '&locidsite={offset}');
$pager->make_from_offset($locidsite, ceil($count / 20), 1);
// create locations list
$rs = sql_slave('SELECT `gns_locations`.`rc` `rc`, `gns_locations`.`cc1` `cc1`, `gns_locations`.`admtxt1` `admtxt1`, `gns_locations`.`admtxt2` `admtxt2`, `gns_locations`.`admtxt3` `admtxt3`, `gns_locations`.`admtxt4` `admtxt4`, `gns_locations`.`uni` `uni_id`, `gns_locations`.`lon` `lon`, `gns_locations`.`lat` `lat`, `gns_locations`.`full_name` `full_name`, &uniids.`olduni` `olduni` FROM `gns_locations`, &uniids WHERE &uniids.`uni_id`=`gns_locations`.`uni` ORDER BY `gns_locations`.`full_name` ASC LIMIT ' . $locidsite * 20 . ', 20');
$nr = $locidsite * 20 + 1;
$locations = '';
while ($r = sql_fetch_array($rs)) {
$thislocation = $locline;
$locString = '';
if ($r['admtxt1'] != '') {
if ($locString != '') {
$locString .= ' > ';
}
$locString .= htmlspecialchars($r['admtxt1'], ENT_COMPAT, 'UTF-8');
}
if ($r['admtxt2'] != '') {
if ($locString != '') {
$locString .= ' > ';
}
$locString .= htmlspecialchars($r['admtxt2'], ENT_COMPAT, 'UTF-8');
}
/* if ($r['admtxt3'] != '')
{
if ($locString != '') $locString .= ' > ';
$locString .= htmlspecialchars($r['admtxt3'], ENT_COMPAT, 'UTF-8');
}
*/
if ($r['admtxt4'] != '') {
if ($locString != '') {
$locString .= ' > ';
}
$locString .= htmlspecialchars($r['admtxt4'], ENT_COMPAT, 'UTF-8');
}
$thislocation = mb_ereg_replace('{parentlocations}', $locString, $thislocation);
// koordinaten ermitteln
$coordString = help_latToDegreeStr($r['lat']) . ' ' . help_lonToDegreeStr($r['lon']);
$thislocation = mb_ereg_replace('{coords}', htmlspecialchars($coordString, ENT_COMPAT, 'UTF-8'), $thislocation);
if ($r['olduni'] != 0) {
// der alte name wurde durch den native-wert ersetzt
$thissecloc = $secondlocationname;
$r['olduni'] = $r['olduni'] + 0;
$rsSecLoc = sql_slave('SELECT full_name FROM gns_locations WHERE uni=' . $r['olduni']);
$rSecLoc = sql_fetch_assoc($rsSecLoc);
$thissecloc = mb_ereg_replace('{secondlocationname}', htmlspecialchars($rSecLoc['full_name'], ENT_COMPAT, 'UTF-8'), $thissecloc);
sql_free_result($rsSecLoc);
$thislocation = mb_ereg_replace('{secondlocationname}', $thissecloc, $thislocation);
} else {
$thislocation = mb_ereg_replace('{secondlocationname}', '', $thislocation);
}
$thislocation = mb_ereg_replace('{locationname}', htmlspecialchars($r['full_name'], ENT_COMPAT, 'UTF-8'), $thislocation);
$thislocation = mb_ereg_replace('{urlparams}', $urlparamString . '&locid={locid}', $thislocation);
$thislocation = mb_ereg_replace('{locid}', urlencode($r['uni_id']), $thislocation);
$thislocation = mb_ereg_replace('{nr}', $nr, $thislocation);
$nr++;
$locations .= $thislocation . "\n";
}
sql_free_result($rs);
sql_drop_temp_table_slave('uniids');
$tpl->assign('locations', $locations);
$tpl->display();
exit;
}
示例2: cachelist
$tpl->menuitem = MNU_CACHES_LISTS;
if (isset($_REQUEST['watchlist'])) {
$list = new cachelist($_REQUEST['watchlist'] + 0);
if ($list->exist()) {
$list->watch(true);
}
} else {
if (isset($_REQUEST['dontwatchlist'])) {
$list = new cachelist($_REQUEST['dontwatchlist'] + 0);
if ($list->exist()) {
$list->watch(false);
}
}
}
$MAXITEMS = 30;
$startat = isset($_REQUEST['startat']) ? $_REQUEST['startat'] + 0 : 0;
$name_filter = isset($_REQUEST['name']) ? $_REQUEST['name'] : '';
$by_filter = isset($_REQUEST['by']) ? $_REQUEST['by'] : '';
$listcount = cachelist::getPublicListCount($name_filter, $by_filter);
$tpl->assign('name_filter', $name_filter);
$tpl->assign('by_filter', $by_filter);
$tpl->assign('cachelists', cachelist::getPublicLists($startat, $MAXITEMS, $name_filter, $by_filter));
$tpl->assign('show_status', false);
$tpl->assign('show_user', true);
// Do not show watchers because this would allow conclusions on what the list owner watches.
$tpl->assign('show_watchers', false);
$tpl->assign('show_edit', false);
$tpl->assign('togglewatch', 'cachelists.php');
$pager = new pager("cachelists.php?startat={offset}");
$pager->make_from_offset($startat, $listcount, $MAXITEMS);
$tpl->display();
示例3: max
sql_free_result($rsPic);
}
$pics--;
$rLog['first'] = false;
if (isset($caches_logged)) {
if (!isset($caches_logged[$rLog['cache_id']])) {
$caches_logged[$rLog['cache_id']] = true;
$rLog['first'] = true;
}
}
$newLogs[] = $rLog;
}
sql_free_result($rsLogs);
sql_drop_temp_table_slave('loglist');
if ($optimize_for_latest_logs) {
sql_drop_temp_table_slave('loglist0');
}
$tpl->assign('newLogs', $newLogs);
$tpl->assign('addpiclines', max($pics - 1, 0));
$tpl->assign('newLogsPerCountry', $newLogsPerCountry);
$tpl->assign('logselection', $logselection);
$tpl->assign('countryCode', $country);
$tpl->assign('countryName', sql_value("SELECT IFNULL(`sys_trans_text`.`text`, `countries`.`name`)\n FROM `countries`\n LEFT JOIN `sys_trans` ON `countries`.`trans_id`=`sys_trans`.`id`\n LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&2'\n WHERE `countries`.`short`='&1'", '', $country ? $country : $login->getUserCountry(), $opt['template']['locale']));
$tpl->assign('mainCountryName', sql_value("SELECT IFNULL(`sys_trans_text`.`text`, `countries`.`name`)\n FROM `countries`\n LEFT JOIN `sys_trans` ON `countries`.`trans_id`=`sys_trans`.`id`\n LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&2'\n WHERE `countries`.`short`='&1'", '', $opt['page']['main_country'], $opt['template']['locale']));
$tpl->assign('paging', $paging);
if ($paging) {
$pager = new pager($_SERVER["SCRIPT_NAME"] . '?startat={offset}' . $urlparams);
$pager->make_from_offset($startat, $total_logs, $logcount);
}
}
$tpl->display();
示例4: search_output
function search_output()
{
global $opt, $tpl, $login;
global $enable_mapdisplay;
global $called_by_search, $called_by_profile_query, $options, $lat_rad, $lon_rad, $distance_unit;
global $startat, $caches_per_page, $sql, $query_userid, $query_name;
$tpl->name = 'search.result.caches';
$tpl->menuitem = MNU_CACHES_SEARCH_RESULT;
$startat = floor($startat / $caches_per_page) * $caches_per_page;
$sql .= ' LIMIT ' . $startat . ', ' . $caches_per_page;
// run SQL query
sql_enable_foundrows();
$rs_caches = sql_slave("SELECT SQL_BUFFER_RESULT SQL_CALC_FOUND_ROWS " . $sql);
$resultcount = sql_value_slave('SELECT FOUND_ROWS()', 0);
sql_foundrows_done();
$tpl->assign('results_count', $resultcount);
$tpl->assign('startat', $startat);
$caches = array();
while ($rCache = sql_fetch_array($rs_caches)) {
// select best-fitting short desc for active language
$rCache['short_desc'] = sql_value_slave("\n SELECT `short_desc`\n FROM `cache_desc`\n WHERE `cache_id`='&1'\n AND `language`='&2'", false, $rCache['cache_id'], $opt['template']['locale']);
if ($rCache['short_desc'] === false) {
$rCache['short_desc'] = sql_value_slave("\n\t\t\t\tSELECT `short_desc`\n\t\t\t\tFROM `cache_desc`\n\t\t\t\tWHERE `cache_id`='&1'\n\t\t\t\tAND `language`='EN'", false, $rCache['cache_id']);
}
if ($rCache['short_desc'] === false) {
$rCache['short_desc'] = sql_value_slave("\n\t\t\t\tSELECT `short_desc`\n\t\t\t\tFROM `cache_desc`\n\t\t\t\tWHERE `cache_id`='&1'\n\t\t\t\tORDER BY `date_created`\n\t\t\t\tLIMIT 1", '', $rCache['cache_id']);
}
$rCache['desclangs'] = mb_split(',', $rCache['desc_languages']);
// decide if the cache is new
$dDiff = dateDiff('d', $rCache['date_created'], date('Y-m-d'));
$rCache['isnew'] = $dDiff <= NEWCACHES_DAYS;
// get last logs
if ($options['sort'] != 'bymylastlog' || !$login->logged_in()) {
$ownlogs = "";
} else {
$ownlogs = " AND `cache_logs`.`user_id`='" . sql_escape($login->userid) . "'";
}
$sql = "\n\t\t\t\tSELECT `cache_logs`.`id`, `cache_logs`.`type`, `cache_logs`.`date`, `log_types`.`icon_small`\n\t\t\t\tFROM `cache_logs`, `log_types`\n\t\t\t\tWHERE `cache_logs`.`cache_id`='" . sql_escape($rCache['cache_id']) . "'\n\t\t\t\t AND `log_types`.`id`=`cache_logs`.`type`" . $ownlogs . "\n\t\t\t\tORDER BY `cache_logs`.`order_date` DESC, `cache_logs`.`date_created` DESC, `cache_logs`.`id` DESC\n\t\t\t\tLIMIT 6";
$rs = sql_slave($sql);
$rCache['logs'] = sql_fetch_assoc_table($rs);
$rCache['firstlog'] = array_shift($rCache['logs']);
// get direction from search coordinate
if ($rCache['distance'] > 0) {
$direction = geomath::calcBearing($lat_rad / 3.14159 * 180, $lon_rad / 3.14159 * 180, $rCache['latitude'], $rCache['longitude']);
$rCache['direction_deg'] = round($direction / 22.5) * 22.5;
$rCache['direction_txt'] = geomath::Bearing2Text($direction, 0, $opt['template']['locale']);
} else {
$rCache['direction_deg'] = false;
}
// other data
$rCache['icon'] = getCacheIcon($login->userid, $rCache['cache_id'], $rCache['status'], $rCache['user_id'], $rCache['icon_large']);
$rCache['redname'] = $rCache['status'] == 5 || $rCache['status'] == 7;
$caches[] = $rCache;
}
mysql_free_result($rs_caches);
$tpl->assign('caches', $caches);
$page = 'search.php?queryid=' . $options['queryid'] . '&startat={offset}&sortby=' . $options['sort'];
if (isset($options['sortorder']) && $options['sortorder']) {
$page .= "&sortorder=" . $options['sortorder'];
}
if (isset($options['creationdate']) && $options['creationdate']) {
$page .= "&creationdate=" . $options['creationdate'];
}
$pager = new pager($page, 2, 9);
$pager->make_from_offset($startat, $resultcount, $caches_per_page);
// downloads
$tpl->assign('queryid', $options['queryid']);
if (isset($query_userid)) {
$tpl->assign('query_name', $query_name);
}
$tpl->assign('startatp1', min($resultcount, $startat + 1));
if ($resultcount - $startat < 500) {
$tpl->assign('endat', $startat + $resultcount - $startat);
} else {
$tpl->assign('endat', $startat + 500);
}
// kompatibilität!
if ($distance_unit == 'sm') {
$tpl->assign('distanceunit', 'mi');
} elseif ($distance_unit == 'nm') {
$tpl->assign('distanceunit', 'sm');
} else {
$tpl->assign('distanceunit', $distance_unit);
}
$tpl->assign('displayownlogs', $options['sort'] == 'bymylastlog');
$tpl->assign('search_headline_caches', $called_by_search);
$tpl->assign('enable_mapdisplay', $enable_mapdisplay);
// sort results by
$tpl->assign('sortby', $options['sort']);
if (isset($options['sortorder'])) {
$tpl->assign('sortorder', $options['sortorder']);
}
if ($options['sort'] == 'bycreated' || isset($options['creationdate'])) {
$tpl->assign('creationdate', true);
}
// cachelist data
if (isset($options['cachelist'])) {
$tpl->assign('cachelist', $options['cachelist']);
$tpl->assign('cachelist_pw', $options['cachelist_pw']);
} else {
//.........这里部分代码省略.........
示例5: set_paged_pics
function set_paged_pics($purpose, $userid, $cacheid, $url)
{
global $tpl;
$startat = isset($_REQUEST['startat']) ? $_REQUEST['startat'] + 0 : 0;
$pictures = get_logpics($purpose, $userid, $cacheid);
$tpl->assign('pictures', array_slice($pictures, $startat, MAX_PICTURES_PER_GALLERY_PAGE));
$pager = new pager($url . "&startat={offset}");
$pager->make_from_offset($startat, count($pictures), MAX_PICTURES_PER_GALLERY_PAGE);
}
示例6: curdate
$cachetype_condition = $cachetype ? " AND `caches`.`type` = " . sql_escape($cachetype) : "";
if ($bEvents) {
$cachetype_condition .= " AND `date_hidden` >= curdate()";
}
$date_field = $bEvents ? 'date_hidden' : 'date_created';
$sort_order = $bEvents ? 'ASC' : 'DESC';
$newCaches = array();
$rsNewCaches = sql_slave("SELECT `caches`.`cache_id` `cacheid`, `caches`.`wp_oc` `wpoc`,\n\t\t\t\t\t `caches`.`name` `cachename`, `caches`.`type`, `caches`.`country` `country`,\n\t\t\t\t\t `caches`.`{$date_field}` `date_created`,\n\t\t\t\t\t IFNULL(`sys_trans_text`.`text`,`countries`.`en`) AS `country_name`,\n\t\t\t\t\t `user`.`user_id` `userid`, `user`.`username` `username`,\n\t\t\t\t\t `ca`.`attrib_id` IS NOT NULL AS `oconly`\n\t\t\t\t\t FROM `caches`\n\t\t\tINNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id`\n\t\t\t LEFT JOIN `countries` ON `countries`.`short` = `caches`.`country`\n\t\t\t LEFT JOIN `sys_trans_text` ON `sys_trans_text`.`trans_id` = `countries`.`trans_id`\n\t\t\t AND `sys_trans_text`.`lang` = '" . sql_escape($opt['template']['locale']) . "'\n\t\t\t LEFT JOIN `caches_attributes` `ca` ON `ca`.`cache_id`=`caches`.`cache_id` AND `ca`.`attrib_id`=6\n\t\t\t WHERE `caches`.`status` = 1" . ($country ? " AND `caches`.`country`='" . sql_escape($country) . "'" : "") . $cachetype_condition . "\n\t\t\t ORDER BY `caches`.`{$date_field}` {$sort_order}\n\t\t\t\t LIMIT " . ($startat + 0) . ', ' . ($perpage + 0));
// see also write_newcaches_urls() in sitemap.class.php
while ($rNewCache = sql_fetch_assoc($rsNewCaches)) {
$newCaches[] = $rNewCache;
}
sql_free_result($rsNewCaches);
$tpl->assign('newCaches', $newCaches);
$startat = isset($_REQUEST['startat']) ? $_REQUEST['startat'] + 0 : 0;
$cacheype_par = $cachetype ? "&cachetype={$cachetype}" : "";
if ($country == '') {
$count = sql_value_slave("SELECT COUNT(*) FROM `caches` WHERE `caches`.`status`=1" . $cachetype_condition, 0);
$pager = new pager("newcaches.php?startat={offset}" . $cacheype_par);
} else {
$count = sql_value_slave("SELECT COUNT(*) FROM `caches` WHERE `caches`.`status`=1 AND `caches`.`country`='&1'" . $cachetype_condition, 0, $country);
$pager = new pager("newcaches.php?country=" . $country . "&startat={offset}" . $cacheype_par);
}
$pager->make_from_offset($startat, $count, 100);
$tpl->assign('defaultcountry', $opt['template']['default']['country']);
$tpl->assign('countryCode', $country);
$tpl->assign('countryName', sql_value("SELECT IFNULL(`sys_trans_text`.`text`, `countries`.`name`) \n\t FROM `countries`\n\t LEFT JOIN `sys_trans` ON `countries`.`trans_id`=`sys_trans`.`id`\n\t LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&2'\n\t WHERE `countries`.`short`='&1'", '', $country ? $country : $login->getUserCountry(), $opt['template']['locale']));
$tpl->assign('mainCountryName', sql_value("SELECT IFNULL(`sys_trans_text`.`text`, `countries`.`name`) \n\t FROM `countries`\n\t LEFT JOIN `sys_trans` ON `countries`.`trans_id`=`sys_trans`.`id`\n\t LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&2'\n\t WHERE `countries`.`short`='&1'", '', $opt['page']['main_country'], $opt['template']['locale']));
$tpl->assign('events', $bEvents);
}
$tpl->display();