public function loadModel($id)
 {
     $model = Peserta::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #2
0
 /**
  * Authenticates user dengan menggunakan user model (Admin.php)
  */
 public function authenticate()
 {
     /* find data dengan atribut username
      * menggunakan model Admin */
     $user = Peserta::model()->findByAttributes(array('username' => $this->username));
     $status = Peserta::model()->findByAttributes(array('status_peserta' => '1', 'username' => $this->username));
     /* jika user hasilnya null maka
      * kasih error invalid username */
     if ($user === null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
         /* jika tidak null */
     } else {
         if ($status != null) {
             $this->errorCode = self::ERROR_USERNAME_INVALID;
         } else {
             /* cek jika password yang ada didalam database
              * tidak sama dengan password yang dienkrip maka
              * kasih error password invalid */
             if ($user->password !== $user->encrypt($this->password)) {
                 $this->errorCode = self::ERROR_PASSWORD_INVALID;
                 /* jika sama password_database==password_enkrip */
             } else {
                 /* jika password yang dienkrip sama dengan
                  * yang ada di dalam database maka */
                 /* ambil data user id dan
                  * ditampung oleh variable _id */
                 $this->_id = $user->ID_PESERTA;
                 /* set state username agar dapat ditampilkan
                  * sebagai data user yang login
                  */
                 $this->setState('username', $user->username);
                 $this->setState('password', $user->password);
                 $this->setState('pesertaLogin', TRUE);
                 /* kasih error none pada variable errorCode */
                 $this->errorCode = self::ERROR_NONE;
             }
         }
     }
     /* kembalikan bukan error code */
     return !$this->errorCode;
 }
Exemple #3
0
            <th>
                Alasan
            </th>
            </tr>
            </thead>
            <h1>Daftar Peserta</h1>
            <tbody>

                <?php for ($i = 0; $i < count($absensi); $i++) {; ?>
                    <tr>
                        <td>

                            <?php 

                            $id_peserta = $absensi[$i]['id_peserta'];
                            $peserta = Peserta::model()->findByPk($id_peserta);
                            print_r($peserta['nomor_peserta']); ?>
                        </td>

                        <td>
                            <?php
                            print_r($peserta['nama']);
                            ?>
                        </td>
                        <td >
                            <?php 
                            $status= Status::model()->findByPk($absensi[$i]['id_status']);
                            ?>
                            <?php echo $status->keterangan; ?>
                        </td>
 public function hapusPeserta($id_asses, $id_pegawai)
 {
     $peserta = new Peserta($this->registry);
     $peserta->remove($id_pegawai);
     header('location:' . URL . 'assesment/peserta/' . $id_asses);
 }
Exemple #5
0
 public function get_nilai_assesment($id_asses)
 {
     $return = array();
     // TODO
     // dapatkan peserta
     $peserta = new Peserta($this->registry);
     $data = $peserta->get_peserta_assesment($id_asses);
     //id peserta, nama, nip, kantor
     foreach ($data as $key => $value) {
         $return[$value['id']]['id'] = $value['id'];
         $return[$value['id']]['nama'] = $value['pegawai'];
         $return[$value['id']]['nip'] = $value['nip'];
         $return[$value['id']]['kantor'] = $value['unit'];
     }
     // jenis tes assesment
     $tesasses = new TesAssesment($this->registry);
     $data_tes_asses = $tesasses->get_join($id_asses);
     foreach ($return as $key => $value) {
         $data = $this->get_nilai_peserta($id_asses, $value['id']);
         $tes_asses = '';
         $i = 0;
         //data nilai
         foreach ($data as $k => $v) {
             //=============
             $sub_total = 0;
             // TODO cari jumlah HC tidak lulus
             // dan status kelulusan
             if ($v['id_tes_asses'] != $tes_asses) {
                 $tes_asses = $v['id_tes_asses'];
                 $return[$value['id']]['nilai'][$i] = array();
                 $return[$value['id']]['nilai'][$i]['id_tes_asses'] = $v['id_tes_asses'];
                 $return[$value['id']]['nilai'][$i]['singkat'] = $v['singkat'];
                 $return[$value['id']]['nilai'][$i]['nilai'] = $v['nilai'];
                 $return[$value['id']]['nilai'][$i]['bobot_tes'] = $v['bobot_tes'];
                 $return[$value['id']]['nilai'][$i]['nilai_bobot'] = $v['nilai_bobot'];
                 $return[$value['id']]['nilai'][$i]['pass_grade'] = $v['pass_grade'];
                 $lulus = FALSE;
                 if ((double) $v['nilai'] >= (double) $v['pass_grade']) {
                     $lulus = TRUE;
                 }
                 $return[$value['id']]['nilai'][$i]['lulus'] = $lulus;
                 //var_dump($return[$value['id']]['nama']);
                 //var_dump($return[$value['id']]['nilai'][$i]);
                 $i++;
             }
             //===============
         }
     }
     // join nilai dari sub tes ke jenis tes dan cek passing grade
     // nilai tsb dikalikan bobot jenis tes
     // nilai terbobot dijumlahkan
     // nilai penjumlahan terbobot (HC) kalikan 60% -> fix ditetapkan
     // nilai SC kalikan 40%
     // jumlahkan nilai HC dan SC sebagai nilai akhir
     // simpulkan
     //var_dump($return);
     return $return;
 }