Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/admin_acc.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/admin_acc.php	(revision 375)
+++ pro-violet-viettel/sourcecode/application/modules/admin/controllers/admin_acc.php	(revision 375)
@@ -0,0 +1,191 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+
+class Admin_Acc extends MX_Controller
+{
+	public function __construct()
+	{
+		parent::__construct();
+		$this->load->helper('cookie');
+	}
+	
+	public function index()
+	{
+		$admin_info = $this->session->userdata('adminInfo');
+		if ($admin_info)
+		{
+			$data['content'] = $this->get_admins();
+			$this->load->view('admin_acc/index', $data);
+		}else
+		{
+			$this->load->view('login');
+		}
+	}
+	
+	public function get_admins()
+	{
+		$this->load->helper('pagging');
+		$this->load->model('admin_model');
+		$data['current_page'] = $this->uri->segment(4, 1);
+		$data['itemsoptions'] = array(10, 25, 50, 100);
+		$data['perpage'] = 10;
+		$data['keyword'] = "";
+		if ($this->input->post('items')) 
+		{
+			$data['perpage'] = $this->input->post('items');
+		}
+		if ($this->input->post('keyword')) {
+            $data['keyword'] = $this->input->post('keyword');
+        }
+		$data['start'] = ($data['current_page'] - 1) * $data['perpage'];
+		$data['total'] = $this->admin_model->get_total_admins($data);
+		$data['admins'] = $this->admin_model->get_list_admins($data);
+		$data['paging_url'] = base_url() . "admin/quan_tri_vien/trang/";
+		$data['num_links'] = 2;
+		$data['paging'] = pagging($data);
+		if ($this->input->is_ajax_request())
+		{
+			return $this->load->view('admin_acc/listview', $data);
+		}
+		return $this->load->view('admin_acc/listview', $data, true);
+	}
+	
+	public function add_admin()
+	{
+		$admin_info = $this->session->userdata('adminInfo');
+		if ($admin_info)
+		{
+			$this->load->helper('email');
+			$result['success'] = 0;
+			$result = array();
+			$input = $this->input->post();
+			$this->load->model('admin_model');
+			if (strlen($input['full_name'])==0)
+			{
+				$result['errors']['full_name_err']="TÃªn Admin khÃŽng ÄÆ°á»£c Äá» trá»ng";
+			}
+			if (strlen($input['login_name'])==0)
+			{
+				$result['errors']['login_name_err']="TÃªn ÄÄng nháº­p khÃŽng ÄÆ°á»£c Äá» trá»ng";
+			}
+			else
+			{
+				if ($this->admin_model->check_exist(array('field'=>'login_name','value'=>$input['login_name'])))
+				{
+					$result['errors']['login_name_err']="TÃªn ÄÄng nháº­p ÄÃ£ ÄÆ°á»£c sá»­ dá»¥ng";
+				}
+			}
+			if (strlen($input['phone'])==0)
+			{
+				$result['errors']['phone_err']="Sá» Äiá»n thoáº¡i khÃŽng ÄÆ°á»£c Äá» trá»ng";
+			}
+			else
+			{
+				if ($this->admin_model->check_exist(array('field'=>'phone','value'=>$input['phone'])))
+				{
+					$result['errors']['phone_err']="Sá» Äiá»n thoáº¡i ÄÃ£ ÄÆ°á»£c sá»­ dá»¥ng";
+				}
+			}
+			if (strlen($input['passwd'])==0)
+			{
+				$result['errors']['pwd1_err']="Máº­t kháº©u khÃŽng ÄÆ°á»£c Äá» trá»ng";
+			}
+			if ($input['passwd'] != $input['pwd2'])
+			{
+				$result['errors']['pwd2_err']="Máº­t kháº©u khÃŽng trÃ¹ng nhau";
+			}
+			if(strlen($input['email'])==0)
+			{
+				$result['errors']['email_err']="Email khÃŽng ÄÆ°á»£c Äá» trá»ng";
+			}else{
+				if(!valid_email($input['email']))
+				{
+					$result['errors']['email_err']="Email khÃŽng ÄÃºng Äá»nh dáº¡ng";
+				}
+			}
+			if (!isset($result['errors']))
+			{
+				unset($input['pwd2']);
+				$input['created_time']=date("Y-m-d H:i:s");
+				$input['updated_time']=date("Y-m-d H:i:s");
+				$this->admin_model->insert($input);
+				$result['success'] = 1;
+			}
+			echo json_encode($result);
+		}else{
+			$this->load->view('login');
+		}
+	}
+	
+	public function edit_admin()
+	{
+		$admin_info = $this->session->userdata('adminInfo');
+		if ($admin_info)
+		{
+			$input = $this->input->post();
+			$result = array();
+			$result['success'] = 0;
+			$admin_id = (int)$this->uri->segment(4, 0);
+			if ($admin_id==0){
+				$result['success'] = 0;
+			}else
+			{
+				$this->load->model('admin_model');
+				$input['updated_time']=date("Y-m-d H:i:s");
+				$this->admin_model->update($admin_id, $input);
+				$result['success'] = 1;
+			}
+			echo json_encode($result);
+		}else
+		{
+			$this->load->view('login');
+		}
+	}
+		
+	public function delete_admin()
+	{
+		$admin_info = $this->session->userdata('adminInfo');
+		if ($admin_info)
+		{
+			$result = array();
+			$result['success'] = 0;
+			$admin_id = (int)$this->uri->segment(4, 0);
+			if ($admin_id == 0){
+				$result['success'] = 0;
+			}else
+			{
+				$this->load->model('admin_model');
+				$this->admin_model->delete($admin_id);
+				$result['success'] = 1;
+			}
+			echo json_encode($result);
+		}else
+		{
+			$this->load->view('login');
+		}
+	}
+	
+	public function get_admin_by_id()
+	{
+		$admin_info = $this->session->userdata('adminInfo');
+		if ($admin_info)
+		{
+			$result = array();
+			$result['success'] = 0;
+			$admin_id = (int)$this->uri->segment(4, 0);
+			if ($admin_id == 0)
+			{
+				$result['success'] = 0;	
+			}else
+			{
+				$this->load->model('admin_model');
+				$data = $this->admin_model->search_by_id($admin_id);
+				$result['item'] = $data;
+				$result['success'] = 1;
+			}
+			echo json_encode($result);
+		}else
+		{
+			$this->load->view('login');
+		}
+	}
+}
Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/admin_account.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/admin_account.php	(revision 373)
+++ 	(revision )
@@ -1,110 +1,0 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-
-class Admin_Account extends MX_Controller
-{
-	public function __construct() 
-	{
-		parent::__construct();
-		$this->load->helper('cookie');
-	}
-	
-	public function index ()
-	{
-		$admin_info = $this->session->userdata('adminInfo');
-		if($admin_info){
-			$this->load->model('admin_model');
-			$data = $this->admin_model->get_list();
-			$this->load->view('admin_acc', array('data'=>$data));
-		}else
-		{
-			redirect("/admin/home");
-		}
-	}
-	
-	public function insert()
-	{
-		$admin_info = $this->session->userdata('adminInfo');
-		if($admin_info)
-		{
-			$login_name = $this->input->post('username');
-			$password = md5($this->input->post('password'));
-			$full_name = $this->input->post('fullname');
-			$email = $this->input->post('email');
-			$phone = $this->input->post('phone');
-			$created_time = date('Y-m-d H:i:s', time());
-			$updated_time = date('Y-m-d H:i:s', time());
-			$data = array('login_name'=>$login_name, 'full_name'=>$full_name, 'email'=>$email, 'phone'=>$phone, 'created_time'=>$created_time, 'updated_time'=>$updated_time);
-			$this->load->model('admin_model');
-			/*
-			$check = $this->admin_model->check_data($login_name);
-			if ($check)
-			{
-				$this->session->flashdata('insert_error');
-				echo "TÃªn ÄÄng nháº­p ÄÃ£ ÄÆ°á»£c sá»­ dá»¥ng !";
-				//redirect("/admin/home/admin_acc");
-			}else
-			{
-				$this->admin_model->insert($data);
-				redirect("/admin/admin_account");
-			}*/
-			$this->admin_model->insert($data);
-			redirect("/admin/admin_account");
-			
-		}else
-		{
-			redirect("/admin/home");
-		}
-	}
-	
-	public function update()
-	{
-		$admin_info = $this->session->userdata('adminInfo');
-		if($admin_info)
-		{
-			$admin_id = (int)$this->input->post('id');
-			$login_name = $this->input->post('username');
-			//$password = $this->input->post('password');
-			$full_name = $this->input->post('fullname');
-			$email = $this->input->post('email');
-			$phone = $this->input->post('phone');
-			$updated_time = date('Y-m-d H:i:s', time());
-			$data = array('login_name'=>$login_name, 'full_name'=>$full_name, 'email'=>$email, 'phone'=>$phone, 'updated_time'=>$updated_time);
-			$this->load->model('user_model');
-			$this->user_model->update($admin_id, $data);
-			redirect("/admin/admin_account");
-		}else
-		{
-			redirect("/admin/home");
-		}	
-	}
-	
-	public function delete()
-	{
-		$admin_info = $this->session->userdata('adminInfo');
-		if($admin_info)
-		{
-			$admin_id = (int)$this->input->post('id');
-			//echo $admin_id;
-			$this->load->model('admin_model');
-			$this->admin_model->delete($admin_id);
-			redirect("/admin/admin_account");
-		}else
-		{
-			redirect("/admin/home");
-		}	
-	}
-	
-	public function check_data()
-	{
-		$login_name = $this->input->post('username');
-		//var_dump($login_name);
-		$this->load->model('admin_model');
-		$check = $this->admin_model->check_data($login_name);
-		if ($check){
-			echo 1;
-		}else
-		{
-			echo 0;
-		}
-	}
-}
Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php	(revision 375)
+++ pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php	(revision 375)
@@ -0,0 +1,52 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+
+class User extends MX_Controller
+{
+	public function __construct()
+	{
+		parent::__construct();
+		$this->load->helper('cookie');
+	}
+	
+	public function index()
+	{
+		$admin_info = $this->session->userdata('adminInfo');
+		if ($admin_info)
+		{
+			$data['content'] = $this->get_users();
+			$this->load->view('user/index', $data);
+		}else
+		{
+			$this->load->view('login');
+		}
+	}
+	
+	public function get_users()
+	{
+		$this->load->helper('pagging');
+		$this->load->model('user_model');
+		$data['current_page'] = $this->uri->segment(4, 1);
+		$data['itemsoptions'] = array(1, 25, 50, 100);
+		$data['perpage'] = 1;
+		$data['keyword'] = "";
+		if ($this->input->post('items')) 
+		{
+			$data['perpage'] = $this->input->post('items');
+		}
+		if ($this->input->post('keyword')) {
+            $data['keyword'] = $this->input->post('keyword');
+        }
+		$data['start'] = ($data['current_page'] - 1) * $data['perpage'];
+		$data['total'] = $this->user_model->get_total_users($data);
+		$data['users'] = $this->user_model->get_list_users($data);
+		$data['paging_url'] = base_url() . "admin/nguoi_dung/trang/";
+		$data['num_links'] = 2;
+		$data['paging'] = pagging($data);
+		if ($this->input->is_ajax_request())
+		{
+			return $this->load->view('user/listview', $data);
+		}
+		return $this->load->view('user/listview', $data, true);
+	}
+	
+}
Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/user_account.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/user_account.php	(revision 373)
+++ 	(revision )
@@ -1,91 +1,0 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-
-class User_Account extends MX_Controller
-{
-	public function __construct() 
-	{
-		parent::__construct();
-		$this->load->helper('cookie');
-	}
-	
-	public function index ()
-	{
-		$admin_info = $this->session->userdata('adminInfo');
-		if($admin_info){
-			$this->load->model('user_model');
-			$users = $this->user_model->get_list();
-			$this->load->view('user_acc', array('users'=>$users));
-		}else
-		{
-			redirect("/admin/home");
-		}
-	}
-	
-	public function insert()
-	{
-		$admin_info = $this->session->userdata('adminInfo');
-		if($admin_info)
-		{
-			$cellphone = $this->input->post('cellphone');
-			
-			$created_time = date('Y-m-d H:i:s', time());
-			$updated_time = date('Y-m-d H:i:s', time());
-			$data = array('cellphone'=>$cellphone, 'created_time'=>$created_time, 'updated_time'=>$updated_time);
-			$this->load->model('admin_model');
-			$this->admin_model->insert($data);
-			redirect("/admin/user_account");
-			
-		}else
-		{
-			redirect("/admin/home");
-		}
-	}
-	
-	public function update()
-	{
-		$admin_info = $this->session->userdata('adminInfo');
-		if($admin_info)
-		{
-			$user_id = (int)$this->input->post('id');
-			$cellphone = $this->input->post('cellphone');
-			$balance = $this->input->post('balance');
-			$updated_time = date('Y-m-d H:i:s', time());
-			$data = array('cellphone'=>$cellphone, 'acc_balanced'=>$balance, 'updated_time'=>$updated_time);
-			$this->load->model('user_model');
-			$this->user_model->update($user_id, $data);
-			redirect("/admin/user_account");
-		}else
-		{
-			redirect("/admin/home");
-		}	
-	}
-	
-	public function delete()
-	{
-		$admin_info = $this->session->userdata('adminInfo');
-		if($admin_info)
-		{
-			$user_id = (int)$this->input->post('id');
-			$this->load->model('user_model');
-			$this->user_model->delete($user_id);
-			redirect("/admin/user_account");
-		}else
-		{
-			redirect("/admin/home");
-		}	
-	}
-	
-	public function check_data()
-	{
-		$login_name = $this->input->post('username');
-		//var_dump($login_name);
-		$this->load->model('user_model');
-		$check = $this->admin_model->check_data($login_name);
-		if ($check){
-			echo 1;
-		}else
-		{
-			echo 0;
-		}
-	}
-}
