<?php
/**
 * page_view.php - View file for the mapping search result list using the display_list data object.
 * 					 FILE IS OBSOLETE
 *
 * @author $Author: dtong $
 * @version $Id: page_view.php,v 1.8 2011/04/06 11:47:51 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/
 /*
$uri  = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
echo $uri;
*/
return;

$skip_key = $this->config->item('cms_admin_skip');
if (isset($deep))
	$deep = $deep * 2;
else
	$deep = 8;

if (!isset($add_js))
	$add_js='';
if (!isset($page_number))
	$page_number = 1;

	$update_url   = base_url().'search/sort/page/sort/';
	if ( $total_page != 0) {
?>
	<div class="paging_column" >
	<?php
		$href 	 = $update_url.$display->searchid."/$display->default_col/$display->image_sort/";

		//case admin
		//if $display->refresh != 'page_content' because show popup windows for standarda and benchmark only
	 	    if(isset($display->refresh) == FALSE){
	 	    	$onclick = "onclick=\"updateWindow('_LINK_', 'calendar_form', '$display->pagetitle','$display->divid');return false;\"";
	 	    }elseif($display->refresh != 'page_content'){
				$onclick = "onclick=\"updateWindow('_LINK_', 'calendar_form', '$display->pagetitle','$display->refresh');return false;\"";
	 		}elseif($display->refresh == 'page_content'){
	 			$onclick = "onClick=\"ajaxGetpage('page_content','_LINK_',false); return false;\"";
	 		}

		$first_page  = '';
		$last_page   = '';
		//$page_number = 5;
		$max_page    = $total_page;
		if ($total_page!= 0)
			echo 'Page:';
		if ($page_number != 1) {
			$url = $href.'-/'.$page_number;
			echo '&nbsp;(<a href="'.$url.'" class="paginglink" '. str_replace('_LINK_',$url, $onclick).'>Previous</a>)';
		}
		$front_page  = '';
		$back_page   = '';

		//$deep  = 8;

		$front = $page_number;
		$back  = $front + ($deep/2);

		$i = 1;
		for ($i==1;$i <=$total_page;$i++) {
			$normal = '';
			if ($i <= $max_page && $i <= $back) {
				if ($page_number != $i)
					$normal = '&nbsp;<a href="'.$href.$i.'" class="paginglink" '.str_replace('_LINK_',$href.$i, $onclick).'>'.$i.'</a>&nbsp;';
				else//if ($i < $max_page-1 && $i < $back-1)
					$normal = '&nbsp;<span class="pagingnormal">'.$i.'&nbsp;</span>';
			}

		//	if ( ($front-$i) > ($deep /2) ) {
			//if ( $front-($deep/2)  > $i || $front+($deep/2) < $total_page ) {
			if ( ($front-($deep/2)  > $i) || ($front+($deep/2) < $i) ) {
				if ($i != 1 && $i!= $max_page)
					$normal = '';
				elseif ($i < $max_page)
					$normal .= '...';
			}

			echo $normal ;

			if ($i > $max_page || $i > $back)  {
				$last_page = '...&nbsp;<a href="'.$href.$total_page.'" class="paginglink" '.str_replace('_LINK_',$href.$total_page, $onclick).' >'.$total_page.'</a>&nbsp;';
				break;
			}
		}
		echo $last_page;
		if ($page_number != $total_page) {
			$url = $href.'+/'.$page_number;
			echo '(<a href="'.$url.'" class="paginglink" '.str_replace('_LINK_',$url, $onclick).'>Next</a>)';
		}
	?>
<?php
	}
	if ( $display->showmargin) {
		//space margin
		echo '<div>&nbsp;</div>';
	}
?>
</div>