Ignore:
Timestamp:
Apr 23, 2015 12:00:06 PM (10 years ago)
Author:
namnd
Message:
 
Location:
pro-violet-viettel/sourcecode/application/modules/admin
Files:
11 edited

Legend:

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

    r838 r906  
    1717        $admin_info = $this->session->userdata('adminInfo');
    1818        if ($admin_info) {
    19             $data['content'] = $this->getCollaborators();
     19                        $roles=array();
     20            foreach ($admin_info['roles'] as $role)
     21            {
     22                $roles[]=$role['role_name'];
     23            }
     24            //$data['roles']=$roles;
     25            $data['content'] = $this->getCollaborators(array(), $roles);
    2026            $this->load->view('collaborator/index', $data);
    2127        } else {
     
    2430    }
    2531
    26     public function getCollaborators($filters = array()) {
     32    public function getCollaborators($filters = array(), $roles) {
    2733        $this->load->helper('pagging');
    2834        $this->load->model('collabolator_model');
     
    7682        $data['num_links'] = 2;
    7783        $data['paging'] = pagging($data);
    78 
     84                $data['roles'] = $roles;
     85               
    7986        if ($this->input->is_ajax_request()) {
    8087            return $this->load->view('collaborator/listview', $data);
     
    8895        $input = $this->input->post();
    8996        $this->load->model('collabolator_model');
    90         if (strlen($input['full_name'])==0)
    91         {
    92             $result['errors'][]=array("content"=>"Tên cộng tác viên khÃŽng được để trống","field"=>"full_name");
    93         }
    94         if (strlen($input['login_name'])==0)
    95         {
    96             $result['errors'][]=array("content"=>"Tên đăng nhập khÃŽng được để trống","field"=>"login_name");
     97               
     98        if (strlen($input['cellphone'])==0)
     99        {
     100            $result['errors'][] = array("content"=>lang('_SBG_PHONE_REQUIRED_MSG'),"field"=>"cellphone");
    97101        }
    98102        else
    99103        {
    100             if ($this->collabolator_model->isExist(array('field'=>'login_name','value'=>$input['login_name'])))
    101             {
    102                 $result['errors'][]=array("content"=>"Tên đăng nhập đã được sá»­ dụng","field"=>"login_name");
    103             }
    104         }
    105         if (strlen($input['cellphone'])==0)
    106         {
    107             $result['errors'][]=array("content"=>"Số điện thoại khÃŽng được để trống","field"=>"cellphone");
    108         }
    109         else
    110         {
     104                        if (!preg_match('/^([0-9]{10,11}$)$/', $input['cellphone'])) {
     105                                $result['errors'][] = array("content"=>lang('_SBG_PHONE_FORMAT_ERROR_MSG'), "field"=>"cellphone");
     106                        }
     107                       
    111108            if ($this->collabolator_model->isExist(array('field'=>'cellphone','value'=>$input['cellphone'])))
    112109            {
    113                 $result['errors'][]=array("content"=>"Số điện thoại đã được sá»­ dụng","field"=>"cellphone");
    114             }
    115         }
    116         if (strlen($input['passwd'])==0)
    117         {
    118             $result['errors'][]=array("content"=>"Mật khẩu khÃŽng được để trống","field"=>"passwd");
    119         }
    120         else
    121         {
    122             if ($input['passwd'] != $input['passwd2'])
    123             {
    124                 $result['errors'][]=array("content"=>"Mật khẩu phải trùng nhau","field"=>"passwd");
    125             }
    126         }
     110                $result['errors'][] = array("content"=>lang("_SBG_PHONE_DUPLICATE_MSG"),"field"=>"cellphone");
     111            }
     112        }
     113       
    127114        if (!isset($result['errors']))
    128115        {
    129             unset($input['passwd2']);
    130             $input['passwd']=md5($input['activated']);
    131             $input['activated']=1;
    132             $input['created_time']=date("Y-m-d H:i:s");
    133             $input['updated_time']=date("Y-m-d H:i:s");
     116   
     117                        $passwd = $this->collabolator_model->createRandomPassword();
     118            $input['passwd'] = md5($input['activated']);
     119                        $input['login_name'] = $input['cellphone'];
     120                        $input['author'] = 1;
     121            $input['activated'] = 1;
     122            $input['created_time'] = date("Y-m-d H:i:s");
     123            $input['updated_time'] = date("Y-m-d H:i:s");
    134124            $this->load->model('collabolator_model');
     125                       
    135126            $this->collabolator_model->insert($input);
    136127            $result['success'] = 1;
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportAsistant.php

    r838 r906  
    2424        }
    2525    }
    26 
     26       
    2727    public function viewAsistant() {
    2828        $data = array();
     
    159159        $data['keyword'] = "";
    160160        $data['sorting_order'] = "sorting_desc";
    161         $data['sorting_field'] = "id";
     161        $data['sorting_field'] = "user_created_time";
    162162
    163163        if ($this->input->post('sorting_order')) {
     
    181181                $data['daterange_start'] = "";
    182182                $data['daterange_end'] = "";
     183               
    183184                if ($this->input->post('daterange')){
    184185                        $daterange = explode(" - ", $this->input->post('daterange'));
     
    190191               
    191192        $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
     193                //write_file('./log/sql.log', date('d-m-Y H:i:s').": Start query \n", FOPEN_WRITE_CREATE);
    192194        $data['total'] = $this->collabolator_model->countCountCollaboratorUsers($data);
     195                write_file('./log/sql.log', date('d-m-Y H:i:s').": Start query \n", FOPEN_WRITE_CREATE);
    193196        $data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUsers($data);
     197               
    194198        foreach ($data['paidlogs'] as $index=>$paidlog)
    195199        {
    196200            $data['paidlogs'][$index]['username']=$this->get_fullname($paidlog['us_id']);
    197201        }
     202                write_file('./log/sql.log', date('d-m-Y H:i:s').": Finished query \n", FOPEN_WRITE_CREATE);
    198203        $data['paging_url'] = base_url() . "/admin/thong_ke_cong_tac_vien/trang_ctv/" . $data['id'];
    199204        $data['num_links'] = 2;
     
    203208            return $this->load->view('reportAsistant/listview_user', $data);
    204209        }
     210               
    205211        return $this->load->view('reportAsistant/listview_user', $data, true);
    206212    }
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php

    r883 r906  
    132132                $this->load->model('reportmodel');
    133133                $data['date'] = 1;
    134         $data['month'] = $this->uri->segment(4);
    135         $data['year'] = $this->uri->segment(5);
    136         $data['to_date'] = date("d");
     134        $data['month'] = $this->uri->segment(5);
     135        $data['year'] = $this->uri->segment(6);
     136        $data['to_date'] = $this->uri->segment(4);
    137137        $data['to_month'] = date("m");
    138138        $data['to_year'] = date("Y");
     139                /*
    139140        if ($this->input->post()) {
    140141                        //$data['date'] = $this->input->post('date');
     
    144145            $data['to_month'] = $this->input->post('to_month');
    145146            $data['to_year'] = $this->input->post('to_year');
    146         }
     147        }*/
    147148               
    148149        $result = $this->reportmodel->getProvinces($data);
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php

    r883 r906  
    8181                        $daterange [0] = str_replace ( '/', '-', $daterange [0] );
    8282                        $daterange [1] = str_replace ( '/', '-', $daterange [1] );
     83                        $data['date_start'] = $daterange [0];
     84                        $data['date_end'] = $daterange [1];
    8385                        $data ['daterange_start'] = date ( 'Y-m-d H:i:s', strtotime ( $daterange [0] ) );
    8486                        $data ['daterange_end'] = date ( 'Y-m-d H:is:s', strtotime ( $daterange [1] . ' + 1 day' ) );
     
    208210                );
    209211                $data ['status'] = $this->uri->segment (7, 0);
    210                 /*
    211                 if ($this->input->post ( 'status' )) {
    212                         $data ['status'] = ( int ) $this->input->post ( 'status' );
    213                 }
    214                 */
     212               
    215213                $data['provinces'] = $provinces;
    216214                $data['province'] = $this->uri->segment (8);
     215               
    217216                if ($data['province'] == 'default') $data['province'] = null;
    218                 if ($this->input->post ( 'province' )) {
    219                         $data ['province'] = $this->input->post ( 'province' );
    220                 }
    221217                if ($data['province'])
    222218                        $data['districts'] = $this->user_model->getDistrictByProvince($data ['province']);
    223                 if ($this->input->post ( 'district' )) {
    224                         $data['district'] = $this->input->post ( 'district' );
    225                 }
    226                
     219
    227220                $data['district'] = $this->uri->segment (9);
    228221                if ($data['district'] == 'default') $data['district'] = null;
    229222                $data ['keyword'] = $this->uri->segment (6);
    230223                if ($data['keyword'] == 'default') $data['keyword'] = null;
     224               
    231225                $data ['sorting_order'] = "sorting_desc";
    232226                $data ['sorting_field'] = "created_time";
    233                 $data ['sorting_order'] = $this->uri->segment (11);
    234                 $data ['sorting_field'] = $this->uri->segment (12);
    235                
    236                 if ($this->input->post ( 'sorting_order' )) {
    237                         if ($this->input->post ( 'sorting_order' ) != "sorting") {
    238                                 $data ['sorting_order'] = $this->input->post ( 'sorting_order' );
    239                                 $data ['sorting_field'] = $this->input->post ( 'sorting_field' );
    240                         }
    241                 }
    242                
    243                 if ($this->input->post ( 'items' )) {
    244                         $data ['perpage'] = $this->input->post ( 'items' );
    245                 }
    246                
    247                 if ($this->input->post ( 'keyword' )) {
    248                         $data ['keyword'] = $this->input->post ( 'keyword' );
    249                 }
    250                
    251                 $data ['daterange_start'] = "";
    252                 $data ['daterange_end'] = "";
    253                 $daterange = $this->uri->segment (10);
    254                 if ($daterange == 'default') $daterange = null;
    255                 if($daterange){
    256                         $daterange = explode ( " - ", $daterange );
    257                         $daterange [0] = str_replace ( '/', '-', $daterange [0] );
    258                         $daterange [1] = str_replace ( '/', '-', $daterange [1] );
    259                         $data ['daterange_start'] = date ( 'Y-m-d H:i:s', strtotime ( $daterange [0] ) );
    260                         $data ['daterange_end'] = date ( 'Y-m-d H:is:s', strtotime ( $daterange [1] . ' + 1 day' ) );
    261                 }
    262                 if ($this->input->post ( 'daterange' )) {
    263                         $daterange = explode ( " - ", $this->input->post ( 'daterange' ) );
    264                         $daterange [0] = str_replace ( '/', '-', $daterange [0] );
    265                         $daterange [1] = str_replace ( '/', '-', $daterange [1] );
    266                         $data ['daterange_start'] = date ( 'Y-m-d H:i:s', strtotime ( $daterange [0] ) );
    267                         $data ['daterange_end'] = date ( 'Y-m-d H:is:s', strtotime ( $daterange [1] . ' + 1 day' ) );
    268                 }
     227                $data ['sorting_order'] = $this->uri->segment (12);
     228                $data ['sorting_field'] = $this->uri->segment (13);
     229
     230                $data ['daterange_start'] = $this->uri->segment (10);
     231                $data ['daterange_end'] = $this->uri->segment (11);
     232                if ($data['daterange_start'] == 'default') $data['daterange_start'] = null;
     233                if ($data['daterange_end'] == 'default') $data['daterange_end'] = null;
     234                if ($data['daterange_start'])
     235                        $data['daterange_start'] = date ( 'Y-m-d H:i:s', strtotime ( $data ['daterange_start'] ) );
     236                if ($data['daterange_end'])
     237                        $data['daterange_end'] = date ( 'Y-m-d H:i:s', strtotime ( $data['daterange_end'] . ' + 1 day' ) );
     238
    269239                $data ['start'] = ($data ['current_page'] - 1) * $data ['perpage'];
     240                //echo json_encode($data);
    270241                $data ['total'] = $this->user_model->get_total_users ( $data );
    271242                $us = $this->user_model->get_list_users ( $data );
    272243                $users = array ();
     244               
    273245               
    274246                foreach ( $us as $u ) {
     
    295267                        array_push ( $users, $u );
    296268                }
    297        
     269               
    298270                $data ['users'] = $users;
    299271                $data ['paging_url'] = base_url () . "admin/nguoi_dung/trang/";
  • pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php

    r838 r906  
    4949    function getAllCollaboratorUser($from,$id=false)
    5050    {
    51         $from = date("Y-m-d 00:00:00",$from);
     51        $from = date("Y-m-d 00:00:00",$from);
     52                $order = "";
     53        if ($data['sorting_order'] != "sorting") {
     54           
     55                $sort = "DESC";
     56                if ($data['sorting_order'] == "sorting_asc")
     57                    $sort = "ASC";
     58                $order = "ORDER BY " . $data['sorting_field'] . " " . $sort;
     59           
     60        }
    5261        $where="";
    5362        if ($id)
    5463        {
    55             $where = " AND tbluser.collaborator = $id ";
     64            //$where = " AND tbluser.collaborator = $id ";
     65                        $where = " AND tblcollaborator.id = $id ";
    5666        }
    5767        //$sql="SELECT *,tblcollaborator.created_time as collaborator_created_time, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.id WHERE tbluser.created_time > '".$from."'".$where."";
    5868                $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.cellphone WHERE tbluser.created_time > '".$from."'".$where."";
    59 
     69               
    6070        $result = $this->db->query($sql)->result_array();
    6171        foreach ($result as $index=>$paidlog)
     
    120130       
    121131                $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time,tblcollaborator.cellphone as collaborator_cellphone, tbluser.created_time as user_created_time, COUNT(tbluser.collaborator) as total_user  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.cellphone ".$where." GROUP BY tblcollaborator.id ".$order." LIMIT " . $data['start'] . ", " . $data['perpage'] . " ";
    122 
     132               
    123133        $result = $this->db->query($sql)->result_array();
    124134        foreach ($result as $index=>$paidlog)
     
    153163                }else{
    154164                        $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time,tbluser.cellphone as user_cellphone,tblcollaborator.cellphone as collaborator_cellphone, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.cellphone ".$where." AND tblcollaborator.id = ".$data['id']." ".$order."";
    155                 }       
     165                }
     166                //write_file('./log/sql.log', date('d-m-Y H:i:s').": ".$sql."\n", FOPEN_WRITE_CREATE);         
    156167                $result = $this->db->query($sql)->result_array();
     168               
    157169        foreach ($result as $index=>$paidlog)
    158170        {
    159171            $result[$index]['time']=  strtotime($paidlog['user_created_time']);
    160172        }
    161 
     173               
    162174        return count($result);
    163175    }
    164         function getCountCollaboratorUsers($data)
     176       
     177        function getCountCollaboratorUsers($data)
    165178    {
    166179        $order = "";
    167         if ($data['sorting_order'] != "sorting") {
    168            
     180        if ($data['sorting_order'] != "sorting") {       
    169181                $sort = "DESC";
    170182                if ($data['sorting_order'] == "sorting_asc")
     
    174186        }
    175187        $where="";
     188               
    176189        if ($data['keyword']) {
    177190            if ($data['search_field'] == "cellphone") {
     
    179192            }
    180193        }
     194               
    181195       // $from = date("Y-m-d 00:00:00",$from);
    182196       // $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time,tbluser.cellphone as user_cellphone,tblcollaborator.cellphone as collaborator_cellphone, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.id ".$where." AND tbluser.collaborator = ".$data['id']." ".$order." LIMIT " . $data['start'] . ", " . $data['perpage'] . " ";
    183                 if(strlen($data['daterange_start'])>0){
    184                         $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time,tbluser.cellphone as user_cellphone,tblcollaborator.cellphone as collaborator_cellphone, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.cellphone ".$where." AND (tbluser.created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."') AND tblcollaborator.id = ".$data['id']." ".$order." LIMIT " . $data['start'] . ", " . $data['perpage'] . " ";
     197           
     198                if($data['daterange_start']){
     199                       
     200                        if ($data['perpage']){
     201                                $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time,tbluser.cellphone as user_cellphone,tblcollaborator.cellphone as collaborator_cellphone, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.cellphone ".$where." AND (tbluser.created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."') AND tblcollaborator.id = ".$data['id']." ".$order." LIMIT " . $data['start'] . ", " . $data['perpage'] . " ";
     202                        }else{
     203                                $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time,tbluser.cellphone as user_cellphone,tblcollaborator.cellphone as collaborator_cellphone, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.cellphone ".$where." AND (tbluser.created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."') AND tblcollaborator.id = ".$data['id']." ".$order;
     204                        }
    185205                }else{
    186                         $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time,tbluser.cellphone as user_cellphone,tblcollaborator.cellphone as collaborator_cellphone, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.cellphone ".$where." AND tblcollaborator.id = ".$data['id']." ".$order." LIMIT " . $data['start'] . ", " . $data['perpage'] . " ";
     206                        if ($data['perpage']){
     207                                $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time,tbluser.cellphone as user_cellphone,tblcollaborator.cellphone as collaborator_cellphone, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.cellphone ".$where." AND tblcollaborator.id = ".$data['id']." ".$order." LIMIT " . $data['start'] . ", " . $data['perpage'] . " ";
     208                        }else{
     209                                $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time,tbluser.cellphone as user_cellphone,tblcollaborator.cellphone as collaborator_cellphone, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.cellphone ".$where." AND tblcollaborator.id = ".$data['id']." ".$order;
     210                        }
    187211                }
    188212                $result = $this->db->query($sql)->result_array();
     
    454478        }
    455479       
     480        public function createRandomPassword()
     481        {
     482                $alphabet = "0123456789";
     483                $pass = array ();
     484                $alphaLength = strlen ( $alphabet ) - 1;
     485                for($i = 0; $i < 6; $i ++) {
     486                        $n = rand ( 0, $alphaLength );
     487                        $pass [] = $alphabet [$n];
     488                }
     489                return implode ( $pass );
     490        }
    456491}
  • pro-violet-viettel/sourcecode/application/modules/admin/models/user_model.php

    r883 r906  
    2323        function get_list_users($data)
    2424        {
     25               
    2526                $sql="SELECT * FROM ".$this->table_name;
    2627                if ($data['status'] == 1){
     
    3637                        $sql.=" WHERE expire_date < NOW() AND p_id <> 5";
    3738                }
    38                 if (isset($data['keyword']))
    39                 {
     39                //if (isset($data['keyword']))
     40                //{
    4041                        if (strlen($data['keyword'])>0){
    4142                                if ($data['status']==0){
     
    4344                                                if (strlen($data['district'])>0){
    4445                                                        if(strlen($data['daterange_start'])>0){
    45                                                                 $sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
    46                                                         }
    47                                                 }else{
    48                                                         if(strlen($data['daterange_start'])>0){
    49                                                                 $sql.=" WHERE province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     46                                                                $sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     47                                                        }else{
     48                                                                $sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%')";
     49                                                        }
     50                                                }else{
     51                                                        if(strlen($data['daterange_start'])>0){
     52                                                                $sql.=" WHERE province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     53                                                        }else{
     54                                                                $sql.=" WHERE province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%')";
    5055                                                        }
    5156                                                }
    5257                                        }else{
    5358                                                if(strlen($data['daterange_start'])>0){
    54                                                         $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     59                                                        $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
    5560                                                }else
    5661                                                {
    57                                                         $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%')";
     62                                                        $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%')";
    5863                                                }
    5964                                        }
     
    6368                                                if (strlen($data['district'])>0){
    6469                                                        if(strlen($data['daterange_start'])>0){
    65                                                                 $sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
    66                                                         }else{
    67                                                                 $sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') ";
    68                                                         }
    69                                                 }else{
    70                                                         if(strlen($data['daterange_start'])>0){
    71                                                                 $sql.=" AND province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
    72                                                         }else{
    73                                                                 $sql.=" AND province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') ";
     70                                                                $sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     71                                                        }else{
     72                                                                $sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') ";
     73                                                        }
     74                                                }else{
     75                                                        if(strlen($data['daterange_start'])>0){
     76                                                                $sql.=" AND province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     77                                                        }else{
     78                                                                $sql.=" AND province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') ";
    7479                                                        }
    7580                                                }
     
    8085                        {
    8186                                if(strlen($data['daterange_start'])>0){
     87                                       
    8288                                        if ($data['status']==0){
    8389                                                if (strlen($data['province'])>0){
     
    105111                                else{
    106112                                        if ($data['status']==0){
     113                                       
    107114                                                if (strlen($data['province'])>0){
    108115                                                        if (strlen($data['district'])>0){
     
    111118                                                                $sql.=" WHERE province = '".$data['province']."'";
    112119                                                        }
    113                                                 }
    114                                         }else{
     120                                                       
     121                                                }
     122                                        }else{
     123                                                write_file('./log/test.log', date("d-m-Y: H:i:s"). ": ".$sql."\n" , FOPEN_WRITE_CREATE);
    115124                                                if (strlen($data['province'])>0){
    116125                                                        if (strlen($data['district'])>0){
     
    125134                                }
    126135                        }
    127                 }
     136                //}
    128137       
    129138                $order = "";
     
    158167                }
    159168               
    160                 if (isset($data['keyword']))
    161                 {
     169                //if (isset($data['keyword']))
     170                //{
    162171                        if (strlen($data['keyword'])>0){
    163172                                if ($data['status']==0){
     
    165174                                                if (strlen($data['district'])>0){
    166175                                                        if(strlen($data['daterange_start'])>0){
    167                                                         $sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
    168                                                 }
    169                                                 }else{
    170                                                         if(strlen($data['daterange_start'])>0){
    171                                                         $sql.=" WHERE province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
    172                                                 }
     176                                                                $sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     177                                                        }else{
     178                                                                $sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%')";
     179                                                        }
     180                                               
     181                                                }else{
     182                                                        if(strlen($data['daterange_start'])>0){
     183                                                                $sql.=" WHERE province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     184                                                        }else{
     185                                                                $sql.=" WHERE province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%')";
     186                                                        }
     187                                               
    173188                                                }
    174189                                               
    175190                                        }else{
    176191                                                if(strlen($data['daterange_start'])>0){
    177                                                         $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     192                                                        $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
    178193                                                }else
    179194                                                {
    180                                                         $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%')";
     195                                                        $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%')";
    181196                                                }
    182197                                        }
     
    192207                                                }else{
    193208                                                        if(strlen($data['daterange_start'])>0){
    194                                                                 $sql.=" AND province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
    195                                                         }else{
    196                                                                 $sql.=" AND province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') ";
     209                                                                $sql.=" AND province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     210                                                        }else{
     211                                                                $sql.=" AND province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') ";
    197212                                                        }
    198213                                                }
     
    244259                                }
    245260                        }
    246                 }
    247                
     261                //}
     262                //write_file('./log/sql.log', date("d-m-Y: H:i:s"). ": ".$sql."\n" , FOPEN_WRITE_CREATE);
    248263                $query = $this->db->query($sql);
    249264                $row = $query->row_array();
  • pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/index.php

    r690 r906  
    134134            <div class="modal-body">
    135135                <form id="add_user" onsubmit="return false;" class="form-horizontal" role="form">
    136                     <div class="form-group">
    137                         <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Tên đầy đủ </label>
    138 
    139                         <div class="col-sm-9">
    140                             <label class="block clearfix has-error">
    141                             <span class="input-icon">
    142                                 <input name="full_name" type="text" id="form-field-1" placeholder="Tên cộng tác viên">
    143                                 <i class="icon-user blue"></i>
    144                             </span>
    145                             <div id="full_name" class="help-block error"></div>
    146                             </label>
    147                         </div>
    148                         <div class="help-block"> </div>
     136                                         <div class="row">
     137                                                <div class="col-sm-9">
     138                                                        <div class="form-group">
     139                                                                <label for="cellphone" class="col-sm-4 control-label no-padding-right">Số điện thoại</label>
     140                                                                                                                                       
     141                                                                        <div class="col-sm-8">
     142                                                                                <input type="text" name="cellphone" placeholder="Số điện thoại" id="cellphone" class="col-xs-12 col-sm-10">
     143                                                                        </div>
     144                                                                        <label class="block clearfix has-error">       
     145                                                                                <small><div class="col-sm-8 help-block error" id="cellphone"> </div></small>
     146                                                                        </label>
     147                                                        </div>
     148                                                </div>
    149149                    </div>
    150                     <div class="form-group">
    151                         <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Tên đăng nhập </label>
    152 
    153                         <div class="col-sm-9">
    154                             <label class="block clearfix has-error">
    155                             <span class="input-icon">
    156                                 <input name="login_name" type="text" id="form-field-1" placeholder="Tài khoản">
    157                                 <i class="icon-user blue"></i>
    158                             </span>
    159                             <div id="login_name" class="help-block error"></div>
    160                             </label>
    161                         </div>
    162                         <div class="help-block"> </div>
    163                     </div>
    164                     <div class="form-group">
    165                         <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Số điện thoại</label>
    166 
    167                         <div class="col-sm-9">
    168                             <label class="block clearfix has-error">
    169                             <span class="input-icon">
    170                                 <input name="cellphone" type="text" id="form-field-1" placeholder="Số điện thoại">
    171                                 <i class="icon-user blue"></i>
    172                             </span>
    173                             <div id="cellphone" class="help-block error"></div>
    174                             </label>
    175                         </div>
    176                         <div class="help-block"> </div>
    177                     </div>
    178                     <div class="space-4"></div>
    179 
    180                     <div class="form-group">
    181                         <label class="col-sm-3 control-label no-padding-right" for="form-field-2"> Mật khẩu </label>
    182 
    183                         <div class="col-sm-9">
    184                             <label class="block clearfix has-error">
    185                             <span class="input-icon">
    186                                 <input type="password" name="passwd" id="form-field-2" placeholder="Mật khẩu">
    187                                 <i class="icon-lock blue"></i>
    188                             </span>
    189                             <div id="passwd" class="help-block error"></div>
    190                             </label>
    191                         </div>
    192                         <div class="help-block"> </div>
    193                     </div>
    194                     <div class="form-group">
    195                         <label class="col-sm-3 control-label no-padding-right" for="form-field-2"> Mật khẩu </label>
    196 
    197                         <div class="col-sm-9">
    198                             <span class="input-icon">
    199                                 <input type="password" name="passwd2" id="form-field-2" placeholder="Nhập lại mật khẩu">
    200                                 <i class="icon-lock blue"></i>
    201                             </span>
    202                         </div>
    203                         <div class="help-block"> </div>
    204                     </div>
    205                     <div class="form-group">
    206                         <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Kích hoạt</label>
    207 
    208                         <div class="col-sm-9">
    209                             <span class="input-icon">
    210                                 <input type='checkbox' name="activated" checked="checked" value="1"  />
    211                             </span>
    212                         </div>
    213                         <div class="help-block"> </div>
    214                     </div>
    215 
    216                     <div class="space-4"></div>
    217                     <div class="form-group errors" id="add_user"></div>
    218                        
    219                     </div>
     150                                       
    220151                    <div class="clearfix form-actions">
    221152                        <div class="col-md-offset-3 col-md-9">
  • pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/listview.php

    r838 r906  
    11<?php
    2 $admin_info = $this->session->userdata('adminInfo');
    3 $role_id = $admin_info['role_id'];
     2//$admin_info = $this->session->userdata('adminInfo');
     3//$role_id = $admin_info['role_id'];
    44?>
    55<div id="breadcrumbs" class="breadcrumbs">
     
    4545            <div style="padding-bottom:4px" class="table-header">
    4646                Thống kê tài khoản
    47                 <?php if ($role_id == 1): ?>
    48                     <button href="#addUser" data-toggle="modal" class="btn btn-success pull-right">
    49                         <i class="icon-plus"></i>
    50                         Thêm cộng tác viên
    51                     </button>
    52                 <?php endif; ?>
    53 
     47                                <?php if (in_array("editUserInfo", $roles)) { ?>
     48                                        <div class="col-xs-12 pull-right" style="margin:5px;">
     49                                                <div class="form-group">
     50                                                        <!--<input  class="btn btn-primary pull-right " type="button" value="Thêm cộng tác viên" onclick="admin_update_user();"/>-->
     51                                                        <button href="#addUser" data-toggle="modal" class="btn btn-success pull-right">
     52                                                        <i class="icon-plus"></i>
     53                                                                Thêm cộng tác viên
     54                                                        </button>
     55                                                </div>
     56                                        </div>
     57                                <?php } ?>
    5458            </div>
    5559
  • pro-violet-viettel/sourcecode/application/modules/admin/views/reportAsistant/listview_user.php

    r743 r906  
    4444                                <th class="<?php if ($sorting_field == 'full_name') {echo $sorting_order;} else {echo "";}?>" id="full_name" 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">Tên người dùng</th>
    4545                                <th class="<?php if ($sorting_field == 'collaborator_cellphone') {echo $sorting_order;} else {echo "sorting";}?>" id="collaborator_cellphone" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 283px;" aria-label="Họ tên: activate to sort column ascending">Số thuê bao</th>
    46                                 <th class="<?php if ($sorting_field == 'total_user') {echo $sorting_order;} else {echo "sorting";}?>" id="total_user" 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">Ngày giới thiệu</th> 
     46                                <th class="<?php if ($sorting_field == 'user_created_time') {echo $sorting_order;} else {echo "sorting";}?>" id="user_created_time" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 176px;" aria-label="Ngày giới thiệu: activate to sort column ascending">Ngày giới thiệu</th> 
    4747                                <!--<th class="<?php if ($sorting_field == 'collaborator_created_time') {echo $sorting_order;} else {echo "sorting";}?>" id="collaborator_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">Ngày đăng kÜ</th>-->
    4848                                 
  • pro-violet-viettel/sourcecode/application/modules/admin/views/reportprovince/province.php

    r883 r906  
    1010                <div class="pull-right" style="margin:5px;">
    1111                    <!--<a style="color:#fff" href="<?php echo base_url();?>admin/reportprovince/export/<?php echo $month;?>/<?php echo $year;?>">Xuất ra Excel</a>-->
    12                                         <a style="color:#fff" href="<?php echo base_url();?>admin/reportprovince/exportProvince/<?php echo $month;?>/<?php echo $year;?>">Xuất ra Excel</a>
     12                                        <a style="color:#fff" href="<?php echo base_url();?>admin/reportprovince/exportProvince/<?php echo $to_date; ?>/<?php echo $month;?>/<?php echo $year;?>">Xuất ra Excel</a>
    1313                </div>
    1414            </div>
  • pro-violet-viettel/sourcecode/application/modules/admin/views/user/listview.php

    r883 r906  
    4747                                <div class="pull-right" style="margin:5px;">
    4848                   
    49                                         <a style="color:#fff" href="<?php echo base_url();?>admin/user/export/<?php echo $current_page; ?>/<?php echo $perpage; ?>/<?php echo ($keyword)?$keyword:'default'; ?>/<?php echo $status; ?>/<?php echo ($province)?$povince:'default'; ?>/<?php echo ($district)?$district:'default';?>/<?php echo ($daterange)?$daterange:'default'; ?>/<?php echo $sorting_order; ?>/<?php echo $sorting_field;?>">Xuất ra Excel</a>
     49                                        <a style="color:#fff" href="<?php echo base_url();?>admin/user/export/<?php echo $current_page; ?>/<?php echo $perpage; ?>/<?php echo ($keyword)?$keyword:'default'; ?>/<?php echo $status; ?>/<?php echo ($province)?$province:'default'; ?>/<?php echo ($district)?$district:'default';?>/<?php echo ($date_start)?$date_start:'default'; ?>/<?php echo ($date_end)?$date_end:'default'; ?>/<?php echo $sorting_order; ?>/<?php echo $sorting_field;?>">Xuất ra Excel</a>
    5050                                       
    5151                </div>
     
    8383                                                                <div class="dataTables_province" style="float: right;" id="sample-table-2_status"><label>Lọc theo Tỉnh/TP:
    8484                                                                        <select onchange="filter();" name="province" class="form-field-province" size="1" style="width: 176px; height: 28px;">
    85                                                                                 <option value=''></option>
     85                                                                                <option value=''>Tất cả</option>
    8686                                               
    8787                                                                                <?php foreach ($provinces as $key => $pro): ?>
     
    9494                                                                        <select onchange="filter();" name="district" id="form-field-district" class="form-field-district" size="1" style="width: 176px; height: 28px;">
    9595                                                                                <?php if ($districts):?>
    96                                                                                         <option value=''></option>
     96                                                                                        <option value=''>Tất cả</option>
    9797                                                                                        <?php foreach ($districts as $key => $dist): ?>
    9898                                                                                                <option <?php if ($dist['district_id'] == $district) echo "selected"; ?> value="<?php echo $dist['district_id']; ?>"><?php echo $dist['district_name']; ?></option>
Note: See TracChangeset for help on using the changeset viewer.