Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = EmpDocs::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(['emp_docs_id' => $this->emp_docs_id, 'emp_docs_category_id' => $this->emp_docs_category_id, 'emp_docs_submited_at' => $this->emp_docs_submited_at, 'emp_docs_status' => $this->emp_docs_status, 'emp_docs_emp_master_id' => $this->emp_docs_emp_master_id, 'created_by' => $this->created_by]);
     $query->andFilterWhere(['like', 'emp_docs_details', $this->emp_docs_details])->andFilterWhere(['like', 'emp_docs_path', $this->emp_docs_path]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 public function actionEmployeeProfilePdf($eid)
 {
     $nationality = $empAdd = [];
     $empMaster = EmpMaster::findOne($eid);
     $empDocs = EmpDocs::find()->where(['emp_docs_emp_master_id' => $eid])->join('join', 'document_category dc', 'dc.doc_category_id = emp_docs_category_id AND dc.is_status <> 2')->all();
     $empInfo = EmpInfo::find()->where(['emp_info_emp_master_id' => $eid])->one();
     if ($empMaster->emp_master_nationality_id !== null) {
         $nationality = Nationality::findOne($empMaster->emp_master_nationality_id)->nationality_name;
     }
     if ($empMaster->emp_master_emp_address_id !== null) {
         $empAdd = EmpAddress::findOne($empMaster->emp_master_emp_address_id);
     }
     $html = $this->renderPartial('/emp-master/empprofilepdf', ['empDocs' => $empDocs, 'empMaster' => $empMaster, 'empInfo' => $empInfo, 'nationality' => $nationality, 'empAdd' => $empAdd]);
     $fName = $empInfo->emp_first_name . "_" . $empInfo->emp_last_name . "_" . date('Ymd_His');
     return Yii::$app->pdf->exportData(Yii::t('emp', 'Employee Profile'), $fName, $html);
 }
Ejemplo n.º 3
0
 public function actionDocsDownload($emp_doc_id)
 {
     $path = Yii::getAlias('@webroot') . '/data/emp_docs/';
     $model = EmpDocs::find()->where(['emp_docs_id' => $emp_doc_id])->one();
     $file = $path . $model->emp_docs_path;
     $ext = substr(strrchr($model->emp_docs_path, '.'), 1);
     if (!empty($model) && file_exists($file)) {
         return Yii::$app->response->sendFile($file, date('Y-m-dHis') . "." . $ext);
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }