<?php
/**
 * Handle_sort.php - Sort and paging handle for all searches. All paging link goes here and uses the saved session
 *                   TODO: This file has to go away. It does evrything what OOP is against...
 *                   FILE IS OBSOLETE.
 *
 * @author $Author: dtong $
 * @version $Id: Handle_sort.php,v 1.11 2011/04/11 07:01:58 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/
echo 'Handle_sort.php is obsolete.';
exit;

if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once('Handle_base.php');
require_once('display_list.php');

class Handle_sort extends Handle_base{
	function __construct($params) {
		parent::__construct($params);
		//osa_nosession_ajax_redirect();
	}

	function process() {
		$divid = $this->get_templatevalue('_result_divid');
		if (isset($divid)== false || $divid == false ) {
         $divid = $this->get_inputvalue('_divid');
		}
		$display = $this->CI->searchsort_model->getSort($divid);
	   $display->default_col = $this->default_col;
      $display->image_sort = $this->image_sort;
      $display->perpage = $this->perpage;
      if ( $this->paging !== FALSE ) {
         $display->paging = $this->paging;
      }
      if ( $this->current_page !== FALSE ) {
         $display->current_page = $this->current_page;
      }
/*
		if ( array_key_exists( $this->default_col, $display->current_col ) ) {
			if ( $this->is_sorting ) {
				if ($display->image_sort==0)
					$display->image_sort =1;
				else
					$display->image_sort =0;
			}
		} else {
			$display->current_col= array();
			$display->current_col[$this->default_col] = 0;
			$display->image_sort  = 0;
			$display->default_col = $this->default_col;
		}
*/
		//$display->paging          = $this->paging;
		//TODO: this is a temporary fix for (issue: 111). Should rewrite the display list and session code
		//If we are here then we should show all the buttons.
		//Somehow viewing the PDF document would take out the PDF button so always add it here
		$display->closebutton     = TRUE;
		$display->pdfbutton     = TRUE;
		//$display->current_page    = $this->current_page;

		//$this->CI->searchsort_model->page_top($display);
		$display->prepare_page();
	  	$this->CI->load->view('mapping/display_list_view', array('display'=>$display));
	  	//$this->CI->searchsort_model->page_bottom($display);
	 	//$this->CI->searchsort_model->setSortSession($display);
	}
}
?>