Ignore:
Timestamp:
Nov 3, 2014 6:48:32 PM (11 years ago)
Author:
namnd
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php

    r375 r396  
    2727                $this->load->model('user_model');
    2828                $data['current_page'] = $this->uri->segment(4, 1);
    29                 $data['itemsoptions'] = array(1, 25, 50, 100);
    30                 $data['perpage'] = 1;
     29                $data['itemsoptions'] = array(10, 25, 50, 100);
     30                $data['perpage'] = 10;
    3131                $data['keyword'] = "";
     32                $data['sorting_order']="sorting_desc";
     33        $data['sorting_field']="created_time";
     34                if ($this->input->post('sorting_order')) {
     35                        if ($this->input->post('sorting_order') != "sorting")
     36                        {
     37                                $data['sorting_order'] = $this->input->post('sorting_order');
     38                                $data['sorting_field'] = $this->input->post('sorting_field');
     39                        }
     40                }
    3241                if ($this->input->post('items'))
    3342                {
     
    5059        }
    5160       
     61        public function edit_user()
     62        {
     63                $admin_info = $this->session->userdata('adminInfo');
     64                if ($admin_info)
     65                {
     66                        $input = $this->input->post();
     67                        $result = array();
     68                        $result['success'] = 0;
     69                        $us_id = (int)$this->uri->segment(4, 0);
     70                        if ($us_id==0){
     71                                $result['success'] = 0;
     72                        }else
     73                        {
     74                                $this->load->model('user_model');
     75                                $input['updated_time'] = date("Y-m-d H:i:s");
     76                                $this->user_model->update($us_id, $input);
     77                                $result['success'] = 1;
     78                        }
     79                        echo json_encode($result);
     80                }else
     81                {
     82                        $this->load->view('login');
     83                }
     84        }
     85       
     86        public function delete_user()
     87        {
     88                $admin_info = $this->session->userdata('adminInfo');
     89                if ($admin_info)
     90                {
     91                        $result = array();
     92                        $result['success'] = 0;
     93                        $us_id = (int)$this->uri->segment(4, 0);
     94                        if ($us_id == 0){
     95                                $result['success'] = 0;
     96                        }else
     97                        {
     98                                $this->load->model('user_model');
     99                                $this->user_model->delete($us_id);
     100                                $result['success'] = 1;
     101                        }
     102                        echo json_encode($result);
     103                }else
     104                {
     105                        $this->load->view('login');
     106                }
     107        }
     108       
     109        public function get_user_by_id()
     110        {
     111                $admin_info = $this->session->userdata('adminInfo');
     112                if ($admin_info)
     113                {
     114                        $result = array();
     115                        $result['success'] = 0;
     116                        $us_id = (int)$this->uri->segment(4, 0);
     117                        if ($us_id == 0)
     118                        {
     119                                $result['success'] = 0;
     120                        }else
     121                        {
     122                                $this->load->model('user_model');
     123                                $data = $this->user_model->search_by_id($us_id);
     124                                $result['item'] = $data;
     125                                $result['success'] = 1;
     126                        }
     127                        echo json_encode($result);
     128                }else
     129                {
     130                        $this->load->view('login');
     131                }
     132        }
     133       
    52134}
Note: See TracChangeset for help on using the changeset viewer.