Ejemplo n.º 1
0
 public function rekamPeserta($id)
 {
     $assesment = new Assesment($this->registry);
     $data = $assesment->get($id);
     $pegawai = new Pegawai($this->registry);
     $this->view->pegawai_for_peserta = $pegawai->get_for_peserta($data[0]['eselon']);
     //var_dump($this->view->pegawai_for_peserta);
     $this->view->pegawai_sijon = $pegawai->pegawai_to_json($data[0]['eselon'], 'peserta');
     $peserta = new Peserta($this->registry);
     if (isset($_POST['submit_a'])) {
         foreach (${$_POST}['peserta'] as $key => $value) {
             if ($peserta->is_exist('id_pegawai', $value)) {
                 $this->view->add_error('peserta', 'cek kembali! ada yang telah terekam');
             }
         }
         if (!$this->view->is_error()) {
             foreach ($_POST['peserta'] as $key => $value) {
                 $data = array('id_pegawai' => $value, 'id_assesment' => $id);
                 $peserta->add($data);
             }
         }
         header('location:' . URL . 'assesment/peserta/' . $id);
     }
     $this->view->id_asses = $id;
     $this->view->aksi = 'add';
     $this->view->render('assesment/peserta');
 }