/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = NationalHolidays::find()->where(['is_status' => 0]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['national_holiday_id' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['national_holiday_id' => $this->national_holiday_id, 'national_holiday_date' => $this->dbDateSearch($this->national_holiday_date), 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by, 'is_status' => $this->is_status]);
     $query->andFilterWhere(['like', 'national_holiday_name', $this->national_holiday_name])->andFilterWhere(['like', 'national_holiday_remarks', $this->national_holiday_remarks]);
     unset($_SESSION['exportData']);
     $_SESSION['exportData'] = $dataProvider;
     return $dataProvider;
 }
 public function actionIndex()
 {
     $this->layout = 'homePage';
     if (\Yii::$app->user->isGuest) {
         return $this->redirect(['site/login']);
     } else {
         $isStudent = Yii::$app->session->get('stu_id');
         $isEmployee = Yii::$app->session->get('emp_id');
         $holidayData = \app\models\NationalHolidays::find()->andWhere(['is_status' => 0])->asArray()->all();
         if (isset($isStudent)) {
             $payFees = Yii::$app->db->createCommand("SELECT SUM(fees_pay_tran_amount) FROM fees_payment_transaction WHERE fees_pay_tran_stu_id=" . Yii::$app->session->get('stu_id') . " AND is_status=0")->queryScalar();
             $currentFeesData = \app\modules\fees\models\FeesPaymentTransaction::getUnpaidTotal($isStudent);
             return $this->render('stu-dashboard', ['holidayData' => $holidayData, 'currentFeesData' => $currentFeesData, 'payFees' => $payFees]);
         } else {
             if (isset($isEmployee)) {
                 return $this->render('emp-dashboard', ['holidayData' => $holidayData]);
             } else {
                 return $this->render('user-dashboard');
             }
         }
     }
 }