public function actionLogin() { if (!\Yii::$app->user->isGuest) { return $this->goHome(); } $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { $request = ""; $dosen = \backend\modules\aitk\models\AitkRDosen::findOne(['account_id' => Yii::$app->user->id]); $asrama = \backend\modules\aitk\models\AitkRAsrama::findOne(['account_id' => Yii::$app->user->id]); if (isset($dosen) || isset($asrama)) { if (isset($dosen)) { $jumlah_request_dosen = \backend\modules\aitk\models\AitkRequest::find()->where(['status_dosen' => NULL, 'dosen_wali' => $dosen->dosen_id])->count(); } $jumlah_request_asrama = \backend\modules\aitk\models\AitkRequest::find()->where(['status_dosen' => 1, 'status_asrama' => NULL])->count(); $total_request = isset($dosen) ? $jumlah_request_dosen : (isset($asrama) ? $jumlah_request_asrama : 0); $url = isset($dosen) ? 'dosenwali' : 'asrama'; if ($total_request > 0) { Yii::$app->getSession()->setFlash('info', ['type' => 'info', 'delay' => 100000, 'icon' => 'glyphicon glyphicon-warning-sign', 'message' => 'Anda Memiliki <a href=' . \yii\helpers\Url::to('index.php?r=aitk/request/' . $url) . '><b>' . $total_request . ' Pending Request</b></a> ', 'title' => 'Pending Request']); } } return $this->redirect(['index']); } else { return $this->render('login', ['model' => $model]); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $dosenwali = \backend\modules\aitk\models\AitkRDosen::findOne(['account_id' => Yii::$app->user->id]); $query = AitkRequest::find()->where(["status_dosen" => 1, "status_asrama" => 1, "dosen_wali" => $dosenwali->dosen_id]); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['request_id' => SORT_DESC]], 'pagination' => ['defaultPageSize' => 3]]); $query->joinWith('pengurusAsrama'); $query->joinWith('mahasiswa'); $query->joinWith('dosenWali'); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['waktu_start' => $this->waktu_start, 'waktu_end' => $this->waktu_end, 'status_asrama' => $this->status_asrama, 'status_dosen' => $this->status_dosen, 'deleted' => $this->deleted, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'tipe_ijin', $this->tipe_ijin])->andFilterWhere(['like', 'alasan_ijin', $this->alasan_ijin])->andFilterWhere(['like', 'lampiran', $this->lampiran])->andFilterWhere(['like', 'alasan_penolakan', $this->alasan_penolakan])->andFilterWhere(['like', 'created_by', $this->created_by])->andFilterWhere(['like', 'aitk_r_asrama.nama_pengurus', $this->tujuan_sms_pengurus])->andFilterWhere(['like', 'aitk_r_asrama.nama_pengurus', $this->pengurus_asrama])->andFilterWhere(['like', 'aitk_r_mahasiswa.nama_mahasiswa', $this->requester])->andFilterWhere(['like', 'aitk_r_asrama.nama_pengurus', $this->requester])->andFilterWhere(['like', 'aitk_r_mahasiswa.nama_mahasiswa', $this->mahasiswa_id])->andFilterWhere(['like', 'aitk_r_dosen.nama_dosen', $this->dosen_wali])->andFilterWhere(['like', 'updated_by', $this->updated_by]); return $dataProvider; }
public function actionApprovedosen($value, $id) { $request = AitkRequest::findOne($id); $dosen = AitkRDosen::findOne(array('account_id' => Yii::$app->user->id)); if ($request->status_dosen != NULL) { return $this->redirect(['dosenwali']); } $request->status_dosen = $value; if ($request->save()) { if ($value == 1) { $hp_asrama = $request->tujuanSmsPengurus->handphone; $nama = $request->mahasiswa->nama_mahasiswa; $nim = $request->mahasiswa->nim; $tempMulai = explode(' ', $request->waktu_start)[1]; $tempSelesai = explode(' ', $request->waktu_end)[1]; $mulai = substr($tempMulai, 0, 5); $selesai = substr($tempSelesai, 0, 5); $tipeIzin = $request->tipe_ijin == "K" ? "Keluar" : "Sakit/Tidak Hadir"; $id = $request->request_id; $sms = current(explode(" ", $nama)) . "/" . $nim . "/" . $request->mahasiswa->angkatan . " " . $tipeIzin . " " . $mulai . "-" . $selesai . " \"" . $request->alasan_ijin . "\" " . "balas 'IZIN YA {$id}' atau 'IZIN TIDAK {$id}'"; $this->sendSMS($sms, $hp_asrama); } return $this->redirect(['dosenwali']); } }
/** * @return \yii\db\ActiveQuery */ public function getDosen() { return $this->hasOne(AitkRDosen::className(), ['dosen_id' => 'dosen_id']); }
public function Approve($arr, $nomor) { $nomor = '0' . substr($nomor, 3); $asrama = AitkRAsrama::findOne(['handphone' => $nomor]); $dosen = AitkRDosen::findOne(['handphone' => $nomor]); if (!isset($asrama) && !isset($dosen)) { $sms = "Maaf Nomor Anda Tidak Terdaftar "; if ($this->sendSMS($sms, $nomor)) { echo "\n"; } } else { $request = AitkRequest::findOne($arr[2]); if (isset($request)) { if (isset($dosen)) { if ($request->dosen_wali === $dosen->dosen_id) { if (strtolower($arr[1]) === 'ya') { $request->status_dosen = 1; $sms = "Success Accept Request"; if ($this->sendSMS($sms, $nomor)) { } } if (strtolower($arr[1]) === 'tidak') { $request->status_dosen = 0; $request->status_asrama = 0; if (array_key_exists(3, $arr)) { $request->alasan_penolakan = $arr[3]; } $sms = "Success Reject Request"; if ($this->sendSMS($sms, $nomor)) { } } if ($request->save()) { $number = $request->tujuanSmsPengurus->handphone; $nama = $request->mahasiswa->nama_mahasiswa; $nim = $request->mahasiswa->nim; $tempMulai = explode(' ', $request->waktu_start)[1]; $tempSelesai = explode(' ', $request->waktu_end)[1]; $mulai = substr($tempMulai, 0, 5); $selesai = substr($tempSelesai, 0, 5); $tipeIzin = $request->tipe_ijin == "K" ? "Keluar" : "Tidak Hadir"; $id = $request->request_id; $sms = current(explode(" ", $nama)) . "/" . $nim . "/" . $request->mahasiswa->angkatan . " " . $tipeIzin . " " . $mulai . "-" . $selesai . " \"" . $request->alasan_ijin . "\" " . "balas 'IZIN YA {$id}' atau 'IZIN TIDAK {$id}'"; if ($this->sendSMS($sms, $number)) { } } else { echo "Request Error "; print_r($request->getErrors()); } } else { $sms = "Maaf Keyword Anda Salah"; if ($this->sendSMS($sms, $nomor)) { } } } if (isset($asrama)) { if (strtolower($arr[1]) === 'ya') { $request->status_asrama = 1; } if (strtolower($arr[1]) === 'tidak') { $request->status_asrama = 0; $request->status_dosen = 0; $alasan_tolak = ""; if (array_key_exists(3, $arr)) { $alasan_tolak = $arr[3]; } } $this->Approveasrama($asrama->asrama_id, $request->request_id, $request->status_asrama, $alasan_tolak); $sms = "Success Menyetujui Request"; if ($this->sendSMS($sms, $nomor)) { } } } if (!isset($request)) { $sms = "Format anda SALAH\n Balas IZIN <spasi> YA/TIDAK <spasi> IDENTIFIER"; if ($this->sendSMS($sms, $nomor)) { } } } }
/* @var $searchModel backend\modules\aitk\models\search\AitkRequestSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Summary'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="aitk-request-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php $dosen = AitkRDosen::find()->where(['account_id' => Yii::$app->user->id])->one(); $kelas = AitkRKelas::findOne(['wali' => $dosen->dosen_id]); if (isset($kelas)) { $iddosenWali = $dosen->dosen_id; ?> <p> <?php echo Html::a('Go to Dosen Wali Section', ['dosenwali'], ['class' => 'btn btn-info']); ?> </p> <?php } ?> <div class="body-content">
<div class="jamMatakuliah" style="display: none" > <?php $j = 0; for ($i = 0; $i < $count; $i++) { $dosenMatakuliah = AitkDosenmatakuliah::find()->where(['matakuliah_id' => $matkulId[$i]])->all(); $arrDosenId = array(); foreach ($dosenMatakuliah as $valueDosen => $keyD) { foreach ($keyD as $valD => $isiD) { if ($valD == "dosen_id") { $arrDosenId[] = $keyD[$valD]; } } } $dosenAllMatakuliah = AitkRDosen::findAll($arrDosenId); echo "<div id=\"sesi" . current(explode(' ', $arrMatkul[$i])) . "\" style=\"display:none;\">"; echo kartik\builder\Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['sesiList[' . $i . '][]' => ['label' => 'Sesi ' . $arrMatkul[$i], 'type' => Form::INPUT_CHECKBOX_LIST, 'items' => array('T_' . current(explode(' ', $arrMatkul[$i])) => 'Teori', 'P_' . current(explode(' ', $arrMatkul[$i])) => 'Praktikum'), 'options' => ['inline' => true, 'item' => function ($index, $label, $name, $checked, $value) { return Html::checkbox($name, $checked, ['value' => $value, 'label' => '<label for="' . $label . '">' . $label . '</label>', 'labelOptions' => ['id' => $value . 'SesiRad', 'style' => 'display:block; float:left'], 'id' => "Sesi" . $value, 'class' => 'PilihanSesiList']); }]]]]); echo "<div id=\"matkulT" . current(explode(' ', $arrMatkul[$i])) . "\" style=\"display:none;\">"; echo kartik\builder\Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['waktuKuliah' => ['label' => 'Waktu Sesi Teori ' . $arrMatkul[$i], 'attributes' => ['waktu_mulaiKulList[' . $i . '][]' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\TimePicker', 'options' => ['options' => ['placeholder' => 'Time from...', 'id' => 'timeStartTeori' . current(explode(' ', $arrMatkul[$i])), 'options' => ['required' => true]]]], 'waktu_selesaiKulList[' . $i . '][]' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\TimePicker', 'options' => ['options' => ['placeholder' => 'Time to...', 'class' => 'col-md-9', 'id' => 'timeEndTeori' . current(explode(' ', $arrMatkul[$i])), 'options' => ['required' => true]]]]]], 'dosen_matkulList[' . $i . '][]' => ['label' => 'Dosen ' . $arrMatkul[$i], 'type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map($dosenAllMatakuliah, 'dosen_id', 'nama_dosen'), 'options' => ['id' => 'dosen_matkul_' . $arrMatkul[$i], 'prompt' => 'Pilih Dosen Matakuliah', 'options' => ['required' => true]]]]]); echo "</div>"; echo "<div id=\"matkulP" . current(explode(' ', $arrMatkul[$i])) . "\" style=\"display:none;\">"; echo kartik\builder\Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['waktuKuliah' => ['label' => 'Waktu Sesi Praktikum ' . $arrMatkul[$i], 'attributes' => ['waktu_mulaiKulList[' . $i . '][]' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\TimePicker', 'options' => ['options' => ['placeholder' => 'Time from...', 'id' => 'timeStartPraktikum' . current(explode(' ', $arrMatkul[$i])), 'options' => ['required' => true]]]], 'waktu_selesaiKulList[' . $i . '][]' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\TimePicker', 'options' => ['options' => ['placeholder' => 'Time to...', 'class' => 'col-md-9', 'id' => 'timeEndPraktikum' . current(explode(' ', $arrMatkul[$i])), 'options' => ['required' => true]]]]]], 'dosen_matkulList[' . $i . '][]' => ['label' => 'Dosen ' . $arrMatkul[$i], 'type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map($dosenAllMatakuliah, 'dosen_id', 'nama_dosen'), 'options' => ['id' => 'dosen_matkul_' . $arrMatkul[$i], 'prompt' => 'Pilih Dosen Matakuliah', 'options' => ['required' => true]]]]]); echo " </div> </div>"; } ?> </div> <br>
<?php $this->beginBody(); ?> <div class="wrap"> <?php NavBar::begin(['brandLabel' => 'Aplikasi Izin Tidak Mengikuti Jam Akademik (APTIKAD)', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]); $menuItems = [['label' => 'Home', 'url' => ['/site/index']]]; if (Yii::$app->user->isGuest) { $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; } else { $akun = common\models\AitkRAccount::findOne(Yii::$app->user->id); if ($akun->username == "baakitdel") { $menuItems[] = ['label' => 'View Summary', 'url' => ['/aitk/request/baak']]; } else { $wali = null; $dosen = \backend\modules\aitk\models\AitkRDosen::findOne(['account_id' => Yii::$app->user->identity->id]); if (isset($dosen)) { $wali = \backend\modules\aitk\models\AitkRKelas::findOne(['wali' => $dosen->dosen_id]); } $asrama = \backend\modules\aitk\models\AitkRAsrama::findOne(['account_id' => Yii::$app->user->identity->id]); $mahasiswa = \backend\modules\aitk\models\AitkRMahasiswa::findOne(['account_id' => Yii::$app->user->identity->id]); $url = ""; if (isset($dosen)) { $url = "dosen"; } if (isset($wali)) { $url = "dosenwali"; } if (isset($asrama)) { $url = "asrama"; }
/** * @return \yii\db\ActiveQuery */ public function getDosens() { return $this->hasMany(AitkRDosen::className(), ['dosen_id' => 'dosen_id'])->viaTable('aitk_dosenmatakuliah', ['matakuliah_id' => 'matakuliah_id']); }
/** * @return \yii\db\ActiveQuery */ public function getAitkRDosens() { return $this->hasMany(AitkRDosen::className(), ['account_id' => 'account_id']); }