public function remove($id) { try { $this->_db->beginTransaction(); $data = $this->select('SELECT id_pegawai FROM ' . $this->_table . ' WHERE role=1'); if (count($data) == 0) { return; } $pic = $data[0]['id_pegawai']; //ubah pic assesment ke pic admin yg ada $asses = new Assesment($this->registry); $asses->select('UPDATE assesment SET pic=' . $pic . ' WHERE 1'); $this->_db->commit(); } catch (PDOException $ex) { //Something went wrong rollback! $db->rollBack(); echo $ex->getMessage(); } $this->_db->delete($this->_table, 'id=' . $id); }
public function ubahTesAsses($id) { $asses = new Assesment($this->registry); $jenis_tes = new JenisTes($this->registry); $metode = new MetodePenilaian($this->registry); $this->view->metode = $metode->get(); $this->view->data_asses = $asses->get(); $this->view->data_jenis_tes = $jenis_tes->get(); $tesa = new TesAssesment($this->registry); $data = $tesa->get($id); $this->view->data = array('id' => $data[0]['id'], 'assesment' => $data[0]['id_assesment'], 'jenis' => $data[0]['id_jenis_tes'], 'pass_grade' => $data[0]['pass_grade'], 'bobot' => $data[0]['bobot'], 'metode' => $data[0]['metode']); $this->view->judul = 'Ubah Jenis Tes Assesment'; if (isset($_POST['submit_e'])) { $id = $_POST['id']; $assesment = $_POST['assesment']; $jenis = $_POST['jenis']; $pass_grade = $_POST['pass_grade']; $metode = $_POST['metode']; $bobot = $_POST['bobot']; if ($assesment == 0) { $this->view->add_error('assesment', 'kolom assesment harus dipilih!'); } if ($jenis == 0) { $this->view->add_error('jenis', 'kolom jenis tes harus dipilih!'); } if ($tesa->is_exist($assesment, $jenis, $id)) { $this->view->add_error('jenis', 'data tes ini sudah ada di database!'); } if ($pass_grade == '') { $this->view->add_error('pass_grade', 'kolom passing grade harus diisi!'); } if (!is_numeric($pass_grade)) { $this->view->add_error('pass_grade', 'kolom passing grade harus angka atau desimal!'); } if ($metode == 0) { $this->view->add_error('metode', 'kolom metode penilaian harus dipilih!'); } if ($bobot == '') { $this->view->add_error('bobot', 'kolom passing grade harus diisi!'); } if (!is_numeric($bobot)) { $this->view->add_error('bobot', 'kolom passing grade harus angka !'); } if (!$this->view->is_error()) { $data = array('id_assesment' => $assesment, 'id_jenis_tes' => $jenis, 'pass_grade' => $pass_grade, 'bobot' => $bobot, 'metode' => $metode); $tesa = new TesAssesment($this->registry); $tesa->edit($id, $data); $this->view->add_success('success', 'ubah data jenis tes assesment berhasil!'); } $this->view->data = array('id' => $id, 'assesment' => $assesment, 'jenis' => $jenis, 'pass_grade' => $pass_grade, 'bobot' => $bobot, 'metode' => $metode); } $this->view->aksi = 'update'; $this->view->render('admin/tes_asses'); }
public function laporan($id_asses) { $assesment = new Assesment($this->registry); $data = $assesment->get($id_asses); $this->view->data_asses = $data; $tesasses = new TesAssesment($this->registry); $data = $tesasses->get_join($id_asses); $this->view->data_jenis_tes_asses = $data; $this->view->jumlah_jenis_tes_asses = count($data); $nilaites = new NilaiTes($this->registry); $data = $nilaites->get_nilai_assesment($id_asses); //var_dump($data); $this->view->data = $data; $this->view->jumlah_data = count($data); $this->view->aksi = 'report'; $this->view->render('assesment/laporan'); }