Пример #1
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);
 }
Пример #2
0
         } else {
             $add_s = '';
         }
         if (!empty(StuAddress::findOne($sd['stu_master_stu_address_id'])->stu_padd_country)) {
             $add_co = Country::findOne(StuAddress::findOne($sd['stu_master_stu_address_id'])->stu_padd_country)->country_name;
         } else {
             $add_co = '';
         }
         echo "<td style='text-align:center; width:400px;'>" . StuAddress::findOne($sd['stu_master_stu_address_id'])->stu_padd . $add_city_c . " " . $add_s . " " . $add_co . "</td>";
     } else {
         echo "<td>&nbsp;</td>";
     }
 } else {
     if ($s == 'city') {
         if ($sd['stu_master_stu_address_id'] != 0) {
             $add = StuAddress::findOne($sd['stu_master_stu_address_id']);
             if (!empty($add)) {
                 $city = City::findOne($add->stu_cadd_city);
             }
             if (!empty($add->stu_cadd_city)) {
                 echo "<td style='text-align:center;'>" . $city['city_name'] . "</td>";
             } else {
                 echo "<td>&nbsp;</td>";
             }
         } else {
             echo "<td>&nbsp;</td>";
         }
     } else {
         if ($s == 'stu_email_id') {
             if (StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s} != null) {
                 echo "<td style='text-align:center;width:250px;'>" . StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s} . "</td>";
Пример #3
0
 /**
  * Updates an existing StuMaster model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($sid, $tab)
 {
     $model = $this->findModel($sid);
     $info = StuInfo::findOne($model->stu_master_stu_info_id);
     if (isset($_REQUEST['stu_guard_id'])) {
         $guard = StuGuardians::find()->where(['guardia_stu_master_id' => $model->stu_master_id, 'stu_guardian_id' => $_REQUEST['stu_guard_id']])->one();
     }
     $address = StuAddress::findOne($model->stu_master_stu_address_id);
     if ($tab == 'personal') {
         if ($model->load(Yii::$app->request->post()) && $info->load(Yii::$app->request->post())) {
             $model->attributes = $_POST['StuMaster'];
             $info->attributes = $_POST['StuInfo'];
             if (empty($_POST['StuInfo']['stu_email_id'])) {
                 $info->stu_email_id = NULL;
             } else {
                 $info->stu_email_id = strtolower($_POST['StuInfo']['stu_email_id']);
             }
             $info->stu_dob = Yii::$app->dateformatter->getDateFormat($_POST['StuInfo']['stu_dob']);
             $model->updated_by = Yii::$app->getid->getId();
             $model->updated_at = new \yii\db\Expression('NOW()');
             if ($model->save() && $info->save()) {
                 return $this->redirect(['view', 'id' => $model->stu_master_id, '#' => "personal"]);
             } else {
                 return $this->render('personal_info', ['model' => $model, 'info' => $info]);
             }
         } else {
             return $this->render('personal_info', ['model' => $model, 'info' => $info]);
         }
     } else {
         if ($tab == 'academic') {
             if ($model->load(Yii::$app->request->post()) && $info->load(Yii::$app->request->post())) {
                 $model->attributes = $_POST['StuMaster'];
                 $info->attributes = $_POST['StuInfo'];
                 $info->stu_admission_date = Yii::$app->dateformatter->getDateFormat($_POST['StuInfo']['stu_admission_date']);
                 $model->updated_by = Yii::$app->getid->getId();
                 $model->updated_at = new \yii\db\Expression('NOW()');
                 if ($model->save() && $info->save(false)) {
                     return $this->redirect(['view', 'id' => $model->stu_master_id, '#' => "academic"]);
                 } else {
                     return $this->render('academic_info', ['model' => $model, 'info' => $info]);
                 }
             } else {
                 return $this->render('academic_info', ['model' => $model, 'info' => $info]);
             }
         } else {
             if ($tab == 'guardians') {
                 if (Yii::$app->request->isAjax && $guard->load(Yii::$app->request->post())) {
                     \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
                     return ActiveForm::validate($guard);
                 }
                 if ($guard->load(Yii::$app->request->post()) || isset($_POST['StuGuardians'])) {
                     $guard->attributes = $_POST['StuGuardians'];
                     if (empty($_POST['StuGuardians']['guardian_email'])) {
                         $guard->guardian_email = NULL;
                     } else {
                         $guard->guardian_email = strtolower($_POST['StuGuardians']['guardian_email']);
                     }
                     $guard->updated_by = Yii::$app->getid->getId();
                     $guard->updated_at = new \yii\db\Expression('NOW()');
                     if ($guard->save()) {
                         return $this->redirect(['view', 'id' => $model->stu_master_id, '#' => "guardians"]);
                     } else {
                         return $this->renderAjax('guardians_info', ['model' => $model, 'info' => $info, 'guard' => $guard]);
                     }
                 } else {
                     return $this->renderAjax('guardians_info', ['model' => $model, 'info' => $info, 'guard' => $guard]);
                 }
             } else {
                 if ($tab == 'address') {
                     if ($address->load(Yii::$app->request->post())) {
                         $address->attributes = $_POST['StuAddress'];
                         if ($address->save()) {
                             return $this->redirect(['view', 'id' => $model->stu_master_id, '#' => "address"]);
                         } else {
                             return $this->render('address_info', ['model' => $model, 'info' => $info, 'address' => $address]);
                         }
                     } else {
                         return $this->render('address_info', ['model' => $model, 'info' => $info, 'address' => $address]);
                     }
                 } else {
                     return $this->render('update', ['model' => $model, 'info' => $info]);
                 }
             }
         }
     }
 }
Пример #4
0
 /**
  * Finds the StuAddress model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return StuAddress the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = StuAddress::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }