Example #1
0
 public function get_current_ipk($pb)
 {
     $sql = "SELECT SEM_NIL_PB as SEM_NIL_PB, IPK_NIL_PB as IPK_NIL_PB FROM " . $this->_tb_nilai . " WHERE KD_PB=" . $pb->get_kd_pb();
     $sql .= " AND SEM_NIL_PB=(SELECT MAX(SEM_NIL_PB) FROM " . $this->_tb_nilai . " WHERE KD_PB=" . $pb->get_kd_pb() . ")";
     //        echo $sql."</br>";
     $result = $this->_db->select($sql);
     $nilai = new Nilai($this->registry);
     foreach ($result as $v) {
         $nilai->set_kode($v['KD_NIL_PB']);
         $nilai->set_pb($v['KD_PB']);
         $nilai->set_ips($v['IPS_NIL_PB']);
         $nilai->set_ipk($v['IPK_NIL_PB']);
         $nilai->set_semester($v['SEM_NIL_PB']);
     }
     return $nilai;
 }
 public function add_nilai()
 {
     $kd_pb = $_POST['kd_pb'];
     $ips = $_POST['ips'];
     $ipk = $_POST['ipk'];
     $sem = $_POST['semester'];
     $pb = new Penerima($this->registry);
     $pb->set_kd_pb($kd_pb);
     $d_pb = $pb->get_penerima_by_id($pb, $this->kd_user);
     //        echo "penerima";
     /*
      * upload file
      */
     //        $upload = new Upload();
     $this->registry->upload->init('sfile');
     $this->registry->upload->setDirTo('files/transkrip/');
     $nm_file = array('TRANSKRIP', $d_pb->get_nip(), $sem);
     $this->registry->upload->changeFileName($this->registry->upload->getFileName(), $nm_file);
     $file = $this->registry->upload->getFileTo();
     $this->registry->upload->uploadFile();
     /*
      * rekam nilai di tabel d_nil
      */
     $nilai = new Nilai($this->registry);
     $nilai->set_pb($kd_pb);
     $nilai->set_ips($ips);
     $nilai->set_ipk($ipk);
     $nilai->set_semester($sem);
     $nilai->set_file($file);
     $nilai->add_nilai();
 }