|
- <?php
-
- namespace backend\controllers;
-
- use Yii;
- use common\models\User;
- use yii\data\ActiveDataProvider;
- use yii\web\Controller;
- use yii\web\NotFoundHttpException;
- use yii\filters\VerbFilter;
- use yii\filters\AccessControl;
- use kartik\mpdf\Pdf;
- use common\models\Etablissement;
-
-
- class CommuniquerController 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 Yii::$app->user->identity->status == USER::STATUS_ADMIN
- || Yii::$app->user->identity->status == USER::STATUS_BOULANGER;
- }
- ]
- ],
- ],
- ];
- }
-
- public function actionIndex()
- {
- $etablissement = Etablissement::findOne(['id' => Yii::$app->user->identity->id_etablissement]) ;
-
- return $this->render('index', [
- 'etablissement' => $etablissement,
- ]) ;
- }
-
- public function actionModeemploi()
- {
-
- $etablissement = Etablissement::findOne(['id' => Yii::$app->user->identity->id_etablissement]) ;
-
-
- $content = $this->renderPartial('mode_emploi_multi',[
- 'pdf' => true,
- 'etablissement' => $etablissement
- ]);
-
- $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();
-
- }
-
- }
|