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

class Users extends CI_Controller {

	function __construct(){
		//session_start();
		parent::__construct();
		if(!isset($_SESSION['logged'])){
			redirect('admin');
		}
		$this->load->library("pagination");
	}
	public function index()
	{
		$this->load->model('user_model');
		$config = array();
		$config["base_url"] = base_url() . "admin/users/";
		$config["total_rows"] = $this->user_model->getUserCount();
		$config["per_page"] = 10;
		$config["uri_segment"] = 3;
		$config["num_links"] = 5;
		
		$this->pagination->initialize($config);
		$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
		$users=$this->user_model->getUsers(null,$config["per_page"], $page);
		$data["links"] = $this->pagination->create_links();
		$data['users']=$users;
		$data['main_content']='admin/users/index';
		$data['title']='Manage Users :: Website Control panel';
		$data['bodyid']='users';
		$this->load->view('admintemplate',$data);
	}
}

?>
