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

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