Ignore:
Timestamp:
Nov 20, 2014 11:09:07 AM (10 years ago)
Author:
quyenla
Message:

bug

Location:
pro-violet-viettel/sourcecode/application/modules/frontend/controllers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/modules/frontend/controllers/lecture.php

    r565 r580  
    2929            $username = $user_info['username'];   
    3030            $first_visit=0;
     31            $update_user_info=0;
     32            parse_str($user_info['user'], $info);
     33            $this->load->model('user_model');
     34            $user = $user_info['user'];
     35            $us_id = $user_info['us_id'];
     36            $u = $this->user_model->get_user_by_id($us_id);
     37            if (($info['fullname']=="")&&($u['p_id']!=""))
     38            {
     39                $update_user_info=1;
     40            }
    3141            if (!$this->session->userdata('first_visit'))
    3242            {
     
    3444               $first_visit=1;
    3545            }
    36           $this->load->view('lecture_editor', array('username' => $username, 'licenseAvailable' => $licenseAvailable, 'first_visit' => $first_visit, 'licflashVars' => $aryParams));
     46          $this->load->view('lecture_editor', array('username' => $username, 'licenseAvailable' => $licenseAvailable, 'first_visit' => $first_visit, 'licflashVars' => $aryParams,'update_user_info'=>$update_user_info,'us_id'=>$us_id));
    3747        } else {
    3848            redirect('/frontend/home/');
  • pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php

    r574 r580  
    2727            $data['packages'] = $this->servicepackage_model->getAllPackages();
    2828            $data['is_viettel'] = $user_info['is_viettel'];
    29                         //$paidlogs = $this->user_model->getPaidlog($us_id);
    30                        
    31                         //$data['paidlogs'] = $paidlogs;
    32             parse_str($user, $info);
     29           
    3330            $data = array_merge($data, $u);
    3431            $data = array_merge($data, $user_info);
     
    5855                $result['can_buy'] = 0;
    5956            }
     57           
    6058            if ($user['p_id'] < 1) {
     59                $result['can_edit'] = 1;
     60            }
     61            if ($info['fullname']=="")
     62            {
    6163                $result['can_edit'] = 1;
    6264            }
     
    198200        }
    199201    }
    200 
     202public function update_info() {
     203        $result['success']=0;
     204        $user_info = $this->session->userdata('userInfo');
     205        if ($user_info) {
     206            $us_id = $user_info['us_id'];
     207            $result = array();
     208            $result['success'] = 0;
     209            $src = "SBG";
     210            $token = md5($us_id . self::TOKENPW);
     211            $user = $this->get_data($src, $token, $us_id);
     212            $input = $this->input->post();
     213            parse_str($user_info['user'], $info);
     214            if ($input) {
     215                if (strlen($input['fullname']) == 0) {
     216                    $result['errors'][] = array("content"=>"Họ tên khÃŽng được để trống!","field"=>"fullname");
     217                }
     218                if (strlen($input['school']) == 0) {
     219                    $result['errors'][] = array("content"=>"Tên đơn vị khÃŽng được để trống!","field"=>"school");
     220                }
     221
     222                $input['password'] = '';
     223                $input['oldpass'] = '';
     224                $input['province'] = '';
     225                $this->load->model('user_model');
     226                if (!isset($result['errors'])) {
     227                    $result['data'] = $this->user_model->update_user($src, $token, $input, $us_id);
     228                    $result['success'] = 1;
     229                    $info['fullname']=$input['fullname'];
     230                    $info['school']=$input['school'];
     231                    $info = urldecode(http_build_query($info));
     232                    $userdata = array('username' => $user_info['username'], 'user' => $info, 'us_id' => $user_info['us_id'], 'logined_in' => TRUE, 'is_viettel' => $user_info['is_viettel']);
     233                    $this->session->set_userdata('userInfo', $userdata);
     234                }
     235                echo json_encode($result);
     236            }
     237        } else {
     238            redirect('frontend/home');
     239        }
     240    }
    201241    public function update_user() {
    202242        $us_id = $this->uri->segment(4);
Note: See TracChangeset for help on using the changeset viewer.