|
- <?php
-
- namespace backend\modules\motorcade\controllers;
-
- use Yii;
- use backend\modules\motorcade\models\BaseDocument;
- use backend\modules\motorcade\models\searchDocument;
- use backend\modules\motorcade\controllers\BaseController;
- use yii\web\NotFoundHttpException;
- use yii\filters\VerbFilter;
-
- /**
- * WarningController implements the CRUD actions for BaseDocument model.
- */
- class WarningController extends BaseController
- {
- public $layout = "@backend/modules/motorcade/views/layouts/iframe_new";
-
- /**
- * @inheritdoc
- */
- public function behaviors()
- {
- return [
- 'verbs' => [
- 'class' => VerbFilter::className(),
- 'actions' => [
- 'delete' => ['POST'],
- ],
- ],
- ];
- }
-
- /**
- * 司机预警.
- * @return mixed
- */
- public function actionDriver($type =1)
- {
- $searchModel = new searchDocument();
- $dataProvider = $searchModel->search(Yii::$app->request->queryParams, 'driver');
- $searchModel->searchTab = $type;
- return $this->render('driver', [
- 'searchModel' => $searchModel,
- 'dataProvider' => $dataProvider,
- ]);
- }
-
- /**
- * 车辆预警.
- * @return mixed
- */
- public function actionBus($type = 1)
- {
- $searchModel = new searchDocument();
- $searchModel->searchTab = $type;
- $dataProvider = $searchModel->search(Yii::$app->request->queryParams, 'bus');
- return $this->render('bus', [
- 'searchModel' => $searchModel,
- 'dataProvider' => $dataProvider,
- ]);
- }
-
- public function actionImages($doc_id, $doc_option)
- {
- //获取正本,副本
- $doc_option_all = [];
- $to_render = '';
- if ($doc_option == BaseDocument::LICENCE_XSZZB) {
- $to_render = '_images_bus';
- $doc_option_all = [BaseDocument::LICENCE_XSZZB, BaseDocument::LICENCE_XSZFB];
- } elseif ($doc_option == BaseDocument::LICENCE_DLZB) {
- $to_render = '_images_bus';
- $doc_option_all = [BaseDocument::LICENCE_DLZB, BaseDocument::LICENCE_DLFB];
- } elseif (in_array($doc_option, [511, 512, 513, 514])) {
- $to_render = '_images_insurance';
- $doc_option_all = $doc_option;
- } elseif ($doc_option == BaseDocument::MAINTAIN) {
- $to_render = '_images_maintain';
- $doc_option_all = $doc_option;
- } elseif (in_array($doc_option, [BaseDocument::LICENCE_DRIVER, BaseDocument::LICENCE_JOB])) {
- $to_render = '_images_bus';
- $doc_option_all = $doc_option;
- }
- //end 获取正本,副本
- $searchModel = [];
- $searchModel_temp = BaseDocument::findAll(['DOC_ID' => $doc_id, 'CANCEL_FLAG' => 0, 'DOC_OPTION' => $doc_option_all]);
- foreach ($searchModel_temp as $k => $v) {
- $searchModel[$v['DOC_OPTION']][$v['IMG_OPTION']] = $v;
- }
- return $this->render($to_render, ['searchModel' => $searchModel, 'doc_id' => $doc_id, 'doc_option' => $doc_option]);
- }
-
- }
|