Exemplo n.º 1
0
 public function actionDetail()
 {
     $model = new ModelMember();
     $model_aduan = new ModelAduan();
     $model_analytics = new ModelAnalytics();
     $model_cat = new ModelKategori();
     $request = Yii::$app->request;
     $session = Yii::$app->session;
     $username = $session->get('username');
     if ($username != null) {
         $member = $model->getSingleMember($request->get('id'));
         $aduan = $model_aduan->getAduanMember($request->get('id'));
         // Count aduan categori
         $arrs_cat = array();
         foreach ($model_cat->getKategori() as $key => $value) {
             $c_aduan_cat = $model_analytics->getCountAduanCategory($value['id'], ' AND member="' . $request->get('id') . '"');
             $arrs_cat[] = array('nama' => $value['nama'], 'count' => $c_aduan_cat['count']);
         }
         // Count aduan status
         $status_diterima = $model_analytics->getCountAduanStatus('1', ' AND member="' . $request->get('id') . '"');
         $status_dilaksanakan = $model_analytics->getCountAduanStatus('2', ' AND member="' . $request->get('id') . '"');
         $status_ditolak = $model_analytics->getCountAduanStatus('3', ' AND member="' . $request->get('id') . '"');
         $arrs_sts = array('Diterima' => $status_diterima['count'], 'Dilaksanakan' => $status_dilaksanakan['count'], 'Ditolak' => $status_ditolak['count']);
         return $this->render('detail', ['data' => $member, 'data_aduan' => $aduan, 'count_category' => $arrs_cat, 'count_status' => $arrs_sts]);
     } else {
         return $this->redirect(Url::to(['login/index']));
     }
 }
Exemplo n.º 2
0
 public function actionEdit()
 {
     $model = new ModelAduan();
     $session = Yii::$app->session;
     $username = $session->get('username');
     if ($username != null) {
         $request = Yii::$app->request;
         $getAduan = $model->getSingleAduan($request->get('id'));
         if ($model->load(Yii::$app->request->post())) {
             $model->updateStatusAduan();
             return $this->redirect(Url::to(['aduan/edit', 'id' => $request->get('id')]));
         } else {
             return $this->render('edit', ['data' => $getAduan]);
         }
     } else {
         return $this->redirect(Url::to(['login/index']));
     }
 }
Exemplo n.º 3
0
 public function actionDeleteaduan()
 {
     $model = new ModelAduan();
     $request = Yii::$app->request;
     $data = $model->deleteAduan($request->get('id'));
     header('Content-Type: application/json');
     if ($data == true) {
         // Berhasil
         echo json_encode(array('status' => '1'));
     } else {
         // Gagal
         echo json_encode(array('status' => '2'));
     }
     // URL : http://back.end/index.php?r=api/deleteaduan&id=111111
 }