<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/**
 * Lecture Class
 * 
 * @author dzungnv02
 *
 */
class Lecture extends MX_Controller {

    public function __construct() {
        parent::__construct();
    }

    public function index() {
        $this->load->model('User_model');
        $user_info = $this->session->userdata('userInfo');
        
        $aryParams = array();
        parse_str($user_info['user'], $aryParams);
        
        $licenseAvailable = $this->User_model->checkLicense($aryParams['id']);
        $licenseAvailable = $licenseAvailable == TRUE ? 'OK' : '!OK';
        
        if ($user_info) {
            $username = $user_info['username'];    
            $first_visit=0;
            if (!$this->session->userdata('first_visit'))
            {
               $this->session->set_userdata('first_visit','1');
               $first_visit=1;
            }
          $this->load->view('lecture_editor', array('username' => $username, 'licenseAvailable' => $licenseAvailable, 'first_visit' => $first_visit, 'licflashVars' => $aryParams));
        } else {
            redirect('/frontend/home/');
        }
    }

}

/* End of file home.php */
/* Location: ./application/modules/frontend/controllers/Lecture.php */