[ Mini Kiebo ]
Server: Windows NT AKFAR_SERVER 10.0 build 26200 (Windows 10) AMD64
Path:
D:
/
BACKUP C 19-12
/
XAMPP74
/
htdocs
/
simaku
/
application
/
controllers
/
[
Home
]
File: Perpus.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Perpus extends CI_Controller { function __construct (){ parent::__construct(); $this->load->model('Minfo','', TRUE); $this->load->model('Makad','', TRUE); $this->load->model('Munit','', TRUE); $this->load->model('Mpeg','', TRUE); $this->load->model('Mkrs','', TRUE); $this->load->model('Mmhs','', TRUE); } public function index() { $q = $this->Minfo->info()->row(); $data['title'] = 'Admin Perpustakaan'; $data['namapt'] = ! empty ($q->namapt) ? $q->namapt : 'SUPRA'; $data['logo'] = ! empty ($q->logo) ? $q->logo : 'logo_supra'; //$data['main_view'] = 'perpus/home'; //$data['main_view'] = 'perpus/home_b3'; $data['main_view'] = 'perpus/home_b4'; //$data['q'] = $this->Makad->show(); $q1 = $this->Munit->daftar_unit_kerja_selain_yayasan(); foreach($q1->result() as $key ){ $data['opsi_prodi'][$key->id_unit] = $key->nama; } //$this->load->view('akad/beranda',$data); $this->load->view('perpus/beranda_b3',$data); } function tambah(){ $tambah = array( 'kode' => $this->input->post('kodebuku'), 'judul' => $this->input->post('judulbuku'), 'penulis' => $this->input->post('penulis'), 'penerbit' => $this->input->post('penerbit'), 'tahun' => $this->input->post('thterbit'), 'lokasi' => $this->input->post('lokasi'), ); $this->Mperpus->add($tambah); redirect('perpus'); } function edit($id){ $edit= array( 'kode' => $this->input->post('kodebuku'), 'judul' => $this->input->post('judulbuku'), 'penulis' => $this->input->post('penulis'), 'penerbit' => $this->input->post('penerbit'), 'tahun' => $this->input->post('thterbit'), 'lokasi' => $this->input->post('lokasi'), ); $this->Mperpus->update($id,$edit); redirect('perpus'); } function do_upload() { //$this->upload_path = base_url().'public/upload/'; $file = $_SERVER['DOCUMENT_ROOT']."/g5umt/public/upload/" ; $config['upload_path'] = $file; //$config['upload_path'] = $this->upload_path; $config['allowed_types'] = 'xls'; $config['max_size'] = '1000'; $this->load->library('upload', $config); if ( ! $this->upload->do_upload()) { $error = array('error' => $this->upload->display_errors()); echo $error ; echo ' Gagal disimpan di '.$file; } else { $upload_data = $this->upload->data(); //echo "<h3>Your file was successfully uploaded!</h3>" ; /*echo "<ul>" ; foreach($upload_data as $item => $value) { echo '<li>',$item,' : ',$value,'</li>'; } echo "</ul>" ; echo "<p>== Data read file excel ==================================== //</p>" ; */ // Load the spreadsheet reader library $this->load->library('excel_reader'); // Set output Encoding. $this->excel_reader->setOutputEncoding('CP1251'); $file = $file.$upload_data['file_name'] ; $this->excel_reader->read($file); error_reporting(E_ALL ^ E_NOTICE); // Sheet 1 $data = $this->excel_reader->sheets[0]; //$i=2 --> no header, otherwise $i=1 --> user header column for ($i = 2; $i <= $data['numRows']; $i++) { //for ($j = 1; $j <= $data['numCols']; $j++) { $akad= array('kode' => $data['cells'][$i][1], 'nama_mk' => trim($data['cells'][$i][2]), 'pengampu' => trim($data['cells'][$i][3]) ); // Proses penyimpanan data di table kelas $this->Makad->add($akad); //} //echo "<br />"; } $this->session->set_flashdata('message', 'File berhasil disimpan di '.$file); } redirect ('akad'); } function hapus($id){ $this->Mperpus->delete($id); $this->session->set_flashdata('pesan','<div class="alert alert-danger"> Data buku sudah terhapus.</div>'); redirect('perpus'); } function cetak_form_absensi($id_mk){ $data['mhs'] = $this->Mkrs->get_mhs_by_idmk($id_mk); $data['matkul'] = $this->Makad->get_mk($id_mk); $this->load->view('akad/form_absensi_html',$data); } function prodi(){ $id = $this->input->post('prodi'); $q = $id; } }