예제 #1
0
 public function display($template, $data = array())
 {
     # merge array data dengan default data
     $data = default_parser_item($data);
     $template = $this->_twig->loadTemplate($template);
     $this->CI->output->set_output($template->render($data));
 }
예제 #2
0
 function index()
 {
     if ($this->form_validation->run() == FALSE) {
         $data = array('web_title' => 'Setup E-Learning System', 'form_open' => form_open('setup', array('autocomplete' => 'off', 'class' => 'form-vertical')), 'form_close' => form_close(), 'info' => 'Selamat datang di <b>Learning Content Management System (LMS)</b>. 
                             <br>Lengkapi bebarapa informasi pada form di bawah untuk memulai menggunakan LMS ini:');
         $data = array_merge(default_parser_item(), $data);
         $this->parser->parse('setup', $data);
     } else {
         $nama_sekolah = $this->input->post('nama', TRUE);
         $alamat = $this->input->post('alamat', TRUE);
         $email = $this->input->post('email', TRUE);
         $password = $this->input->post('password', TRUE);
         //insert config
         $this->config_model->create_update($nama_sekolah, $alamat);
         //insert pengajar sebagai admin
         $pengajar_id = $this->pengajar_model->create($nip = null, $nama = 'Administrator', $jenis_kelamin = 'Laki-laki', $tempat_lahir = '', $tgl_lahir = null, $alamat = '', $foto = null, $status_id = 1);
         //insert login
         $this->login_model->create($email, $password, null, $pengajar_id, 1);
         //redirect ke admin
         redirect('admin/login');
     }
 }
예제 #3
0
 function kelas($act = 'list', $id = '')
 {
     $this->must_login();
     $data = array('web_title' => 'Manajemen Kelas | Administrator', 'module_title' => 'Manajemen Kelas', 'comp_css' => load_comp_css(array(base_url('assets/comp/nestedSortable/nestedSortable.css'))), 'comp_js' => load_comp_js(array(base_url('assets/comp/nestedSortable/jquery.mjs.nestedSortable.js'), base_url('assets/comp/nestedSortable/kelas.js'))));
     switch ($act) {
         case 'edit':
             $content_file = 'admin_kelas/edit.html';
             $id = (int) $id;
             $kelas = $this->kelas_model->retrieve($id, true);
             if (empty($kelas)) {
                 redirect('admin/kelas');
             }
             $data['kelas'] = $kelas;
             if ($this->form_validation->run('admin/kelas/edit') == TRUE) {
                 $nama = $this->input->post('nama', TRUE);
                 if (empty($kelas['parent_id'])) {
                     $aktif = 1;
                 } else {
                     $aktif = $this->input->post('status', TRUE);
                     if (empty($aktif)) {
                         $aktif = 0;
                     }
                 }
                 //update kelas
                 $this->kelas_model->update($id, $nama, $kelas['parent_id'], $kelas['urutan'], $aktif);
                 $this->session->set_flashdata('kelas', get_alert('success', $kelas['nama'] . ' berhasil di perbaharui'));
                 redirect('admin/kelas');
             }
             break;
         default:
         case 'list':
             $content_file = 'admin_kelas/add.html';
             if ($this->form_validation->run() == TRUE) {
                 //insert kelas
                 $nama = $this->input->post('nama', TRUE);
                 $this->kelas_model->create($nama);
                 $this->session->set_flashdata('kelas', get_alert('success', 'Kelas berhasil di tambah'));
                 redirect('admin/kelas');
             }
             break;
     }
     $str_kelas = '';
     $this->kelas_hirarki($str_kelas);
     $data['kelas_hirarki'] = $str_kelas;
     $data = array_merge(default_parser_item(), $data);
     $this->twig->display($content_file, $data);
 }