Changeset 396


Ignore:
Timestamp:
Nov 3, 2014 6:48:32 PM (11 years ago)
Author:
namnd
Message:
 
Location:
pro-violet-viettel/sourcecode
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/config/routes.php

    r375 r396  
    6161$route['admin/nguoi_dung/trang'] = 'admin/user/get_users/1';
    6262$route['admin/nguoi_dung/trang/:any'] = 'admin/user/get_users/$1';
     63$route['admin/nguoi_dung/them'] = 'admin/user/add_user';
     64$route['admin/nguoi_dung/sua/:any'] = 'admin/user/edit_user/$1';
     65$route['admin/nguoi_dung/xoa/:any'] = 'admin/user/delete_user/$1';
     66$route['admin/nguoi_dung/id/:any'] = 'admin/user/get_user_by_id/$1';
     67
    6368/* End of file routes.php */
    6469/* Location: ./application/config/routes.php */
  • pro-violet-viettel/sourcecode/application/core/MY_Model.php

    r375 r396  
    4747        {
    4848                $sql="SELECT COUNT(".$this->id_name.") as total FROM ".$this->table_name." WHERE ".$data['field']." = '".$data['value']."' LIMIT 1";
     49                if (!isset($this->db->query($sql)->row_array()['total'])) return false;
    4950                if ($this->db->query($sql)->row_array()['total']==1)
    5051                {
  • 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}
  • pro-violet-viettel/sourcecode/application/modules/admin/models/user_model.php

    r375 r396  
    2222        {
    2323                $sql="SELECT * FROM ".$this->table_name;
    24                 $data['keyword']='';
    2524                if ($data['keyword'])
    2625                {
    2726                        $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%') ";
     27                }
     28                $order = "";
     29                if ($data['sorting_order'] != "sorting") {
     30                        $sort = "DESC";
     31                        if ($data['sorting_order'] == "sorting_asc")
     32                                $sort = "ASC";
     33                        $order = "ORDER BY " . $data['sorting_field'] . " " . $sort;
    2834                }
    2935                return $this->db->query($sql." ORDER BY us_id DESC LIMIT ".$data['start'].", ".$data['perpage']." ")->result_array();
  • pro-violet-viettel/sourcecode/application/modules/admin/views/user/index.php

    r378 r396  
    2424            return false;
    2525        });
     26                $('#keyword').bind('input', function(){
     27                        filter();
     28                });
     29               
     30                $( '.sorting, .sorting_desc, .sorting_asc' ).click(function( index ) {
     31            var current_class=$( this ).attr('class');
     32            $(".sorting_desc").attr("class","sorting");
     33            $(".sorting_asc").attr("class","sorting");
     34     
     35            if(current_class=='sorting')
     36            {
     37                $(this).attr("class","sorting_desc");
     38            }
     39            else
     40            {
     41                if(current_class=='sorting_desc')
     42                {
     43                    $(this).attr("class","sorting_asc");
     44                }
     45                else
     46                    {
     47                    if(current_class=='sorting_asc')
     48                    {
     49                        $(this).attr("class","sorting");
     50                    }
     51                }
     52            }
     53                        console.log($( this ).attr('class'));
     54            $("#sorting_field").val($(this).attr("id"));
     55            $("#sorting_order").val($(this).attr("class"));
     56            filter();
     57        });
    2658        }
    2759       
     
    3668                                $("#content").html(data);
    3769                                init_page();
    38                                 //$("#keyword").focus();
    39                                 //$("#keyword").setCursorToTextEnd();
     70                                $("#keyword").focus();
     71                                $("#keyword").setCursorToTextEnd();
    4072
    4173                        },
     
    144176</div><!-- /.modal-dialog -->
    145177
     178<!-- Edit User -->
     179<div tabindex="-1" class="modal fade in" id="editUser">
     180        <div class="modal-dialog">
     181                <div class="modal-content">
     182                        <div class="modal-header no-padding">
     183                                <div class="table-header">
     184                                        <button aria-hidden="true" data-dismiss="modal" class="close" type="button">
     185                                                <span class="white">×</span>
     186                                        </button>
     187                                        Sá»­a người dùng
     188                                </div>
     189                        </div>
     190       
     191                        <div class="modal-body">
     192                                <form id="edit_frm" onsubmit="return false;" class="form-horizontal" role="form">
     193                                        <div class="form-group">
     194                                                <label for="form-field-1" class="col-sm-3 control-label no-padding-right"> Số điện thoại </label>
     195                                                <div class="col-sm-9">
     196                                                        <label class="block clearfix has-error">
     197                                                                <span class="input-icon">
     198                                                                        <input type="text" id="edit_cellphone" name="cellphone" placeholder="Phone" id="form-field-1" value="">
     199                                                                        <i class="icon-user blue"></i>
     200                                                                </span>
     201                                                                <div class="help-block"> </div>
     202                                                        </label>
     203                                                </div>
     204                                        </div>
     205
     206                                        <div class="form-group">
     207                                                <label for="form-field-2" class="col-sm-3 control-label no-padding-right"> Tiền </label>
     208                                                <div class="col-sm-9">
     209                                                        <span class="input-icon">
     210                                                                <input type="text" id="edit_acc_balanced" name="acc_balanced" placeholder="" id="form-field-2" value="">
     211                                                                <i class="icon-user blue"></i>
     212                                                        </span>
     213                                                </div>
     214                                                <label class="block clearfix has-error">
     215                                                        <div class="help-block"> </div>
     216                                                </label>
     217                                               
     218                                        </div>
     219
     220                                        <div class="space-4"></div>
     221                                        <div class="clearfix form-actions">
     222                                                <div class="col-md-offset-3 col-md-9">
     223                                                        <button type="button" id="edit" class="btn btn-info">
     224                                                                <i class="icon-ok bigger-110"></i>
     225                                                                Hoàn tất
     226                                                        </button>
     227
     228                                                        &nbsp; &nbsp; &nbsp;
     229                                                        <button type="reset" name="reset" class="btn">
     230                                                                <i class="icon-undo bigger-110"></i>
     231                                                                Xóa hết
     232                                                        </button>
     233                                                </div>
     234                                        </div>
     235                                </form>
     236                        </div>
     237                </div>
     238        </div>
     239</div>
     240<!-- End Edit User -->
     241
     242<!-- Delete User -->
     243<div tabindex="-1" class="modal fade in" id="deleteUser">
     244        <div class="modal-dialog">
     245                <div class="modal-content">
     246                        <div class="modal-header no-padding">
     247                                <div class="table-header">
     248                                        <button aria-hidden="true" data-dismiss="modal" class="close" type="button">
     249                                                <span class="white">×</span>
     250                                        </button>
     251                                        Xóa người dùng
     252                                </div>
     253                        </div>
     254                       
     255                        <div class="modal-body">
     256                                <form id="delete_frm" onsubmit="return false;" class="form-horizontal" role="form">
     257                                        <div class="form-group">
     258                                                <center><h4> Chắc chắn muốn xóa tài khoản này? </h4></center>
     259                                        </div>
     260                                        <div class="clearfix form-actions">
     261                                                <div class="col-md-offset-3 col-md-9">
     262                                                        <button type="button" id="delete" class="btn btn-info">
     263                                                                <i class="icon-ok bigger-110"></i>
     264                                                                Xóa
     265                                                        </button>
     266
     267                                                        &nbsp; &nbsp; &nbsp;
     268                                                        <button type="reset" name="reset" class="btn" data-dismiss="modal">
     269                                                                <i class="icon-undo bigger-110"></i>
     270                                                                Há»§y
     271                                                        </button>
     272                                                </div>
     273                                        </div>
     274                                </form>
     275                        </div>
     276                </div>
     277        </div>
     278</div>                                 
     279<!-- End Delete User -->
     280
    146281<?php
    147 $this->load->view('layout/admin/footer', array('base_url' => $base_url));
     282$this->load->view('layout/admin/footer', array('base_url' => $base_url, 'adminjs' => array('assets/js/admin/user.js')));
    148283?>
  • pro-violet-viettel/sourcecode/application/modules/admin/views/user/listview.php

    r375 r396  
    7171                            </div>
    7272                        </div>
     73                                                <input type="hidden" name="sorting_order" id="sorting_order" value="<?php echo $sorting_order;?>" />
     74                                                <input type="hidden" name="sorting_field" id="sorting_field" value="<?php echo $sorting_field;?>"/>
    7375                    </form>
    7476                    <table class="table table-striped table-bordered table-hover dataTable" id="sample-table-2" aria-describedby="sample-table-2_info">
     
    8183                                    </label>
    8284                                </th>
    83                                 <th class="sorting" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 176px;" aria-label="Số điện thoại: activate to sort column ascending">Số điện thoại</th>
    84                                 <th class="hidden-480 sorting" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 122px;" aria-label="Tiền: activate to sort column ascending">Tiền</th>
    85                                 <th class="sorting" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 209px;" aria-label="Ngày đăng kÜ: activate to sort column ascending">
     85                                <th class="<?php if ($sorting_field == 'cellphone') {echo $sorting_order;} else {echo "sorting";}?>" id="cellphone" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 176px;" aria-label="Số điện thoại: activate to sort column ascending">Số điện thoại</th>
     86                                <th class="<?php if ($sorting_field == 'acc_balanced') {echo $sorting_order;} else {echo "sorting";}?>" id="acc_balanced" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 122px;" aria-label="Tiền: activate to sort column ascending">Tiền</th>
     87                                <th class="<?php if ($sorting_field == 'created_time') {echo $sorting_order;} else {echo "sorting";}?>" id="created_time" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 209px;" aria-label="Ngày đăng kÜ: activate to sort column ascending">
    8688                                    <i class="icon-time bigger-110 hidden-480"></i>
    8789                                    Ngày đăng kÜ
    8890                                </th>
    89                                 <th class="hidden-480 sorting" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 158px;" aria-label="Trạng thái: activate to sort column ascending">Trạng thái</th><th class="sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 133px;" aria-label=""></th></tr>
     91                                                                <th class="<?php if ($sorting_field == 'expire_date') {echo $sorting_order;} else {echo "sorting";}?>" id="expire_date" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 209px;" aria-label="Ngày hết hạn: activate to sort column ascending">
     92                                    <i class="icon-time bigger-110 hidden-480"></i>
     93                                    Ngày hết hạn
     94                                </th>
     95                                <th class="sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 133px;" aria-label=""></th></tr>
    9096                        </thead>
    9197
     
    108114                                <td class="hidden-480 "><?php echo $user['acc_balanced']; ?></td>
    109115                                <td class=" "><?php echo $user['created_time']; ?></td>
    110 
    111                                 <td class="hidden-480 ">
    112                                     <span class="label label-sm label-success">Đã kích hoạt</span>
    113                                 </td>
     116                                                                <td class=" "><?php echo $user['expire_date']; ?></td>
    114117
    115118                                <td class=" ">
     
    119122                                        </a>
    120123
    121                                         <a href="#" class="green">
     124                                        <a href="#editUser" data-toggle="modal" data-us-id=<?php echo $user['us_id']; ?> class="green">
    122125                                            <i class="icon-pencil bigger-130"></i>
    123126                                        </a>
    124127
    125                                         <a href="#" class="red">
     128                                        <a href="#deleteUser" data-toggle="modal" data-us-id=<?php echo $user['us_id']; ?> class="red">
    126129                                            <i class="icon-trash bigger-130"></i>
    127130                                        </a>
Note: See TracChangeset for help on using the changeset viewer.