예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = StuDocs::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_docs_id' => $this->stu_docs_id, 'stu_docs_category_id' => $this->stu_docs_category_id, 'stu_docs_submited_at' => $this->stu_docs_submited_at, 'stu_docs_status' => $this->stu_docs_status, 'stu_docs_stu_master_id' => $this->stu_docs_stu_master_id, 'created_by' => $this->created_by]);
     $query->andFilterWhere(['like', 'stu_docs_details', $this->stu_docs_details])->andFilterWhere(['like', 'stu_docs_path', $this->stu_docs_path]);
     return $dataProvider;
 }
예제 #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);
 }
예제 #3
0
 public function actionDeleteDoc($stu_doc_id)
 {
     $stu_docs = StuDocs::findOne($stu_doc_id);
     $path = Yii::getAlias('@webroot') . '/data/stu_docs/';
     if ($stu_docs !== NULL) {
         unlink($path . $stu_docs->stu_docs_path);
         $stu_docs->delete();
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     return $this->redirect(['view', 'id' => $stu_docs->stu_docs_stu_master_id, '#' => 'documents']);
 }
예제 #4
0
 /**
  * Finds the StuDocs model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return StuDocs the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = StuDocs::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStuDocs()
 {
     return $this->hasMany(StuDocs::className(), ['stu_docs_stu_master_id' => 'stu_master_id']);
 }