source: pro-violet-viettel/www/deploy/20150304/application/modules/frontend/controllers/lecture.php

Last change on this file was 828, checked in by quyenla, 10 years ago

preview

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            $fileid="";
57            if ($this->input->post('fileid'))
58            {
59               $fileid=$this->input->post('fileid');
60            }
61            $isOverDate = strtotime($u['expire_date']) < strtotime(date('Y-m-d')) ? 0:1;
62 
63            $this->load->view('lecture_editor', array('fileid'=>$fileid,'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_')));
64        } else {
65            redirect('/frontend/home/');
66        }
67    }
68
69}
70
71/* End of file home.php */
72/* Location: ./application/modules/frontend/controllers/Lecture.php */
Note: See TracBrowser for help on using the repository browser.