offset + $GLOBALS['view']->offset_limit; if ($next_offset > $total_items) { $next_offset = $GLOBALS['view']->offset; } // Prev $prev_offset = $GLOBALS['view']->offset - $GLOBALS['view']->offset_limit; if ($prev_offset < 0) { $prev_offset = '0'; } /* Calculate how many pages total exist */ $pages = ceil($total_items/$GLOBALS['view']->offset_limit); /* Calculate current page and how many we have on each side */ $page_data = array('up'=>array(),'down'=>array()); // Can't Divide by 0 if ($GLOBALS['view']->offset > 0) { $current_page = floor($GLOBALS['view']->offset/$GLOBALS['view']->offset_limit); } else { $current_page = 0; } /* Create 10 pages in either direction */ // Down First $page = $current_page; $i = 0; /* While we have pages left */ while ($page > 0) { if ($i == '15') { $page_data['down'][1] = '...'; $page_data['down'][0] = '0'; break; } $i++; $page = $page - 1; $page_data['down'][$page] = $page * $GLOBALS['view']->offset_limit; } // while page > 0 // Up Next $page = $current_page+1; $i = 0; /* While we have pages left */ while ($page <= $pages) { if ($page * $GLOBALS['view']->offset_limit > $total_items) { break; } if ($i == '15') { $key = $pages - 1; if (!$page_data['up'][$key]) { $page_data['up'][$key] = '...'; } $page_data['up'][$pages] = ($pages-1) * $GLOBALS['view']->offset_limit; break; } $i++; $page = $page + 1; $page_data['up'][$page] = ($page-1) * $GLOBALS['view']->offset_limit; } // end while // Sort These Arrays of Hotness ksort($page_data['up']); ksort($page_data['down']); /* Take the script name and passed action and setup the next action */ preg_match("/.*\/(.+\.php)$/", $_SERVER['SCRIPT_NAME'], $matches); $action = "action=" . scrub_in($_REQUEST['action']); $script = conf('web_path') . "/" . $admin_menu . $matches[1]; // are there enough items to even need this view? if (($pages > 1) && ($_SESSION['view_script'])) { ?>
[] | $offset) { if ($offset === '...') { echo '... '; } else { // Hack Alert $page++; ?> $offset) { if ($offset === '...') { echo '... '; } else { ?> offset == $offset_pages) { ?> offset == $offset_pages) and else $offset_pages += $GLOBALS['view']->offset_limit; $counter++; } // end while ($counter <= $pages) */ ?> | [] |