<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Sort_Table extends CI_Controller {

    public function sort_values()
	{
        $this->load->model('Fetch_Ballot_Model');

        if($this->Fetch_Ballot_Model->Fetch_Data())
            {   
                $all_data['bdata']=$this->Fetch_Ballot_Model->Fetch_Data();
            }
            
        $sr=$this->uri->segment(3);
        $sr=trim($sr);
        $sr=urldecode($sr);

        $this->load->model('Voted_List_Model');

        if($this->Voted_List_Model->conditional_show($sr))
            {   
                $all_data['data']=$this->Voted_List_Model->conditional_show($sr);
                /*echo " "."admin ".$data[0]->name." ".$data[0]->email." ".$data[0]->type;
                echo " "."admin ".$data[1]->name." ".$data[1]->email." ".$data[1]->type;*/
    
                $this->load->view('Voted_List_View',$all_data);
            }
        else
        {
            echo "not done";
        }     
    }

    public function sort_values_admin()
	{
        $this->load->model('Fetch_Ballot_Model');

        if($this->Fetch_Ballot_Model->Fetch_Data())
            {   
                $all_data['bdata']=$this->Fetch_Ballot_Model->Fetch_Data();
            }
            
        $sr=$this->uri->segment(3);
        $sr=trim($sr);
        $sr=urldecode($sr);

        $this->load->model('Voted_List_Model');

        if($this->Voted_List_Model->conditional_show($sr))
            {   
                $all_data['data']=$this->Voted_List_Model->conditional_show($sr);
                /*echo " "."admin ".$data[0]->name." ".$data[0]->email." ".$data[0]->type;
                echo " "."admin ".$data[1]->name." ".$data[1]->email." ".$data[1]->type;*/
    
                $this->load->view('Voted_List_View_Admin',$all_data);
            }
        else
        {
            echo "not done";
        }     
    }
    
}
