Commit bad4e51a by NAGAITAN\Adi

-- Final Project

-- Bug From Tester is Fixed.
parent cec2ee01
...@@ -51,46 +51,9 @@ class DimxDimController extends Controller ...@@ -51,46 +51,9 @@ class DimxDimController extends Controller
*/ */
public function actionView($id) public function actionView($id)
{ {
$model = new \common\models\DimxDim();
$modelsikkLog = new \common\models\SikkLog();
if ($model->load(Yii::$app->request->post())) {
$cari = \common\models\DimxDim::findOne(['nim'=>$model->nim]);
$modelsikkLog->mhs_id=$cari->dim_id;
$sql='SELECT log_id FROM sikk_log WHERE mhs_id='.$cari->dim_id.' AND time_out IS NULL';
$hasilQuery = Yii::$app->db->createCommand($sql)->queryAll();
if($hasilQuery==NULL){
Yii::$app->session->setFlash('success', '<b>Anda diizinkan untuk masuk!<b>');
date_default_timezone_set('Asia/Jakarta');
$date = date_create(date('Y-m-d H:i:s'));
$modelsikkLog->time_in=date('Y-m-d H:i:s');
$modelsikkLog->created_at=date('Y-m-d H:i:s');
if($modelsikkLog->save()){
return $this->redirect(['dimx-dim/view', 'id' => $cari->dim_id]);
}
}
if($hasilQuery!=NULL){
date_default_timezone_set('Asia/Jakarta');
$date = date_create(date('Y-m-d H:i:s'));
$date1=date('Y-m-d H:i:s');
$tanggal="'".$date1."'";
Yii::$app->session->setFlash('success', '<b>Anda diizinkan untuk keluar!<b>');
$sql1='UPDATE sikk_log SET time_out='.$tanggal.' WHERE mhs_id='.$cari->dim_id.'';
Yii::$app->db->createCommand($sql1)->execute();
return $this->redirect(['dimx-dim/view', 'id' => $cari->dim_id]);
}else{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
}
return $this->render('view', [ return $this->render('view', [
'model' => $this->findModel($id), 'model' => $this->findModel($id),
]); ]);
} }
/** /**
......
<?php <?php
namespace backend\modules\sikk\controllers; namespace backend\modules\sikk\controllers;
use mPDF; use mPDF;
use Yii; use Yii;
use common\models\SikkIzinKeluar; use common\models\SikkIzinKeluar;
...@@ -31,13 +30,12 @@ class SikkIzinKeluarController extends Controller { ...@@ -31,13 +30,12 @@ class SikkIzinKeluarController extends Controller {
], ],
]; ];
} }
public function actionDaftarrequest() { public function actionDaftarrequest() {
$searchModel = new \common\models\search\SikkIzinKeluarSearch(); $searchModel = new \common\models\search\SikkIzinKeluarSearch();
$akunID = Yii::$app->user->identity->id; $akunID = Yii::$app->user->identity->id;
$mahModel = \common\models\DimxDim::findOne(array('akun_id' => $akunID)); $mahModel = \common\models\DimxDim::findOne(array('akun_id' => $akunID));
$mahID = $mahModel->dim_id; $mahID = $mahModel->dim_id;
$query = SikkIzinKeluar::find()->where(['status' => 0, 'mhs_id' => $mahID]); $query = SikkIzinKeluar::find()->where(['status' => 0,'mhs_id'=>$mahID]);
$dataProvider = new ActiveDataProvider([ $dataProvider = new ActiveDataProvider([
'query' => $query, 'query' => $query,
'pagination' => [ 'pagination' => [
...@@ -53,6 +51,7 @@ class SikkIzinKeluarController extends Controller { ...@@ -53,6 +51,7 @@ class SikkIzinKeluarController extends Controller {
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'searchModel' => $searchModel, 'searchModel' => $searchModel,
]); ]);
} }
/** /**
...@@ -75,7 +74,7 @@ class SikkIzinKeluarController extends Controller { ...@@ -75,7 +74,7 @@ class SikkIzinKeluarController extends Controller {
//dosen //dosen
$roleks = 0; $roleks = 0;
$query = \common\models\SikkIzinKeluar::findBySql("SELECT b.izin_keluar_id, b.mhs_id, b.date_start, b.date_end, b.time_start, b.time_end, b.alasan, b.deleted ,b.created_at, b.created_by, b.updated_at, b.updated_by, b.status $query = \common\models\SikkIzinKeluar::findBySql("SELECT b.izin_keluar_id, b.mhs_id, b.date_start, b.date_end, b.time_start, b.time_end, b.alasan, b.deleted ,b.created_at, b.created_by, b.updated_at, b.updated_by, b.status
FROM sikk_approval a LEFT JOIN sikk_izin_keluar b ON a.`izin_keluar_id` = b.`izin_keluar_id` WHERE a.`approver_id` = " . $akunID->pegawai_id . ' and b.status=' . $roleks . ' and a.`status_approval` = ' . $roleks); FROM sikk_approval a LEFT JOIN sikk_izin_keluar b ON a.`izin_keluar_id` = b.`izin_keluar_id` WHERE a.`approver_id` = " . $akunID->pegawai_id . ' and b.status=' . $roleks . ' and a.`status_approval` = '.$roleks);
} else if ($roleID == 3) { } else if ($roleID == 3) {
//keasramaan //keasramaan
$roleks = 2; $roleks = 2;
...@@ -86,8 +85,11 @@ class SikkIzinKeluarController extends Controller { ...@@ -86,8 +85,11 @@ class SikkIzinKeluarController extends Controller {
$roleks = 1; $roleks = 1;
$query = \common\models\SikkIzinKeluar::findBySql("SELECT b.izin_keluar_id, b.mhs_id, b.date_start, b.date_end, b.time_start, b.time_end, b.alasan, b.deleted ,b.created_at, b.created_by, b.updated_at, b.updated_by, b.status $query = \common\models\SikkIzinKeluar::findBySql("SELECT b.izin_keluar_id, b.mhs_id, b.date_start, b.date_end, b.time_start, b.time_end, b.alasan, b.deleted ,b.created_at, b.created_by, b.updated_at, b.updated_by, b.status
FROM sikk_approval a LEFT JOIN sikk_izin_keluar b ON a.`izin_keluar_id` = b.`izin_keluar_id` WHERE a.`approver_id` = " . $akunID->pegawai_id . ' and b.status=' . $roleks); FROM sikk_approval a LEFT JOIN sikk_izin_keluar b ON a.`izin_keluar_id` = b.`izin_keluar_id` WHERE a.`approver_id` = " . $akunID->pegawai_id . ' and b.status=' . $roleks);
} else if ($roleID == 1) { } else if ($roleID == 1) {
//satpam //satpam
} }
$dataProvider = new \yii\data\ActiveDataProvider( $dataProvider = new \yii\data\ActiveDataProvider(
...@@ -98,7 +100,6 @@ class SikkIzinKeluarController extends Controller { ...@@ -98,7 +100,6 @@ class SikkIzinKeluarController extends Controller {
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
]); ]);
} }
public function actionIndex2() { public function actionIndex2() {
$searchModel = new SikkIzinKeluarSearch(); $searchModel = new SikkIzinKeluarSearch();
...@@ -145,16 +146,8 @@ class SikkIzinKeluarController extends Controller { ...@@ -145,16 +146,8 @@ class SikkIzinKeluarController extends Controller {
->all(); ->all();
$nama_request = $rows[0]["nama"]; $nama_request = $rows[0]["nama"];
var_dump($nama_request);die(); */ var_dump($nama_request);die(); */
//$modelRequest = ::findOne(array('akun_id' => $akunID));
$modelRequest= SikkIzinKeluar::findOne(['izin_keluar_id' => $id]);
$status=$modelRequest->status;
//echo $status;
//die();
$model=$this->findModel($id);
return $this->render('view', [ return $this->render('view', [
'model' => $model, 'model' => $this->findModel($id),
'status'=>$status
// 'nama_request' => $nama_request, // 'nama_request' => $nama_request,
]); ]);
} }
...@@ -483,135 +476,12 @@ class SikkIzinKeluarController extends Controller { ...@@ -483,135 +476,12 @@ class SikkIzinKeluarController extends Controller {
*/ */
public function actionUpdate($id) { public function actionUpdate($id) {
$model = $this->findModel($id); $model = $this->findModel($id);
$modelchk = new checkbox();
$id_user = Yii::$app->user->identity->akun_id;
$rows = (new \yii\db\Query())
->select(['dim_id'])
->from('dimx_dim')
->where(['akun_id' => $id_user])
->limit(1)
->all();
$dim = $rows[0]["dim_id"];
$rowss = (new \yii\db\Query())
->select(['dosen_wali_id'])
->from('adak_registrasi')
->where(['dim_id' => $dim])
->limit(1)
->all();
$id_wali = $rowss[0]["dosen_wali_id"];
$rowsss = (new \yii\db\Query())
->select(['nama'])
->from('hrdx_pegawai')
->where(['pegawai_id' => $id_wali])
->limit(1)
->all();
$nama_wali = $rowsss[0]["nama"];
$rowsall = (new \yii\db\Query())
->select(['pegawai_id'])
->from('hrdx_dosen')
->limit(10)
->all();
$nama_dosen = "";
for ($i = 0; $i < count($rowsall); $i++) {
$rowsdosen = (new \yii\db\Query())
->select(['nama'])
->from('hrdx_pegawai')
->where(['pegawai_id' => $rowsall[$i]['pegawai_id']])
->limit(1)
->all();
if ($rowsall[$i]['pegawai_id'] == $id_wali) {
$rowsdosen[0]['nama'] = "";
} else {
$nama = $rowsdosen[0]['nama'];
$nama_dosen = $nama_dosen . "," . $nama;
}
}
$arrayNamaDosen = explode(",", substr($nama_dosen, 1));
if ($model->load(Yii::$app->request->post()) && $modelchk->load(Yii::$app->request->post())) {
$model->mhs_id = $dim;
//var_dump($modelchk->namacheck);die();
$checkedName = "";
if ($modelchk->namacheck != "") {
for ($it = 0; $it < count($modelchk->namacheck); $it++) {
$checkedName = $checkedName . "," . $arrayNamaDosen[($modelchk->namacheck[$it])];
}
$checkedName = substr($checkedName, 1);
$arraycheckedName = explode(",", $checkedName);
}
if ($model->load(Yii::$app->request->post()) && $model->save()) {
//var_dump($arraycheckedName);die();
$model->created_at = date('Y-m-d H:i:s');
$model->created_by = Yii::$app->user->identity->user_name;
$hour_start = $model->time_start;
$model->time_start = $model->date_start . " " . $hour_start;
$model->status = 0;
$model->deleted = 0;
$hour_end = $model->time_end;
if ($model->date_end != "") {
$model->time_end = $model->date_end . " " . $hour_end;
} else {
$model->time_end = $model->date_start . " " . $hour_end;
}
if ($model->save()) {
for ($i = 0; $i < 2; $i++) {
$modelAppr = new SikkApproval();
$modelAppr->izin_keluar_id = $model->izin_keluar_id;
if ($i == 0) {
$modelAppr->approver_id = 5;
} else if ($i == 1) {
$modelAppr->approver_id = $id_wali;
}
$modelAppr->status_approval = 5;
$modelAppr->created_at = date('Y-m-d H:i:s');
$model->created_by = Yii::$app->user->identity->user_name;
$modelAppr->deleted = 0;
$modelAppr->isNewRecord = true;
$modelAppr->save();
}
if ($modelchk->namacheck != "") {
for ($j = 0; $j < count($arraycheckedName); $j++) {
$rows = (new \yii\db\Query())
->select(['pegawai_id'])
->from('hrdx_pegawai')
->where(['nama' => $arraycheckedName[$j]])
->limit(1)
->all();
$id_pegawai = $rows[0]['pegawai_id'];
$modelAppr = new SikkApproval();
$modelAppr->izin_keluar_id = $model->izin_keluar_id;
$modelAppr->approver_id = $id_pegawai;
$modelAppr->status_approval = 0;
$modelAppr->created_at = date('Y-m-d H:i:s');
$modelAppr->deleted = 0;
$model->created_by = Yii::$app->user->identity->user_name;
$modelAppr->isNewRecord = true;
$modelAppr->save();
}
}
return $this->redirect(['view', 'id' => $model->izin_keluar_id]); return $this->redirect(['view', 'id' => $model->izin_keluar_id]);
} else { } else {
Yii::$app->session->setFlash('warning', 'Request yang anda buat tidak benar, coba perhatikan jika masih ada kolom yang kosong atau tanggal yang anda masukkan');
return $this->render('create', [
'model' => $model,
'modelchk' => $modelchk,
'id_wali' => $id_wali,
'nama_wali' => $nama_wali,
'arrayNamaDosen' => $arrayNamaDosen,
]);
}
} else {
return $this->render('update', [ return $this->render('update', [
'model' => $model, 'model' => $model,
'modelchk' => $modelchk,
'id_wali' => $id_wali,
'nama_wali' => $nama_wali,
'arrayNamaDosen' => $arrayNamaDosen,
]); ]);
} }
} }
...@@ -625,7 +495,7 @@ class SikkIzinKeluarController extends Controller { ...@@ -625,7 +495,7 @@ class SikkIzinKeluarController extends Controller {
public function actionDelete($id) { public function actionDelete($id) {
$this->findModel($id)->delete(); $this->findModel($id)->delete();
return $this->redirect(['daftarrequest']); return $this->redirect(['index']);
} }
/** /**
...@@ -644,21 +514,15 @@ class SikkIzinKeluarController extends Controller { ...@@ -644,21 +514,15 @@ class SikkIzinKeluarController extends Controller {
} }
// show in browser // show in browser
public function actionShow($id) { public function actionShow(){
$model = $this->findModel($id); $mpdf= new mPDF();
$mpdf->WriteHTML($this->renderPartial('view'));
$mpdf = new mPDF();
$mpdf->WriteHTML($this->renderPartial('viewPdf', [
'model' => $this->findModel($id),
]));
$mpdf->Output(); $mpdf->Output();
exit; exit;
} }
// download // download
public function actionForceDownloadPdf() { public function actionForceDownloadPdf(){
$mpdf = new mPDF(); $mpdf=new mPDF();
$mpdf->WriteHTML($this->renderPartial('mpdf_view')); $mpdf->WriteHTML($this->renderPartial('mpdf_view'));
$mpdf->Output('MyPDF.pdf', 'D'); $mpdf->Output('MyPDF.pdf', 'D');
exit; exit;
......
...@@ -52,7 +52,6 @@ class SikkLogController extends Controller ...@@ -52,7 +52,6 @@ class SikkLogController extends Controller
*/ */
public function actionView($id) public function actionView($id)
{ {
return $this->render('view', [ return $this->render('view', [
'model' => $this->findModel($id), 'model' => $this->findModel($id),
]); ]);
...@@ -76,8 +75,8 @@ class SikkLogController extends Controller ...@@ -76,8 +75,8 @@ class SikkLogController extends Controller
if($hasilQuery==NULL){ if($hasilQuery==NULL){
Yii::$app->session->setFlash('success', '<b>Anda diizinkan untuk masuk!<b>'); Yii::$app->session->setFlash('success', '<b>Anda diizinkan untuk masuk!<b>');
date_default_timezone_set('Asia/Jakarta'); date_default_timezone_set('Asia/Jakarta');
$date = date_create(date('Y-m-d H:i:s')); $date = date('Y-m-d H:i:s');
$modelsikkLog->time_in=date('Y-m-d H:i:s'); $modelsikkLog->time_in=date_format($date, 'd-m-Y H:i:s');
$modelsikkLog->created_at=date('Y-m-d H:i:s'); $modelsikkLog->created_at=date('Y-m-d H:i:s');
if($modelsikkLog->save()){ if($modelsikkLog->save()){
return $this->redirect(['dimx-dim/view', 'id' => $cari->dim_id]); return $this->redirect(['dimx-dim/view', 'id' => $cari->dim_id]);
......
<?php
namespace backend\modules\sikk\controllers;
use Yii;
use common\models\SikkIzinKeluar;
use common\models\search\SikkIzinKeluarSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* SikkIzinKeluarController implements the CRUD actions for SikkIzinKeluar model.
*/
class SikkIzinKeluarController extends Controller {
/**
* @inheritdoc
*/
public function behaviors() {
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all SikkIzinKeluar models.
* @return mixed
*/
public function actionIndex() {
$searchModel = new \common\models\search\SikkApprovalSearch();
$mus = Yii::$app->user->identity->id;
$akunID = \common\models\HrdxPegawai::findOne(array('akun_id' => $mus));
$muso = \common\models\SikkAkun::findOne(array('akun_id' => $mus));
$roleID = $muso->role_id;
if ($roleID == 2) {
//dosen
// die();
$roleks = 0;
$query = \common\models\SikkIzinKeluar::findBySql("SELECT b.izin_keluar_id, b.mhs_id, b.date_start, b.date_end, b.time_start, b.time_end, b.alasan, b.deleted ,b.created_at, b.created_by, b.updated_at, b.updated_by, b.status
FROM sikk_approval a LEFT JOIN sikk_izin_keluar b ON a.`izin_keluar_id` = b.`izin_keluar_id` WHERE a.`approver_id` = " . $akunID->pegawai_id . ' and b.status=' . $roleks . ' and a.status_approval=' . $roleks);
} else if ($roleID == 3) {
//keasramaan
$roleks = 2;
$query = \common\models\SikkIzinKeluar::findBySql("SELECT b.izin_keluar_id, b.mhs_id, b.date_start, b.date_end, b.time_start, b.time_end, b.alasan, b.deleted ,b.created_at, b.created_by, b.updated_at, b.updated_by, b.status
FROM sikk_approval a LEFT JOIN sikk_izin_keluar b ON a.`izin_keluar_id` = b.`izin_keluar_id` WHERE a.`approver_id` = " . $akunID->pegawai_id . ' and b.status=' . $roleks);
} else if ($roleID == 4) {
//dosen wali
$roleks = 1;
$query = \common\models\SikkIzinKeluar::findBySql("SELECT b.izin_keluar_id, b.mhs_id, b.date_start, b.date_end, b.time_start, b.time_end, b.alasan, b.deleted ,b.created_at, b.created_by, b.updated_at, b.updated_by, b.status
FROM sikk_approval a LEFT JOIN sikk_izin_keluar b ON a.`izin_keluar_id` = b.`izin_keluar_id` WHERE a.`approver_id` = " . $akunID->pegawai_id . ' and b.status=' . $roleks);
} else if ($roleID == 5) {
//satpam
}
$dataProvider = new \yii\data\ActiveDataProvider(
["query" => $query]);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
public function actionIndex2() {
$searchModel = new SikkIzinKeluarSearch();
$dataProvider = $searchModel->searchs(Yii::$app->request->queryParams);
return $this->render('index_1', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
public function actionIndex3() {
$searchModel = new SikkIzinKeluarSearch();
$dataProvider = $searchModel->searchss(Yii::$app->request->queryParams);
return $this->render('index_2', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single SikkIzinKeluar model.
* @param integer $id
* @return mixed
*/
public function actionView($id) {
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
public function actionAcceptwali($id) {
$model = $this->findModel($id);
$mus = Yii::$app->user->identity->id;
$akunID = \common\models\HrdxPegawai::findOne(array('akun_id' => $mus));
$mdlTL = \common\models\SikkApproval::findOne(array('izin_keluar_id' => $id, 'approver_id' => $akunID->pegawai_id));
if ($mdlTL) {
$mdlTL->status_approval = 2;
if ($mdlTL->save()) {
$model->status = 2;
$model->save();
}
return $this->redirect(['index']);
} else {
return $this->render('createacceptresponsewali', [
'mdlTL' => $mdlTL
]);
}
}
public function actionRejectwali($id) {
$model = $this->findModel($id);
$mdlTL = \common\models\SikkApproval::findOne(array('izin_keluar_id' => $id));
$mus = Yii::$app->user->identity->id;
$akunID = \common\models\HrdxPegawai::findOne(array('akun_id' => $mus));
$mdlTL = \common\models\SikkApproval::findOne(array('izin_keluar_id' => $id, 'approver_id' => $akunID->pegawai_id));
if ($mdlTL->load(Yii::$app->request->post())) {
$mdlTL->status_approval = 22;
if ($mdlTL->save()) {
$model->status = 22;
$model->save();
}
return $this->redirect(['index']);
} else {
return $this->render('createrejectresponsewali', [
'mdlTL' => $mdlTL
]);
}
}
public function actionAcceptdp($id) {
$model = $this->findModel($id);
$mdlTL = \common\models\SikkApproval::findOne(array('izin_keluar_id' => $id));
$mus = Yii::$app->user->identity->id;
$akunID = \common\models\HrdxPegawai::findOne(array('akun_id' => $mus));
$mdlTL = \common\models\SikkApproval::findOne(array('izin_keluar_id' => $id, 'approver_id' => $akunID->pegawai_id));
$query = \common\models\SikkApproval::findBySql("SELECT COUNT(izin_keluar_id) FROM sikk_approval WHERE status_approval = 0");
$mdlizinkeluar = \common\models\SikkIzinKeluar::findOne(array('izin_keluar_id' => $id, 'status' => 0));
$totaldosenpengampu = \common\models\SikkApproval::find()
->where('status_approval != 5 and izin_keluar_id =' . $id)
->count();
$telahdiresponse = \common\models\SikkApproval::find()
->where('status_approval != 0 && status_approval != 5 and izin_keluar_id =' . $id)
->count();
if ($mdlTL) {
if ($totaldosenpengampu - $telahdiresponse == 1) {
$mdlTL->status_approval = 1;
if ($mdlTL->save()) {
$model->status = 1;
$model->save();
}
return $this->redirect(['index']);
} else {
$mdlTL->status_approval = 1;
$mdlTL->save();
return $this->redirect(['index']);
}
} else {
return $this->render('createacceptresponsewali', [
'mdlTL' => $mdlTL
]);
}
}
public function actionRejectdp($id) {
$model = $this->findModel($id);
$mdlTL = \common\models\SikkApproval::findOne(array('izin_keluar_id' => $id));
$mus = Yii::$app->user->identity->id;
$akunID = \common\models\HrdxPegawai::findOne(array('akun_id' => $mus));
$mdlTL = \common\models\SikkApproval::findOne(array('izin_keluar_id' => $id, 'approver_id' => $akunID->pegawai_id));
if ($mdlTL->load(Yii::$app->request->post())) {
$mdlTL->status_approval = 11;
if ($mdlTL->save()) {
$model->status = 11;
$model->save();
}
return $this->redirect(['index']);
} else {
return $this->render('createrejectresponsewali', [
'mdlTL' => $mdlTL
]);
}
}
public function actionAcceptkeasramaan($id) {
$model = $this->findModel($id);
$mdlTL = \common\models\SikkApproval::findOne(array('izin_keluar_id' => $id));
$mus = Yii::$app->user->identity->id;
$akunID = \common\models\HrdxPegawai::findOne(array('akun_id' => $mus));
$mdlTL = \common\models\SikkApproval::findOne(array('izin_keluar_id' => $id, 'approver_id' => $akunID->pegawai_id));
if ($mdlTL) {
$mdlTL->status_approval = 3;
if ($mdlTL->save()) {
$model->status = 3;
$model->save();
}
return $this->redirect(['index']);
} else {
return $this->render('createacceptresponsewali', [
'mdlTL' => $mdlTL
]);
}
}
public function actionRejectkeasramaan($id) {
$model = $this->findModel($id);
$mdlTL = \common\models\SikkApproval::findOne(array('izin_keluar_id' => $id));
$mus = Yii::$app->user->identity->id;
$akunID = \common\models\HrdxPegawai::findOne(array('akun_id' => $mus));
$mdlTL = \common\models\SikkApproval::findOne(array('izin_keluar_id' => $id, 'approver_id' => $akunID->pegawai_id));
if ($mdlTL->load(Yii::$app->request->post())) {
$mdlTL->status_approval = 33;
if ($mdlTL->save()) {
$model->status = 33;
$model->save();
}
return $this->redirect(['index']);
} else {
return $this->render('createrejectresponsewali', [
'mdlTL' => $mdlTL
]);
}
}
/**
* Creates a new SikkIzinKeluar model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate() {
$model = new SikkIzinKeluar();
$id_user = Yii::$app->user->identity->akun_id;
$rows = (new \yii\db\Query())
->select(['dim_id'])
->from('dimx_dim')
->where(['akun_id' => $id_user])
->limit(1)
->all();
$dim = $rows[0]["dim_id"];
if ($model->load(Yii::$app->request->post())) {
$model->mhs_id = $dim;
$model->created_at = date('Y-m-d H:i:s');
$model->created_by = Yii::$app->user->identity->user_name;
$hour_start = $model->time_start;
$model->time_start = $model->date_start . " " . $hour_start;
$hour_end = $model->time_end;
if ($model->date_end != "") {
$model->time_end = $model->date_end . " " . $hour_end;
} else {
$model->time_end = $model->date_start . " " . $hour_end;
}
if ($model->save()) {
return $this->redirect(['view', 'id' => $model->izin_keluar_id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing SikkIzinKeluar model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id) {
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->izin_keluar_id]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing SikkIzinKeluar model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id) {
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the SikkIzinKeluar model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return SikkIzinKeluar the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id) {
if (($model = SikkIzinKeluar::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\DetailView; use yii\widgets\DetailView;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\DimxDim */ /* @var $model common\models\DimxDim */
...@@ -14,16 +14,6 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -14,16 +14,6 @@ $this->params['breadcrumbs'][] = $this->title;
<!--<h1><?= Html::encode($this->title) ?></h1>--> <!--<h1><?= Html::encode($this->title) ?></h1>-->
<h2>Keluar Masuk Mahasiswa</h2> <h2>Keluar Masuk Mahasiswa</h2>
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'nim')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Submit', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
......
...@@ -30,12 +30,11 @@ $roleID = $akunID->role_id; ...@@ -30,12 +30,11 @@ $roleID = $akunID->role_id;
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'filterModel' => $searchModel, 'filterModel' => $searchModel,
'columns' => [ 'columns' => [
// ['class' => 'yii\grid\SerialColumn'], ['class' => 'yii\grid\SerialColumn'],
'izin_keluar_id', 'izin_keluar_id',
'mhs.nama', 'mhs.nama',
'date_start', 'date_start',
'date_end', 'date_end',
'alasan',
['class' => 'yii\grid\ActionColumn'], ['class' => 'yii\grid\ActionColumn'],
], ],
]); ]);
......
...@@ -5,7 +5,7 @@ use yii\helpers\Html; ...@@ -5,7 +5,7 @@ use yii\helpers\Html;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\SikkIzinKeluar */ /* @var $model common\models\SikkIzinKeluar */
$this->title = 'Update Izin Keluar'; $this->title = 'Update Sikk Izin Keluar: ' . $model->izin_keluar_id;
$this->params['breadcrumbs'][] = ['label' => 'Sikk Izin Keluars', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => 'Sikk Izin Keluars', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->izin_keluar_id, 'url' => ['view', 'id' => $model->izin_keluar_id]]; $this->params['breadcrumbs'][] = ['label' => $model->izin_keluar_id, 'url' => ['view', 'id' => $model->izin_keluar_id]];
$this->params['breadcrumbs'][] = 'Update'; $this->params['breadcrumbs'][] = 'Update';
...@@ -14,14 +14,8 @@ $this->params['breadcrumbs'][] = 'Update'; ...@@ -14,14 +14,8 @@ $this->params['breadcrumbs'][] = 'Update';
<h1><?= Html::encode($this->title) ?></h1> <h1><?= Html::encode($this->title) ?></h1>
<?= <?= $this->render('_form', [
$this->render('_form', [
'model' => $model, 'model' => $model,
'modelchk' => $modelchk, ]) ?>
'id_wali' => $id_wali,
'nama_wali' => $nama_wali,
'arrayNamaDosen' => $arrayNamaDosen,
])
?>
</div> </div>
...@@ -115,13 +115,12 @@ $roleID = $akunID->role_id; ...@@ -115,13 +115,12 @@ $roleID = $akunID->role_id;
?> ?>
<div class="sikk-approval-view"> <div class="sikk-approval-view">
<?php <?php
if ($roleID == 1 && $status == 3) { if ($roleID == 2) {
echo Html::a('Print', ['/sikk/sikk-izin-keluar/show','id'=>$model->izin_keluar_id], ['class' => 'btn btn-primary']); echo Html::a('Print', ['/sikk/sikk-izin-keluar/show'], ['class' => 'btn btn-primary']);
} else { } else {
} }
?> ?>
</div> </div>
</div> </div>
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\SikkIzinKeluar */
$this->title = "Request Anda";
$this->params['breadcrumbs'][] = ['label' => 'Sikk Izin Keluars', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$mus = Yii::$app->user->identity->id;
$akunID = \common\models\SikkAkun::findOne(array('akun_id' => $mus));
$roleID = $akunID->role_id;
//var_dump($roleID);
//die();
?>
<div class="sikk-izin-keluar-view">
<table>
<tr>
<td>SURAT IZIN KELUAR</td>
</tr>>
</table>
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?php
if ($roleID == 4) {
?>
<?= Html::a('Accept', ['acceptwali', 'id' => $model->izin_keluar_id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Reject', ['rejectwali', 'id' => $model->izin_keluar_id], ['class' => 'btn btn-primary']) ?>
<?=
Html::a('Delete', ['delete', 'id' => $model->izin_keluar_id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
])
?>
<?php
} else if ($roleID == 3) {
?>
<?= Html::a('Accept', ['acceptkeasramaan', 'id' => $model->izin_keluar_id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Reject', ['rejectkeasramaan', 'id' => $model->izin_keluar_id], ['class' => 'btn btn-primary']) ?>
<?=
Html::a('Delete', ['delete', 'id' => $model->izin_keluar_id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
])
?>
<?php
} else if ($roleID == 2) {
?>
<?= Html::a('Accept', ['acceptdp', 'id' => $model->izin_keluar_id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Reject', ['rejectdp', 'id' => $model->izin_keluar_id], ['class' => 'btn btn-primary']) ?>
<?=
Html::a('Delete', ['delete', 'id' => $model->izin_keluar_id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
])
?>
<?php
} else if ($roleID == 2) {
?>
<?= Html::a('Accept', ['acceptdp', 'id' => $model->izin_keluar_id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Reject', ['rejectdp', 'id' => $model->izin_keluar_id], ['class' => 'btn btn-primary']) ?>
<?=
Html::a('Delete', ['delete', 'id' => $model->izin_keluar_id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
])
?>
<?php
}
?>
</p>
<?=
DetailView::widget([
'model' => $model,
'attributes' => [
// 'izin_keluar_id',
// 'mhs_id',
/* [
'label' => 'Nama',
'value' => $nama_request,
], */
'alasan',
'date_start',
'date_end',
'time_start',
'time_end',
// 'deleted',
// 'created_at',
// 'created_by',
// 'updated_at',
// 'updated_by',
// 'status',
],
])
?>
<div class="sikk-approval-view">
<?php
if ($roleID == 1 && $status == 3) {
echo Html::a('Print', ['/sikk/sikk-izin-keluar/show','id'=>$model->izin_keluar_id], ['class' => 'btn btn-primary']);
} else {
}
?>
</div>
</div>
...@@ -28,15 +28,15 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -28,15 +28,15 @@ $this->params['breadcrumbs'][] = $this->title;
<?= DetailView::widget([ <?= DetailView::widget([
'model' => $model, 'model' => $model,
'attributes' => [ 'attributes' => [
// 'log_id', 'log_id',
// 'mhs_id', 'mhs_id',
'time_in', 'time_in',
'time_out', 'time_out',
// 'deleted', 'deleted',
// 'created_at', 'created_at',
// 'created_by', 'created_by',
// 'updated_at', 'updated_at',
// 'updated_by', 'updated_by',
], ],
]) ?> ]) ?>
......
...@@ -8,9 +8,7 @@ use yii\helpers\Html; ...@@ -8,9 +8,7 @@ use yii\helpers\Html;
<header class="main-header"> <header class="main-header">
<?= <?= Html::a('<span class="logo-mini">SIKK</span><span class="logo-lg">' . Yii::$app->name . '</span>', Yii::$app->homeUrl, ['class' => 'logo']) ?>
// $nama ="test";
Html::a('<span class="logo-mini">SIKK</span><span class="logo-lg"> SIKK D4b </span>', Yii::$app->homeUrl, ['class' => 'logo']) ?>
<nav class="navbar navbar-static-top" role="navigation"> <nav class="navbar navbar-static-top" role="navigation">
......
...@@ -2,24 +2,22 @@ ...@@ -2,24 +2,22 @@
/* @var $this yii\web\View */ /* @var $this yii\web\View */
$this->title = 'SIKK'; $this->title = 'My Yii Application';
?> ?>
<div class="site-index"> <div class="site-index">
<div class="jumbotron"> <div class="jumbotron">
<h2>Sistem Izin Keluar Masuk Kampus</h2> <h1>Congratulations!</h1>
<p class="lead"></p>
<p class="lead">You have successfully created your Yii-powered application.</p>
<p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p>
</div> </div>
<div class="body-content"> <div class="body-content">
<div class="row"> <div class="row">
<img src="http://localhost/ITD-KEMAHASISWAAN3/backend/web/images/home.jpg"> <div class="col-lg-4">
<!-- <div class="col-lg-4">
<h2>Heading</h2> <h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
...@@ -38,7 +36,18 @@ $this->title = 'SIKK'; ...@@ -38,7 +36,18 @@ $this->title = 'SIKK';
fugiat nulla pariatur.</p> fugiat nulla pariatur.</p>
<p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum &raquo;</a></p> <p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum &raquo;</a></p>
--> </div> </div>
<div class="col-lg-4">
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.</p>
<p><a class="btn btn-default" href="http://www.yiiframework.com/extensions/">Yii Extensions &raquo;</a></p>
</div>
</div>
</div> </div>
</div> </div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment