Ignore:
Timestamp:
Nov 3, 2014 9:51:10 AM (11 years ago)
Author:
quyenla
Message:

collaborator order sourcecode

Location:
pro-violet-viettel/sourcecode/application/modules/admin
Files:
4 edited

Legend:

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

    r366 r371  
    2929        $data['perpage'] = 10;
    3030        $data['keyword'] = "";
    31 
     31        $data['sorting_order']="sorting_desc";
     32        $data['sorting_field']="created_time";
     33       
     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            $data['perpage'] = $this->input->post('items');
  • pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php

    r366 r371  
    2020            $sql.=" WHERE (full_name LIKE '%".$data['keyword']."%' OR login_name LIKE '%".$data['keyword']."%') ";
    2121            }
    22             return $this->db->query($sql." ORDER BY id DESC LIMIT ".$data['start'].", ".$data['perpage']." ")->result_array();
     22            $order="";
     23            if ($data['sorting_order'] != "sorting")
     24            {
     25                if ($data['sorting_field'] != "money")
     26                {
     27                $sort="DESC";
     28                if ($data['sorting_order']=="sorting_asc") $sort = "ASC";
     29                $order="ORDER BY ".$data['sorting_field']." ".$sort;
     30                }
     31            }
     32           
     33            return $this->db->query($sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage']." ")->result_array();
    2334
    2435        }
  • pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/index.php

    r366 r371  
    3333            return false;
    3434        });
     35       
     36       
     37$( '.sorting, .sorting_desc, .sorting_asc' ).click(function( index ) {
     38            var current_class=$( this ).attr('class');
     39            $(".sorting_desc").attr("class","sorting");
     40            $(".sorting_asc").attr("class","sorting");
     41     
     42            if(current_class=='sorting')
     43            {
     44                $(this).attr("class","sorting_desc");
     45            }
     46            else
     47            {
     48                if(current_class=='sorting_desc')
     49                {
     50                    $(this).attr("class","sorting_asc");
     51                }
     52                else
     53                    {
     54                    if(current_class=='sorting_asc')
     55                    {
     56                        $(this).attr("class","sorting");
     57                    }
     58                }
     59            }
     60            $("#sorting_field").val($(this).attr("id"));
     61            $("#sorting_order").val($(this).attr("class"));
     62            filter();
     63        });
     64
     65
    3566    }
    3667
  • pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/listview.php

    r359 r371  
    7171                            </div>
    7272                        </div>
     73                        <input type="text" name="sorting_order" id="sorting_order" value="<?php echo $sorting_order;?>" />
     74                        <input type="text" 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="sorting" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 183px;" aria-label="Họ tên: activate to sort column ascending">Họ tên</th>
    85                                 <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>
    86                                 <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 == 'full_name') {echo $sorting_order;} else {echo "sorting";}?>" id="full_name" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 183px;" aria-label="Họ tên: activate to sort column ascending">Họ tên</th>
     87                                <th class="sorting" id="money" 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>
     88                                <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">
    8789                                    <i class="icon-time bigger-110 hidden-480"></i>
    8890                                    Ngày đăng kÜ
    8991                                </th>
    90                                 <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>
     92                                <th class="<?php if ($sorting_field=='activated') {echo $sorting_order;} else {echo "sorting";}?>" id="activated" 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>
    9193                        </thead>
    9294
Note: See TracChangeset for help on using the changeset viewer.