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) { $query = AitkRequest::find(); $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 MahasiswaReport($mhs) { $matakuliah = AitkRMatakuliah::find()->where(['semester' => $mhs->semester])->andWhere(['jurusan' => NULL])->orWhere(['jurusan' => $mhs->jurusan])->all(); $tidkHadir = (int) AitkRequest::find()->where(["tipe_ijin" => "Tidak Hadir", 'status_dosen' => 1, "status_asrama" => 1, "mahasiswa_id" => $mhs->mahasiswa_id])->count(); $keluar = (int) AitkRequest::find()->where(["tipe_ijin" => "Keluar", 'status_dosen' => 1, "status_asrama" => 1, "mahasiswa_id" => $mhs->mahasiswa_id])->count(); $tidakHadir = AitkRequest::find()->where(["tipe_ijin" => "Tidak Hadir", 'status_dosen' => 1, "status_asrama" => 1, "mahasiswa_id" => $mhs->mahasiswa_id])->asArray()->all(); $arrIzin = array(); foreach ($tidakHadir as $arrayTidakHadir) { $arrIzin[] = AitkRequest::find()->where(["aitk_request.request_id" => $arrayTidakHadir['request_id'], 'aitk_request.status_dosen' => 1, "aitk_request.status_asrama" => 1])->joinWith('aitkMatakuliahizins', true, "INNER JOIN")->asArray()->all(); } $matakuliahIzinMhs = array(); foreach ($arrIzin as $izins) { foreach ($izins as $izin) { foreach ($izin['aitkMatakuliahizins'] as $sesiMatakuliah) { $matakuliahIzinMhs[] = $sesiMatakuliah; } } } $teoriId = array(); $prakId = array(); $lainnya = array(); foreach ($matakuliahIzinMhs as $mta) { if ($mta['sesi'] == "T") { $teoriId[] = $mta["matakuliah_id"]; } if ($mta['sesi'] == "P") { $prakId[] = $mta["matakuliah_id"]; } if ($mta['sesi'] == NULL) { $lainnya[] = $mta["matakuliah_id"]; } } $teoriId = array_count_values($teoriId); $prakId = array_count_values($prakId); $lainnya = array_count_values($lainnya); $totalTeori = array(); $totalPrak = array(); $totalLainnya = array(); $arrMatakuliah = array(); foreach ($matakuliah as $matkul) { $arrMatakuliah[] = $matkul['alias']; if (array_key_exists($matkul["matakuliah_id"], $teoriId)) { $totalTeori[] = $teoriId[$matkul["matakuliah_id"]]; } else { $totalTeori[] = 0; } if (array_key_exists($matkul["matakuliah_id"], $prakId)) { $totalPrak[] = $prakId[$matkul["matakuliah_id"]]; } else { $totalPrak[] = 0; } if (array_key_exists($matkul["matakuliah_id"], $lainnya)) { $totalLainnya[] = $lainnya[$matkul["matakuliah_id"]]; } else { $totalLainnya[] = 0; } } $arr = array(); $arr["totalTeori"] = $totalTeori; $arr["totalPrak"] = $totalPrak; $arr["totalLainnya"] = $totalLainnya; $arr["tidkHadir"] = $tidkHadir; $arr["keluar"] = $keluar; $arr["arrMatakuliah"] = $arrMatakuliah; return $arr; }
/** * @return \yii\db\ActiveQuery */ public function getAitkRequests0() { return $this->hasMany(AitkRequest::className(), ['tujuan_sms_pengurus' => 'asrama_id']); }
/** * @return \yii\db\ActiveQuery */ public function getAitkRequests0() { return $this->hasMany(AitkRequest::className(), ['requester' => 'mahasiswa_id']); }
<div class="panel panel-danger"> <div class="panel-heading"> <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#collapseList"> <h4>List Mahasiswa</h4></a> </h4> </div> <div id="collapseList" class="panel-collapse collapse "> <table class="table" > <tr><th>No.</th> <th>Nim</th> <th>Nama</th> <th>Total Izin </th> <th>View Report</th></tr> <?php $i = 1; $total = 0; foreach ($mahasiswaAll as $mhs) { $count = AitkRequest::find()->where(['mahasiswa_id' => $mhs->mahasiswa_id, 'status_dosen' => 1, 'status_asrama' => 1])->count(); $label = $count > 0 ? "<span class='label label-success'>" . $count . "</span>" : "<span class='label label-warning'> 0</span>"; echo "<tr> <td>" . $i . "</td>" . "<td>" . $mhs->nim . "</td><td>" . $mhs->nama_mahasiswa . "</td><td>" . $label . "</td> <td>" . Html::a('View Report', ['reportdw', 'nim' => $mhs->nim], ['class' => 'btn btn-info']) . " </td></tr>"; $i++; $total += $count; } ?> <tr> <td colspan="3" style="text-align: center"><h4>Total</h4></td><td><?php echo "<span class= 'label label-danger'>" . $total . "</span>"; ?> </td><td></td> </tr> </table>
public function Approveasrama($idasrama, $id, $value, $alasan_tolak) { $model = AitkRequest::findOne($id); $asrama = AitkRAsrama::findOne($idasrama); $model->status_asrama = $value; $model->status_dosen = $value; $model->alasan_penolakan = $alasan_tolak; $model->pengurus_asrama = $asrama->asrama_id; if ($model->save()) { if (strtolower($model->tipe_ijin) == "tidak hadir") { $this->InsertMatakuliahizin($model->request_id); } } }
/** * @return \yii\db\ActiveQuery */ public function getAitkRequests() { return $this->hasMany(AitkRequest::className(), ['dosen_wali' => 'dosen_id']); }
/** * @return \yii\db\ActiveQuery */ public function getRequest() { return $this->hasOne(AitkRequest::className(), ['request_id' => 'request_id']); }