|
- <?php
-
-
-
- namespace backend\controllers;
-
- use common\models\Producer ;
- use common\models\User ;
-
-
- class CommunicateController extends BackendController
- {
-
- public function behaviors() {
- return [
- 'verbs' => [
- 'class' => VerbFilter::className(),
- 'actions' => [
- 'delete' => ['post'],
- ],
- ],
- 'access' => [
- 'class' => AccessControl::className(),
- 'rules' => [
- [
- 'allow' => true,
- 'roles' => ['@'],
- 'matchCallback' => function ($rule, $action) {
- return User::hasAccessBackend();
- }
- ]
- ],
- ],
- ];
- }
-
-
-
- public function actionIndex()
- {
- $producer = Producer::searchOne() ;
-
- return $this->render('index', [
- 'producer' => $producer,
- ]);
- }
-
-
-
- public function actionInstructions()
- {
- $producer = Producer::searchOne() ;
-
-
- $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();
- }
-
- }
|