예제 #1
0
 function index()
 {
     if (is_login()) {
         redirect('welcome');
     }
     if ($this->form_validation->run('login') == TRUE) {
         $email = $this->input->post('email', TRUE);
         $password = md5($this->input->post('password', TRUE));
         $get_login = $this->login_model->retrieve(null, $email, $password);
         if (empty($get_login)) {
             $this->session->set_flashdata('login', get_alert('warning', 'Maaf akun tidak ditemukan.'));
             redirect('login');
         } else {
             # cari user yang login
             if (!empty($get_login['pengajar_id'])) {
                 $user = $this->pengajar_model->retrieve($get_login['pengajar_id']);
                 $user_type = empty($get_login['is_admin']) ? 'pengajar' : 'admin';
             } elseif (!empty($get_login['siswa_id'])) {
                 $user = $this->siswa_model->retrieve($get_login['siswa_id']);
                 $user_type = 'siswa';
             }
             # cek jika user berstatus tidak aktif
             if ($user['status_id'] != 1) {
                 $this->session->set_flashdata('login', get_alert('warning', 'Maaf status anda tidak aktif.'));
                 redirect('login');
             }
             $data_session['login_' . APP_PREFIX][$user_type] = array('login' => $get_login, 'user' => $user);
             $this->session->set_userdata($data_session);
             create_sess_kcfinder($get_login['id']);
             redirect('welcome');
         }
     }
     $this->twig->display('login.html');
 }
예제 #2
0
 function __construct()
 {
     parent::__construct();
     date_default_timezone_set($this->default_timezone);
     # load helper
     $this->load->helper(array('url', 'form', 'text', 'elearning', 'security', 'file', 'number', 'date', 'download', 'plugins'));
     try {
         $success = install_success();
         if (!$success) {
             redirect('setup');
         }
     } catch (Exception $e) {
         redirect('setup');
     }
     $this->load->database();
     # load library
     $this->load->library(array('session', 'form_validation', 'pager', 'parser', 'image_lib', 'upload', 'twig', 'user_agent', 'email'));
     # load saja semua model
     $this->load->model(array('config_model', 'kelas_model', 'login_model', 'mapel_model', 'materi_model', 'pengajar_model', 'siswa_model', 'tugas_model', 'msg_model', 'pengumuman_model', 'komentar_model'));
     # delimiters form validation
     $this->form_validation->set_error_delimiters('<span class="text-error"><i class="icon-info-sign"></i> ', '</span>');
     if (is_login()) {
         # cek session kcfindernya ada atau tidak
         if (empty($_SESSION['E-LEARNING']['KCFINDER'])) {
             create_sess_kcfinder(get_sess_data('login', 'id'));
         }
     }
     if (is_siswa()) {
         # jika kelas aktifnya kosong, sebaiknya di die jasa
         $kelas_aktif = $this->kelas_model->retrieve_siswa(null, array('siswa_id' => get_sess_data('user', 'id'), 'aktif' => 1));
         if (empty($kelas_aktif)) {
             exit('Kelas aktif anda tidak ditemukan, segera hubungi admin e-learning.');
         }
         $this->siswa_kelas_aktif = $kelas_aktif;
         # cek sedang ujian tidak
         $this->cek_mode_ujian();
     }
     $this->update_link = 'http://www.dokumenary.net/category/new-elearning/feed/';
     $this->portal_update_link = 'http://www.dokumenary.net/category/new-elearning/';
     $this->bug_tracker_link = 'http://www.dokumenary.net/category/bug-tracker-new-elearning/';
     // $this->output->enable_profiler(TRUE);
     # cek versi
     $versi_install = '1.6';
     $versi = get_pengaturan('versi', 'value');
     if ($versi < $versi_install) {
         $this->config_model->update('versi', 'Versi', $versi_install);
     }
 }
예제 #3
0
 function index()
 {
     if (is_login()) {
         redirect('welcome');
     }
     if ($this->form_validation->run('login') == TRUE) {
         $email = $this->input->post('email', TRUE);
         $password = md5($this->input->post('password', TRUE));
         $get_login = $this->login_model->retrieve(null, $email, $password);
         if (empty($get_login)) {
             $this->session->set_flashdata('login', get_alert('warning', 'Maaf akun tidak ditemukan.'));
             redirect('login');
         } else {
             # cari user yang login
             if (!empty($get_login['pengajar_id'])) {
                 $user = $this->pengajar_model->retrieve($get_login['pengajar_id']);
                 $user_type = empty($get_login['is_admin']) ? 'pengajar' : 'admin';
             } elseif (!empty($get_login['siswa_id'])) {
                 $user = $this->siswa_model->retrieve($get_login['siswa_id']);
                 $user_type = 'siswa';
             }
             # cek jika user berstatus tidak aktif
             if ($user['status_id'] != 1) {
                 $this->session->set_flashdata('login', get_alert('warning', 'Maaf status anda tidak aktif.'));
                 redirect('login');
             }
             $data_session['login_' . APP_PREFIX][$user_type] = array('login' => $get_login, 'user' => $user);
             $this->session->set_userdata($data_session);
             create_sess_kcfinder($get_login['id']);
             redirect('welcome');
         }
     }
     $data['sliders'] = $this->config_model->get_all_slider_img();
     if (!empty($data['sliders'])) {
         # panggil colorbox
         $html_js = load_comp_js(array(base_url('assets/comp/nivoslider/jquery.nivo.slider.pack.js'), base_url('assets/comp/nivoslider/setup.js')));
         $data['comp_js'] = $html_js;
         $data['comp_css'] = load_comp_css(array(base_url('assets/comp/nivoslider/nivo-slider.css'), base_url('assets/comp/nivoslider/themes/light/light.css')));
     }
     $this->twig->display('login.html', $data);
 }