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

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