Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = StuInfo::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $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(['stu_info_id' => $this->stu_info_id, 'stu_dob' => $this->stu_dob, 'stu_admission_date' => $this->stu_admission_date, 'stu_mobile_no' => $this->stu_mobile_no, 'stu_info_stu_master_id' => $this->stu_info_stu_master_id]);
     $query->andFilterWhere(['like', 'stu_unique_id', $this->stu_unique_id])->andFilterWhere(['like', 'stu_title', $this->stu_title])->andFilterWhere(['like', 'stu_first_name', $this->stu_first_name])->andFilterWhere(['like', 'stu_middle_name', $this->stu_middle_name])->andFilterWhere(['like', 'stu_last_name', $this->stu_last_name])->andFilterWhere(['like', 'stu_gender', $this->stu_gender])->andFilterWhere(['like', 'stu_email_id', $this->stu_email_id])->andFilterWhere(['like', 'stu_bloodgroup', $this->stu_bloodgroup])->andFilterWhere(['like', 'stu_birthplace', $this->stu_birthplace])->andFilterWhere(['like', 'stu_religion', $this->stu_religion])->andFilterWhere(['like', 'stu_photo', $this->stu_photo])->andFilterWhere(['like', 'stu_languages', $this->stu_languages]);
     return $dataProvider;
 }
Example #2
0
 public function actionStudentProfilePdf($sid)
 {
     $nationality = $stuAdd = [];
     $stuMaster = StuMaster::findOne($sid);
     $stuDocs = StuDocs::find()->where(['stu_docs_stu_master_id' => $sid])->join('join', 'document_category dc', 'dc.doc_category_id = stu_docs_category_id AND dc.is_status <> 2')->all();
     $stuInfo = StuInfo::find()->where(['stu_info_stu_master_id' => $sid])->one();
     $stuCourse = Courses::findOne($stuMaster->stu_master_course_id);
     $stuBatch = Batches::findOne($stuMaster->stu_master_batch_id);
     $stuSection = Section::findOne($stuMaster->stu_master_section_id);
     $stuGuard = StuGuardians::findAll(['guardia_stu_master_id' => $sid]);
     $sDocs = new StuDocs();
     if ($stuMaster->stu_master_nationality_id !== null) {
         $nationality = Nationality::findOne($stuMaster->stu_master_nationality_id)->nationality_name;
     }
     if ($stuMaster->stu_master_stu_address_id !== null) {
         $stuAdd = StuAddress::findOne($stuMaster->stu_master_stu_address_id);
     }
     $html = $this->renderPartial('/stu-master/stuprofilepdf', ['stuDocs' => $stuDocs, 'stuMaster' => $stuMaster, 'stuInfo' => $stuInfo, 'nationality' => $nationality, 'stuBatch' => $stuBatch, 'stuCourse' => $stuCourse, 'stuSection' => $stuSection, 'stuAdd' => $stuAdd, 'stuGuard' => $stuGuard, 'sDocs' => $sDocs]);
     $fName = $stuInfo->stu_first_name . "_" . $stuInfo->stu_last_name . "_" . date('Ymd-His');
     return Yii::$app->pdf->exportData(Yii::t('report', 'Student Report'), $fName, $html);
 }
Example #3
0
 /**
  * Creates a new StuMaster model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new StuMaster();
     $info = new StuInfo();
     $address = new StuAddress();
     $user = new User();
     $auth_assign = new AuthAssignment();
     if (Yii::$app->request->isAjax) {
         if ($info->load(Yii::$app->request->post())) {
             \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
             return ActiveForm::validate($info);
         }
         if ($model->load(Yii::$app->request->post())) {
             \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
             return ActiveForm::validate($model);
         }
     }
     $stud_uniq_no = \app\modules\student\models\StuInfo::find()->max('stu_unique_id');
     $uniq_id = NULL;
     if (empty($stud_uniq_no)) {
         $uniq_id = $info->stu_unique_id = 1;
     } else {
         $chk_id = StuInfo::find()->where(['stu_unique_id' => $stud_uniq_no])->exists();
         if ($chk_id) {
             $uniq_id = $stud_uniq_no + 1;
         } else {
             $uniq_id = $stud_uniq_no;
         }
     }
     if ($model->load(Yii::$app->request->post()) || $info->load(Yii::$app->request->post())) {
         $login_id = \app\models\Organization::find()->one()->org_stu_prefix . $uniq_id;
         $model->attributes = $_POST['StuMaster'];
         $info->attributes = $_POST['StuInfo'];
         $info->stu_dob = Yii::$app->dateformatter->getDateFormat($_POST['StuInfo']['stu_dob']);
         $info->stu_admission_date = Yii::$app->dateformatter->getDateFormat($_POST['StuInfo']['stu_admission_date']);
         if (empty($_POST['StuInfo']['stu_email_id'])) {
             $info->stu_email_id = NULL;
         } else {
             $info->stu_email_id = strtolower($_POST['StuInfo']['stu_email_id']);
         }
         $user->user_login_id = $login_id;
         $user->user_password = md5($user->user_login_id . $user->user_login_id);
         $user->user_type = "S";
         $user->created_by = Yii::$app->getid->getId();
         $user->created_at = new \yii\db\Expression('NOW()');
         if ($info->save(false)) {
             $user->save(false);
             $address->save(false);
         }
         $model->stu_master_stu_address_id = $address->stu_address_id;
         $model->stu_master_stu_info_id = $info->stu_info_id;
         $model->stu_master_user_id = $user->user_id;
         $model->created_by = Yii::$app->getid->getId();
         $model->created_at = new \yii\db\Expression('NOW()');
         $model->save(false);
         $s_info = StuInfo::findOne($model->stu_master_stu_info_id);
         $s_info->stu_info_stu_master_id = $model->stu_master_id;
         $s_info->save(false);
         $auth_assign->item_name = 'Student';
         $auth_assign->user_id = $user->user_id;
         $auth_assign->created_at = date_format(date_create(), 'U');
         $auth_assign->save(false);
         if ($model->save()) {
             return $this->redirect(['view', 'id' => $model->stu_master_id]);
         } else {
             return $this->render('create', ['model' => $model, 'info' => $info, 'uniq_id' => $uniq_id]);
         }
     } else {
         return $this->render('create', ['model' => $model, 'info' => $info, 'uniq_id' => $uniq_id]);
     }
 }
Example #4
0
 public function getUniqueId()
 {
     $stud_uniq_no = \app\modules\student\models\StuInfo::find()->max('stu_unique_id');
     $uniq_id = NULL;
     if (empty($stud_uniq_no)) {
         $uniq_id = $info->stu_unique_id = 1;
     } else {
         $chk_id = StuInfo::find()->where(['stu_unique_id' => $stud_uniq_no])->exists();
         if ($chk_id) {
             $uniq_id = $stud_uniq_no + 1;
         } else {
             $uniq_id = $stud_uniq_no;
         }
     }
     return $uniq_id;
 }