1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace app\controllers\admin; |
4
|
|
|
|
5
|
|
|
use app\models\{About, Quality, QualitySearch}; |
6
|
|
|
use app\traits\{LanguageTrait, AdminBeforeActionTrait, AccessTrait}; |
7
|
|
|
use Itstructure\AdminModule\controllers\CommonAdminController; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class QualityController |
11
|
|
|
* QualityController implements the CRUD actions for Quality model. |
12
|
|
|
* |
13
|
|
|
* @package app\controllers\admin |
14
|
|
|
*/ |
15
|
|
|
class QualityController extends CommonAdminController |
16
|
|
|
{ |
17
|
|
|
use LanguageTrait, AdminBeforeActionTrait, AccessTrait; |
|
|
|
|
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var bool |
21
|
|
|
*/ |
22
|
|
|
protected $isMultilanguage = true; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var bool |
26
|
|
|
*/ |
27
|
|
|
protected $setEditingScenarios = true; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @return mixed|string |
31
|
|
|
*/ |
32
|
|
|
public function actionIndex() |
33
|
|
|
{ |
34
|
|
|
if (!$this->checkAccessToIndex()) { |
35
|
|
|
return $this->accessError(); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
return parent::actionIndex(); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param int|string $id |
43
|
|
|
* |
44
|
|
|
* @return mixed |
45
|
|
|
*/ |
46
|
|
|
public function actionView($id) |
47
|
|
|
{ |
48
|
|
|
if (!$this->checkAccessToView()) { |
49
|
|
|
return $this->accessError(); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
return parent::actionView($id); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @return mixed|string|\yii\web\Response |
57
|
|
|
*/ |
58
|
|
|
public function actionCreate() |
59
|
|
|
{ |
60
|
|
|
if (!$this->checkAccessToCreate()) { |
61
|
|
|
return $this->accessError(); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
return parent::actionCreate(); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @param int|string $id |
69
|
|
|
* |
70
|
|
|
* @return string|\yii\web\Response |
71
|
|
|
*/ |
72
|
|
|
public function actionUpdate($id) |
73
|
|
|
{ |
74
|
|
|
if (!$this->checkAccessToUpdate()) { |
75
|
|
|
return $this->accessError(); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
return parent::actionUpdate($id); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param int|string $id |
83
|
|
|
* |
84
|
|
|
* @return mixed|\yii\web\Response |
85
|
|
|
*/ |
86
|
|
|
public function actionDelete($id) |
87
|
|
|
{ |
88
|
|
|
if (!$this->checkAccessToDelete()) { |
89
|
|
|
return $this->accessError(); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
return parent::actionDelete($id); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Get addition fields for the view template. |
97
|
|
|
* |
98
|
|
|
* @return array |
99
|
|
|
*/ |
100
|
|
|
protected function getAdditionFields(): array |
101
|
|
|
{ |
102
|
|
|
if ($this->action->id == 'create' || $this->action->id == 'update') { |
103
|
|
|
return [ |
104
|
|
|
'aboutList' => About::find()->all(), |
105
|
|
|
]; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
return $this->additionFields; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Returns Technology model name. |
113
|
|
|
* |
114
|
|
|
* @return string |
115
|
|
|
*/ |
116
|
|
|
protected function getModelName():string |
117
|
|
|
{ |
118
|
|
|
return Quality::class; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Returns TechnologySearch model name. |
123
|
|
|
* |
124
|
|
|
* @return string |
125
|
|
|
*/ |
126
|
|
|
protected function getSearchModelName():string |
127
|
|
|
{ |
128
|
|
|
return QualitySearch::class; |
129
|
|
|
} |
130
|
|
|
} |
131
|
|
|
|