source: pro-violet-viettel/sourcecode/application/modules/frontend/controllers/lecture.php @ 717

Last change on this file since 717 was 717, checked in by namnd, 10 years ago
File size: 2.3 KB
RevLine 
[553]1<?php
2
3if (!defined('BASEPATH'))
4    exit('No direct script access allowed');
5
[313]6/**
7 * Lecture Class
8 *
9 * @author dzungnv02
10 *
11 */
[553]12class Lecture extends MX_Controller {
[313]13
[553]14    public function __construct() {
15        parent::__construct();
[717]16                $this->load->helper('language');
17                $this->lang->load('messages', 'message');
[553]18    }
[313]19
[553]20    public function index() {
21        $this->load->model('User_model');
22        $user_info = $this->session->userdata('userInfo');
[565]23       
[553]24        $aryParams = array();
25        parse_str($user_info['user'], $aryParams);
[565]26       
[670]27        $licenseAvailable = isset($aryParams['id']) ? $this->User_model->checkLicense($aryParams['id']) : FALSE;
[553]28        $licenseAvailable = $licenseAvailable == TRUE ? 'OK' : '!OK';
[657]29 
[553]30        if ($user_info) {
31            $username = $user_info['username'];   
32            $first_visit=0;
[580]33            $update_user_info=0;
34            parse_str($user_info['user'], $info);
35            $this->load->model('user_model');
36            $user = $user_info['user'];
37            $us_id = $user_info['us_id'];
[670]38            $u = $this->user_model->get_user_by_id($us_id);
39           
40            $info['fullname'] = isset($info['fullname']) ? $info['fullname'] : '';
41           
42            if ($info['fullname'] == '' && $u['p_id'] != '')
[580]43            {
44                $update_user_info=1;
45            }
[717]46                       
47                        if ($u['province'] == '' && $u['p_id'] != ''){
48                                $update_user_info=1;
49                        }
[670]50           
[553]51            if (!$this->session->userdata('first_visit'))
52            {
53               $this->session->set_userdata('first_visit','1');
54               $first_visit=1;
55            }
[665]56 
[717]57          $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,"p_period"=>$u['p_period'],"expire_date"=>date("d-m-Y", strtotime($u['expire_date'])), "fullname"=>$info['fullname'], "school"=>$info['school'], "province"=>$u['province'], "provinces"=>lang('_PROVINCES_')));
[553]58        } else {
59            redirect('/frontend/home/');
60        }
61    }
[326]62
[313]63}
64
65/* End of file home.php */
66/* Location: ./application/modules/frontend/controllers/Lecture.php */
Note: See TracBrowser for help on using the repository browser.