update mpdf lib version from 6 to 8

This commit is contained in:
Schneider Roland
2022-12-27 14:42:55 +01:00
parent ac21048f95
commit f848b34245
13 changed files with 901 additions and 489 deletions

View File

@@ -10,6 +10,7 @@ use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\components\DetStatProcessor;
use common\components\MpdfUtil;
use backend\models\DestaUploadForm;
use yii\web\UploadedFile;
use yii\data\ArrayDataProvider;
@@ -23,71 +24,71 @@ use common\models\MessageDetsta;
*/
class UgiroController extends Controller {
public function behaviors() {
return [
'verbs' => [
return [
'verbs' => [
'class' => VerbFilter::className (),
'actions' => [
'delete' => [
'post'
]
]
'actions' => [
'delete' => [
'post'
]
]
],
'access' => [
'access' => [
'class' => \yii\filters\AccessControl::className (),
'rules' => [
// allow authenticated users
[
[
'actions' => [ ],
'allow' => true,
'roles' => [
'roles' => [
'admin',
'employee',
'reception'
]
]
]
'reception'
]
]
]
]
// everything else is denied
];
}
/**
* Lists all Ugiro models.
*
*
* @return mixed
*/
public function actionIndex() {
$searchModel = new UgiroSearch ();
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
return $this->render ( 'index', [
return $this->render ( 'index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider
'dataProvider' => $dataProvider
] );
}
/**
* Lists all Ugiro models.
*
*
* @return mixed
*/
public function actionItems($id) {
$searchModel = new UgiroSearch ();
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
return $this->render ( 'index', [
return $this->render ( 'index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider
'dataProvider' => $dataProvider
] );
}
public function actionActivate() {
}
/**
* Displays a single Ugiro model.
*
* @param integer $id
*
* @param integer $id
* @return mixed
*/
public function actionView($id) {
@@ -95,8 +96,8 @@ class UgiroController extends Controller {
if (Yii::$app->request->isPost) {
if ($model->status == Ugiro::$STATUS_RECIEVED) {
set_time_limit ( 1200 ); // 20 perc
$processor = new DetStatProcessor ( [
'koteg' => $model
$processor = new DetStatProcessor ( [
'koteg' => $model
] );
$processor->run ();
$this->redirect(['view', 'id' => $model->id_ugiro]);
@@ -107,7 +108,7 @@ class UgiroController extends Controller {
} else {
if (isset ( $_GET ['output'] )) {
$output = $_GET ['output'];
if ($output == 'pdf') {
$this->downloadUgiroPdf ( $model );
}else if ($output == 'xls') {
@@ -115,18 +116,18 @@ class UgiroController extends Controller {
}
}
}
$query = MessageDetsta::find();
$query->andWhere(['id_ugiro' => $model->id_ugiro]);
$query->orderBy([ 'created_at' => SORT_ASC ]);
$detstaDp = new ActiveDataProvider([
'query' => $query,
'pagination' => false,
'sort' => false
]);
return $this->render ( 'view', [
return $this->render ( 'view', [
'model' => $this->findModel ( $id ) ,
'detstaDp' => $detstaDp
] );
@@ -136,7 +137,7 @@ class UgiroController extends Controller {
* @param \common\models\Ugiro $model
*/
protected function downloadUgiroXls($model) {
$fn = "köteg.". $model->id_ugiro . ".xls";
$query = new Query();
@@ -159,7 +160,7 @@ class UgiroController extends Controller {
$dataProvider = new ActiveDataProvider(
[
'query' => $query,
'query' => $query,
'sort' => false,
'pagination' => false
]
@@ -278,11 +279,11 @@ class UgiroController extends Controller {
exit ();
}
protected function downloadUgiroPdf($model) {
$mpdf = new \mPDF ( 'utf-8', 'A4-L' );
$mpdf = MpdfUtil::createMpdfWith6XConstructor ( 'utf-8', 'A4-L' );
$fn = "köteg.". $model->id_ugiro . ".pdf";
$mpdf->useSubstitutions = false;
@@ -325,99 +326,99 @@ class UgiroController extends Controller {
/**
* Creates a new Ugiro model.
* If creation is successful, the browser will be redirected to the 'view' page.
*
*
* @return mixed
*/
public function actionCreate() {
$model = new Ugiro ();
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
return $this->redirect ( [
return $this->redirect ( [
'view',
'id' => $model->id_ugiro
'id' => $model->id_ugiro
] );
} else {
return $this->render ( 'create', [
'model' => $model
return $this->render ( 'create', [
'model' => $model
] );
}
}
/**
* Updates an existing Ugiro model.
* If update is successful, the browser will be redirected to the 'view' page.
*
* @param integer $id
*
* @param integer $id
* @return mixed
*/
public function actionUpdate($id) {
$model = $this->findModel ( $id );
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
return $this->redirect ( [
return $this->redirect ( [
'view',
'id' => $model->id_ugiro
'id' => $model->id_ugiro
] );
} else {
return $this->render ( 'update', [
'model' => $model
return $this->render ( 'update', [
'model' => $model
] );
}
}
/**
* Deletes an existing Ugiro model.
* If deletion is successful, the browser will be redirected to the 'index' page.
*
* @param integer $id
*
* @param integer $id
* @return mixed
*/
public function actionDelete($id) {
$this->findModel ( $id )->delete ();
return $this->redirect ( [
'index'
return $this->redirect ( [
'index'
] );
}
public function actionDetsta() {
$ugiro = Ugiro::findOne ( 31 );
$model = new DetStatProcessor ( [
'koteg' => $ugiro
$model = new DetStatProcessor ( [
'koteg' => $ugiro
] );
return $this->render ( 'detsta', [
'model' => $model
return $this->render ( 'detsta', [
'model' => $model
] );
}
public function actionUpload() {
$model = new DestaUploadForm ();
if (Yii::$app->request->isPost) {
$model->destaFile = UploadedFile::getInstance ( $model, 'destaFile' );
if ($model->upload ()) {
// file is uploaded successfully
return $this->redirect ( [
return $this->redirect ( [
'view',
'id' => $model->koteg->id_ugiro
'id' => $model->koteg->id_ugiro
] );
}
}
return $this->render ( 'upload', [
'model' => $model
return $this->render ( 'upload', [
'model' => $model
] );
}
public function actionGenerateDetsta() {
}
/**
* Finds the Ugiro model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
*
* @param integer $id
*
* @param integer $id
* @return Ugiro the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/