function add() { if (isset($_POST['j_action']) && $_POST['j_action'] == 'add_absen') { $f['tanggal'] = parseFormTgl('tanggal'); $f['tahun'] = $this->absensi->get_ta_aktif(); $f['smt'] = $this->absensi->get_sem_aktif(); for ($i = 0; $i < sizeof($_POST['nis']); $i++) { $f['nis'] = $_POST['nis'][$i]; $f['absen'] = $_POST['status'][$i]; $this->db->insert('absensi', $f); } } }
function data($id = '') { $this->form_validation->set_rules('db_NAMA', 'Nama', 'required'); $this->form_validation->set_rules('db_NIS', 'NIS', 'required'); $this->form_validation->set_rules('db_TMPLHR', 'Tempat Lahir', 'required'); $this->form_validation->set_rules('db_ALAMAT', 'Alamat', 'required'); $this->form_validation->set_rules('db_NOHP1', 'No. Telp', 'required'); if ($this->form_validation->run() === FALSE) { if (isset($id) && trim($id) !== '') { $this->data['row'] = $this->siswa->get_detail_siswa($id); } $this->data['agama'] = $this->referensi_model->get_data_ref('agama'); $this->data['jabatan'] = $this->referensi_model->get_data_ref('jabatan'); $this->data['jk'] = $this->referensi_model->get_data_ref('jk'); $this->LoadView('siswa/form', $this->data); } else { if (isset($_POST['j_action']) and $_POST['j_action'] !== '') { if ($_POST['j_action'] == 'update_param' and trim($id) !== '') { $d = parseForm($_POST); $d['TGLLHR'] = parseFormTgl('tgllhr'); $this->db->update('siswa', $d, array('NIS' => $_POST['id_param'])); $this->data['msg'] = setMessage('update', 'siswa'); $this->LoadView('template/msg', $this->data); } else { $d = parseForm($_POST); $d['TGLLHR'] = parseFormTgl('tgllhr'); $this->db->insert('siswa', $d); $this->data['msg'] = setMessage('insert', 'siswa'); $this->LoadView('template/msg', $this->data); } } } }