Ignore:
Timestamp:
Nov 18, 2014 5:32:42 PM (11 years ago)
Author:
dungnv
Message:
 
File:
1 edited

Legend:

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

    r552 r564  
    1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
     1<?php
    22
    3 class User extends MX_Controller
    4 {
    5 
     3if (! defined ( 'BASEPATH' ))
     4        exit ( 'No direct script access allowed' );
     5class User extends MX_Controller {
    66        const TOKENPW = 'violet';
    7 
    87        public function __construct() {
    9                 parent::__construct();         
     8                parent::__construct ();
    109        }
    11        
    12         public function login($return_type = 'xml')
    13         {
    14                 $user_info = $this->session->userdata('userInfo');
    15                 if ($user_info)
    16                 {
    17                         $user = $user_info['user'];
    18                         $data['content'] = $this->get_data($user);
    19                         if ($return_type == "xml"){
    20                                 $this->load->view('user', $data);
     10        public function login($return_type = 'xml') {
     11                $user_info = $this->session->userdata ( 'userInfo' );
     12                if ($user_info) {
     13                        $user = $user_info ['user'];
     14                        $data ['content'] = $this->get_data ( $user );
     15                        if ($return_type == "xml") {
     16                                $this->load->view ( 'user', $data );
    2117                        }
    22                 }else
    23                 {
    24                         redirect('/frontend/home');
     18                } else {
     19                        redirect ( '/frontend/home' );
    2520                }
    2621        }
    27        
    28         private function get_data($user)
    29         {
    30                 $this->load->model('us_model');
    31                 $aryParams = array();
    32                 parse_str($user, $aryParams);
    33                 $us = $this->us_model->search_by_id($aryParams['id']);
    34                 return array("userId" => $aryParams['id'], "userLevel" => 1, "userPhone" => $aryParams['phone'], "userMoney" =>$us['acc_balanced'], "appUserName" => $aryParams['fullname'], "appAddress" => $aryParams['school'], "licType" => "SBG", "licCustomer" => $aryParams['username'], "licCreate" => $us['created_time'], "licExpire" => $us['expire_date']);
     22        private function get_data($user) {
     23                $this->load->model ( 'us_model' );
     24                $aryParams = array ();
     25                parse_str ( $user, $aryParams );
     26                $us = $this->us_model->search_by_id ( $aryParams ['id'] );
     27                return array (
     28                                "userId" => $aryParams ['id'],
     29                                "userLevel" => 1,
     30                                "userPhone" => $aryParams ['phone'],
     31                                "userMoney" => $us ['acc_balanced'],
     32                                "appUserName" => $aryParams ['fullname'],
     33                                "appAddress" => $aryParams ['school'],
     34                                "licType" => "SBG",
     35                                "licCustomer" => $aryParams ['username'],
     36                                "licCreate" => $us ['created_time'],
     37                                "licExpire" => $us ['expire_date']
     38                );
    3539        }
    3640}
Note: See TracChangeset for help on using the changeset viewer.