|
- <?php
-
-
-
- namespace backend\controllers;
-
- use kartik\mpdf\Pdf;
- use yii\filters\AccessControl;
- use yii\filters\VerbFilter;
-
-
- class CommunicateController extends BackendController
- {
-
- public function behaviors()
- {
- return [
- 'verbs' => [
- 'class' => VerbFilter::class,
- 'actions' => [
- 'delete' => ['post'],
- ],
- ],
- 'access' => [
- 'class' => AccessControl::class,
- 'rules' => [
- [
- 'allow' => true,
- 'roles' => ['@'],
- 'matchCallback' => function ($rule, $action) {
- return $this->getUserManager()->hasAccessBackend();
- }
- ]
- ],
- ],
- ];
- }
-
-
-
- public function actionIndex()
- {
- $producer = $this->getProducerCurrent();
- $pointsSaleArray = $this->getPointSaleManager()->findPointSales();
-
- return $this->render('index', [
- 'producer' => $producer,
- 'pointsSaleArray' => $pointsSaleArray,
- ]);
- }
-
-
-
- public function actionInstructions()
- {
- $producer = $this->getProducerCurrent();
-
-
- $content = $this->renderPartial('instructions_multi', [
- 'pdf' => true,
- 'producer' => $producer
- ]);
-
- $pdf = new Pdf([
-
- 'mode' => Pdf::MODE_UTF8,
-
- 'format' => Pdf::FORMAT_A4,
-
- 'orientation' => Pdf::ORIENT_PORTRAIT,
-
- 'destination' => Pdf::DEST_BROWSER,
-
- 'content' => $content,
- 'marginRight' => 0,
- 'marginLeft' => 0,
- 'marginTop' => 0,
- 'marginBottom' => 0,
-
-
-
- 'cssFile' => '@app/web/css/screen.css',
-
-
-
-
-
-
-
-
- ]);
-
-
- return $pdf->render();
- }
-
- }
|