public function actionDaftar() { $this->all(); $this->action = 'daftar'; $instansi = new Instansi(); $user = new User(); $j_instansi = array('1' => 'Sekolah', '2' => 'Perusahaan', '3' => 'Pemerintah', '4' => 'Lain-lain'); if (isset($_POST['Instansi'])) { $instansi->Nama_instansi = $_POST['Instansi']['Nama_instansi']; $instansi->Jenis_instasni = $_POST['Instansi']['Jenis_instasni']; $instansi->Alamat = $_POST['Instansi']['Alamat']; $instansi->No_tlp = $_POST['Instansi']['No_tlp']; $instansi->email = $_POST['Instansi']['email']; if ($instansi->save()) { $user->username = $_POST['User']['username']; $user->password = md5($_POST['User']['password']); $user->Level = 'instansi'; $user->status = '0'; $user->id_user = $instansi->Id_instansi; $user->save(); Yii::app()->user->setFlash('status', '<div class="alert alert-success">Silahkan menunggu konfirmasi dari Admin</div>'); } else { Yii::app()->user->setFlash('status', '<div class="alert alert-danger">Error! silahkan cek form login Anda lagi </div>'); } } $this->render('daftar', array('instansi' => $instansi, 'user' => $user, 'j_instansi' => $j_instansi)); }
public function load() { if (Yii::app()->user->isGuest) { $this->redirect(Yii::app()->request->baseUrl); } $this->identitas = Instansi::model()->findByPk(Yii::app()->user->id); date_default_timezone_set("Asia/Jakarta"); }
public function actionDetailpkli() { if (!Yii::app()->user->isGuest) { $pkli = ProgramPkli::model()->findByPk($_GET['id']); $instansi = Instansi::model()->findByPk($pkli->Id_instansi); $b_keahlian = array('1' => 'Pemrogramman', '2' => 'Jaringan', '3' => 'Hardware', '4' => 'Sistem Informasi', '5' => 'Multimedia'); $result['nama'] = $instansi->Nama_instansi; $result['alamat'] = $instansi->Alamat; $result['bidang'] = $b_keahlian[$pkli->Bidang_Keahlian]; $awal = date_create($pkli->awal); $akhir = date_create($pkli->akhir); $result['pelaksanaan'] = date_format($awal, 'd-m-Y') . ' s.d. ' . date_format($akhir, 'd-m-Y'); $result['kuota'] = $pkli->Jumlah_peserta . ' Orang'; $result['terdaftar'] = count(PesertaPkli::model()->findAllByAttributes(array('Id_program' => $pkli->Id_program_pkli))) . ' Orang'; $tersedia = $result['kuota'] - $result['terdaftar']; if ($tersedia == 0) { $result['tersedia'] = 'Kuota Penuh'; } else { $result['tersedia'] = $tersedia . ' Orang'; } $result['telepon'] = $instansi->No_tlp; $result['keterangan'] = $pkli->keterangan; echo json_encode($result); } }
<?php $page = isset($_GET['page']) ? $_GET['page'] : null; if (empty($page)) { require_once 'html/view.login.php'; } else { require_once 'Instansi.php'; $instansiObj = new Instansi(); switch ($page) { case 'validate': $user = strip_tags($_POST['_user']); $pass = strip_tags($_POST['_pass']); $errors = []; if (empty($user)) { array_push($errors, "[x] Username tidak boleh kosong"); } if (empty($pass)) { array_push($errors, "[x] Password tidak boleh kosong"); } if (preg_match("/^([a-zA-Z\\._]{3,25})*\$/", $user) == false) { array_push($errors, "[x] Karakter maksimal username 25 karakter"); } if (count($errors) > 0) { foreach ($errors as $value) { echo $value . "<br>"; } exit; } require_once 'Auth.php'; $auth = new Auth(); $auth->username = $user;
return FALSE; } } public function update() { $query = "UPDATE instansi SET instansi = :instansi , deskripsi = :deskripsi WHERE id = :find"; try { $db = DB::prepare($query); $db->execute([':instansi' => $this->instansi, ':deskripsi' => $this->deskripsi, ':find' => $this->find]); return TRUE; } catch (PDOException $e) { echo $e->getMessage(); return FALSE; } } public function delete() { $query = "DELETE FROM instansi WHERE id = :find"; try { $db = DB::prepare($query); $db->execute([':find' => $this->find]); return TRUE; } catch (PDOException $e) { echo $e->getMessage(); return FALSE; } } } $obj = new Instansi(); $obj->find = '2'; $obj->delete();
<thead> <tr> <th>No</th> <th>Instansi</th> <th>Kuota</th> <th>Terdaftar</th> <th>Tersedia</th> <th>Bidang Keahlian</th> <th>Aksi</th> </tr> </thead> <tbody> <?php $i = 1; foreach ($pkli as $value) { $instansi = Instansi::model()->findByPk($value->Id_instansi); ?> <tr class="<?php if ($i % 2 == 0) { ?> success<?php } else { ?> active<?php } ?> "> <td><?php echo $i; ?> </td>
public function actionProfilinstansi() { if (!Yii::app()->user->isGuest) { $instansi = Instansi::model()->findByAttributes(array('Id_instansi' => $_GET['id'])); $result['nama'] = $instansi->Nama_instansi; $jenis = array('1' => 'Sekolah', '2' => 'Perusahaan', '3' => 'Pemerintah', '4' => 'Lain-lain'); $result['jenis'] = $jenis[$instansi->Jenis_instasni]; $result['alamat'] = $instansi->Alamat; $result['telepon'] = $instansi->No_tlp; $result['email'] = $instansi->email; echo json_encode($result); } }
<?php foreach ($laporan as $list) { ?> <tr> <td><?php echo $list->NIM; ?> </td> <td><?php $mahasiswa = Mahasiswa::model()->findByAttributes(array('NIM' => $list->NIM)); echo $mahasiswa->Nama_lengkap; ?> </td> <td><?php $programpkli = ProgramPkli::model()->findByAttributes(array('Id_program_pkli' => $list->Id_program)); $instansi = Instansi::model()->findByAttributes(array('Id_instansi' => $programpkli->Id_instansi)); echo $instansi->Nama_instansi; ?> </td> <td><?php $programpkli = ProgramPkli::model()->findByAttributes(array('Id_program_pkli' => $list->Id_program)); echo $ahli[$programpkli->Bidang_Keahlian]; ?> </td> <td><?php $programpkli = ProgramPkli::model()->findByAttributes(array('Id_program_pkli' => $list->Id_program)); echo $programpkli->awal; ?> </td> <td><?php $programpkli = ProgramPkli::model()->findByAttributes(array('Id_program_pkli' => $list->Id_program));