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);
 }
     } else {
         echo "<td style='text-align:center;'>" . Batches::findOne($sd['stu_master_batch_id'])->{$s} . "</td>";
     }
 } else {
     if ($s == 'course_name') {
         if ($sd['stu_master_course_id'] == 0) {
             echo "<td></i> Not Set</i></td>";
         } else {
             echo "<td>" . Courses::findOne($sd['stu_master_course_id'])->{$s} . "</td>";
         }
     } else {
         if ($s == 'section_name') {
             if ($sd['stu_master_section_id'] == 0) {
                 echo "<td> Not Set </td>";
             } else {
                 echo "<td>" . Section::findOne($sd['stu_master_section_id'])->{$s} . "</td>";
             }
         } else {
             if ($s == 'stu_cadd') {
                 if ($sd['stu_master_stu_address_id'] != 0) {
                     if (!empty(StuAddress::findOne($sd['stu_master_stu_address_id'])->stu_cadd_city)) {
                         $add_c = City::findOne(StuAddress::findOne($sd['stu_master_stu_address_id'])->stu_cadd_city);
                         if (!empty($add_c)) {
                             $add_city = $add_c->city_name . " , ";
                         } else {
                             $add_city = '';
                         }
                     } else {
                         $add_city = '';
                     }
                     if (!empty(StuAddress::findOne($sd['stu_master_stu_address_id'])->stu_cadd_state)) {
 /**
  * Finds the Section model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Section the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Section::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }