@@ -115,6 +115,9 @@ |
||
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | + /** |
|
119 | + * @param string $command |
|
120 | + */ |
|
118 | 121 | protected function action($command, $params = []) |
119 | 122 | { |
120 | 123 | echo "\nRunning action '$command'...\n"; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param array $params |
26 | 26 | * @param bool|true $allowCaching |
27 | 27 | * |
28 | - * @return bool |
|
28 | + * @return boolean|null |
|
29 | 29 | */ |
30 | 30 | public function can($permissionName, $params = [], $allowCaching = true) |
31 | 31 | { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * Checks permissions from guest role, when no user is logged in. |
47 | 47 | * |
48 | - * @param $permissionName |
|
48 | + * @param string $permissionName |
|
49 | 49 | * @param $params |
50 | 50 | * @param $allowCaching |
51 | 51 | * |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * Splits `permissionName` by underscore and match parts against more global rule |
65 | 65 | * eg. a permission `app_site` will match, `app_site_foo` |
66 | 66 | * |
67 | - * @param $permissionName |
|
67 | + * @param string $permissionName |
|
68 | 68 | * @param $params |
69 | 69 | * @param $allowCaching |
70 | 70 | * |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Lists all Less models. |
46 | - * @return mixed |
|
46 | + * @return string |
|
47 | 47 | */ |
48 | 48 | public function actionIndex() |
49 | 49 | { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * Displays a single Less model. |
66 | 66 | * @param integer $id |
67 | 67 | * |
68 | - * @return mixed |
|
68 | + * @return string |
|
69 | 69 | */ |
70 | 70 | public function actionView($id) |
71 | 71 | { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * Deletes an existing Less model. |
124 | 124 | * If deletion is successful, the browser will be redirected to the 'index' page. |
125 | 125 | * @param integer $id |
126 | - * @return mixed |
|
126 | + * @return \yii\web\Response |
|
127 | 127 | */ |
128 | 128 | public function actionDelete($id) |
129 | 129 | { |
@@ -23,71 +23,71 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public $enableCsrfValidation = false; |
25 | 25 | |
26 | - /** |
|
27 | - * @inheritdoc |
|
28 | - */ |
|
29 | - public function behaviors() |
|
30 | - { |
|
31 | - return [ |
|
32 | - 'access' => [ |
|
33 | - 'class' => AccessControl::className(), |
|
34 | - 'rules' => [ |
|
35 | - [ |
|
36 | - 'allow' => true, |
|
37 | - 'matchCallback' => function ($rule, $action) {return \Yii::$app->user->can($this->module->id . '_' . $this->id . '_' . $action->id, ['route' => true]);}, |
|
38 | - ] |
|
39 | - ] |
|
40 | - ] |
|
41 | - ]; |
|
42 | - } |
|
26 | + /** |
|
27 | + * @inheritdoc |
|
28 | + */ |
|
29 | + public function behaviors() |
|
30 | + { |
|
31 | + return [ |
|
32 | + 'access' => [ |
|
33 | + 'class' => AccessControl::className(), |
|
34 | + 'rules' => [ |
|
35 | + [ |
|
36 | + 'allow' => true, |
|
37 | + 'matchCallback' => function ($rule, $action) {return \Yii::$app->user->can($this->module->id . '_' . $this->id . '_' . $action->id, ['route' => true]);}, |
|
38 | + ] |
|
39 | + ] |
|
40 | + ] |
|
41 | + ]; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * Lists all Less models. |
|
46 | - * @return mixed |
|
47 | - */ |
|
48 | - public function actionIndex() |
|
49 | - { |
|
50 | - $searchModel = new LessSearch; |
|
51 | - $dataProvider = $searchModel->search($_GET); |
|
44 | + /** |
|
45 | + * Lists all Less models. |
|
46 | + * @return mixed |
|
47 | + */ |
|
48 | + public function actionIndex() |
|
49 | + { |
|
50 | + $searchModel = new LessSearch; |
|
51 | + $dataProvider = $searchModel->search($_GET); |
|
52 | 52 | |
53 | - Tabs::clearLocalStorage(); |
|
53 | + Tabs::clearLocalStorage(); |
|
54 | 54 | |
55 | 55 | Url::remember(); |
56 | 56 | \Yii::$app->session['__crudReturnUrl'] = null; |
57 | 57 | |
58 | - return $this->render('index', [ |
|
59 | - 'dataProvider' => $dataProvider, |
|
60 | - 'searchModel' => $searchModel, |
|
61 | - ]); |
|
62 | - } |
|
58 | + return $this->render('index', [ |
|
59 | + 'dataProvider' => $dataProvider, |
|
60 | + 'searchModel' => $searchModel, |
|
61 | + ]); |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * Displays a single Less model. |
|
66 | - * @param integer $id |
|
64 | + /** |
|
65 | + * Displays a single Less model. |
|
66 | + * @param integer $id |
|
67 | 67 | * |
68 | - * @return mixed |
|
69 | - */ |
|
70 | - public function actionView($id) |
|
71 | - { |
|
68 | + * @return mixed |
|
69 | + */ |
|
70 | + public function actionView($id) |
|
71 | + { |
|
72 | 72 | \Yii::$app->session['__crudReturnUrl'] = Url::previous(); |
73 | 73 | Url::remember(); |
74 | 74 | Tabs::rememberActiveState(); |
75 | 75 | |
76 | 76 | return $this->render('view', [ |
77 | - 'model' => $this->findModel($id), |
|
78 | - ]); |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * Creates a new Less model. |
|
83 | - * If creation is successful, the browser will be redirected to the 'view' page. |
|
84 | - * @return mixed |
|
85 | - */ |
|
86 | - public function actionCreate() |
|
87 | - { |
|
88 | - $model = new Less; |
|
89 | - |
|
90 | - try { |
|
77 | + 'model' => $this->findModel($id), |
|
78 | + ]); |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * Creates a new Less model. |
|
83 | + * If creation is successful, the browser will be redirected to the 'view' page. |
|
84 | + * @return mixed |
|
85 | + */ |
|
86 | + public function actionCreate() |
|
87 | + { |
|
88 | + $model = new Less; |
|
89 | + |
|
90 | + try { |
|
91 | 91 | if ($model->load($_POST) && $model->save()) { |
92 | 92 | return $this->redirect(Url::previous()); |
93 | 93 | } elseif (!\Yii::$app->request->isPost) { |
@@ -96,37 +96,37 @@ discard block |
||
96 | 96 | } catch (\Exception $e) { |
97 | 97 | $msg = (isset($e->errorInfo[2]))?$e->errorInfo[2]:$e->getMessage(); |
98 | 98 | $model->addError('_exception', $msg); |
99 | - } |
|
99 | + } |
|
100 | 100 | return $this->render('create', ['model' => $model]); |
101 | - } |
|
102 | - |
|
103 | - /** |
|
104 | - * Updates an existing Less model. |
|
105 | - * If update is successful, the browser will be redirected to the 'view' page. |
|
106 | - * @param integer $id |
|
107 | - * @return mixed |
|
108 | - */ |
|
109 | - public function actionUpdate($id) |
|
110 | - { |
|
111 | - $model = $this->findModel($id); |
|
112 | - |
|
113 | - if ($model->load($_POST) && $model->save()) { |
|
101 | + } |
|
102 | + |
|
103 | + /** |
|
104 | + * Updates an existing Less model. |
|
105 | + * If update is successful, the browser will be redirected to the 'view' page. |
|
106 | + * @param integer $id |
|
107 | + * @return mixed |
|
108 | + */ |
|
109 | + public function actionUpdate($id) |
|
110 | + { |
|
111 | + $model = $this->findModel($id); |
|
112 | + |
|
113 | + if ($model->load($_POST) && $model->save()) { |
|
114 | 114 | return $this->redirect(Url::previous()); |
115 | - } else { |
|
116 | - return $this->render('update', [ |
|
117 | - 'model' => $model, |
|
118 | - ]); |
|
119 | - } |
|
120 | - } |
|
121 | - |
|
122 | - /** |
|
123 | - * Deletes an existing Less model. |
|
124 | - * If deletion is successful, the browser will be redirected to the 'index' page. |
|
125 | - * @param integer $id |
|
126 | - * @return mixed |
|
127 | - */ |
|
128 | - public function actionDelete($id) |
|
129 | - { |
|
115 | + } else { |
|
116 | + return $this->render('update', [ |
|
117 | + 'model' => $model, |
|
118 | + ]); |
|
119 | + } |
|
120 | + } |
|
121 | + |
|
122 | + /** |
|
123 | + * Deletes an existing Less model. |
|
124 | + * If deletion is successful, the browser will be redirected to the 'index' page. |
|
125 | + * @param integer $id |
|
126 | + * @return mixed |
|
127 | + */ |
|
128 | + public function actionDelete($id) |
|
129 | + { |
|
130 | 130 | try { |
131 | 131 | $this->findModel($id)->delete(); |
132 | 132 | } catch (\Exception $e) { |
@@ -140,29 +140,29 @@ discard block |
||
140 | 140 | if ($isPivot == true) { |
141 | 141 | return $this->redirect(Url::previous()); |
142 | 142 | } elseif (isset(\Yii::$app->session['__crudReturnUrl']) && \Yii::$app->session['__crudReturnUrl'] != '/') { |
143 | - Url::remember(null); |
|
144 | - $url = \Yii::$app->session['__crudReturnUrl']; |
|
145 | - \Yii::$app->session['__crudReturnUrl'] = null; |
|
143 | + Url::remember(null); |
|
144 | + $url = \Yii::$app->session['__crudReturnUrl']; |
|
145 | + \Yii::$app->session['__crudReturnUrl'] = null; |
|
146 | 146 | |
147 | - return $this->redirect($url); |
|
147 | + return $this->redirect($url); |
|
148 | 148 | } else { |
149 | 149 | return $this->redirect(['index']); |
150 | 150 | } |
151 | - } |
|
152 | - |
|
153 | - /** |
|
154 | - * Finds the Less model based on its primary key value. |
|
155 | - * If the model is not found, a 404 HTTP exception will be thrown. |
|
156 | - * @param integer $id |
|
157 | - * @return Less the loaded model |
|
158 | - * @throws HttpException if the model cannot be found |
|
159 | - */ |
|
160 | - protected function findModel($id) |
|
161 | - { |
|
162 | - if (($model = Less::findOne($id)) !== null) { |
|
163 | - return $model; |
|
164 | - } else { |
|
165 | - throw new HttpException(404, 'The requested page does not exist.'); |
|
166 | - } |
|
167 | - } |
|
151 | + } |
|
152 | + |
|
153 | + /** |
|
154 | + * Finds the Less model based on its primary key value. |
|
155 | + * If the model is not found, a 404 HTTP exception will be thrown. |
|
156 | + * @param integer $id |
|
157 | + * @return Less the loaded model |
|
158 | + * @throws HttpException if the model cannot be found |
|
159 | + */ |
|
160 | + protected function findModel($id) |
|
161 | + { |
|
162 | + if (($model = Less::findOne($id)) !== null) { |
|
163 | + return $model; |
|
164 | + } else { |
|
165 | + throw new HttpException(404, 'The requested page does not exist.'); |
|
166 | + } |
|
167 | + } |
|
168 | 168 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | 'rules' => [ |
35 | 35 | [ |
36 | 36 | 'allow' => true, |
37 | - 'matchCallback' => function ($rule, $action) {return \Yii::$app->user->can($this->module->id . '_' . $this->id . '_' . $action->id, ['route' => true]);}, |
|
37 | + 'matchCallback' => function($rule, $action) {return \Yii::$app->user->can($this->module->id.'_'.$this->id.'_'.$action->id, ['route' => true]); }, |
|
38 | 38 | ] |
39 | 39 | ] |
40 | 40 | ] |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $model->load($_GET); |
95 | 95 | } |
96 | 96 | } catch (\Exception $e) { |
97 | - $msg = (isset($e->errorInfo[2]))?$e->errorInfo[2]:$e->getMessage(); |
|
97 | + $msg = (isset($e->errorInfo[2])) ? $e->errorInfo[2] : $e->getMessage(); |
|
98 | 98 | $model->addError('_exception', $msg); |
99 | 99 | } |
100 | 100 | return $this->render('create', ['model' => $model]); |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | try { |
131 | 131 | $this->findModel($id)->delete(); |
132 | 132 | } catch (\Exception $e) { |
133 | - $msg = (isset($e->errorInfo[2]))?$e->errorInfo[2]:$e->getMessage(); |
|
133 | + $msg = (isset($e->errorInfo[2])) ? $e->errorInfo[2] : $e->getMessage(); |
|
134 | 134 | \Yii::$app->getSession()->addFlash('error', $msg); |
135 | 135 | return $this->redirect(Url::previous()); |
136 | 136 | } |
137 | 137 | |
138 | 138 | // TODO: improve detection |
139 | - $isPivot = strstr('$id',','); |
|
139 | + $isPivot = strstr('$id', ','); |
|
140 | 140 | if ($isPivot == true) { |
141 | 141 | return $this->redirect(Url::previous()); |
142 | 142 | } elseif (isset(\Yii::$app->session['__crudReturnUrl']) && \Yii::$app->session['__crudReturnUrl'] != '/') { |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace app\modules\prototype\models\search; |
4 | 4 | |
5 | -use Yii; |
|
6 | 5 | use yii\base\Model; |
7 | 6 | use yii\data\ActiveDataProvider; |
8 | 7 | use app\modules\prototype\models\Less as LessModel; |
@@ -1,7 +1,6 @@ |
||
1 | 1 | |
2 | 2 | <?php |
3 | 3 | use rmrevin\yii\fontawesome\FA; |
4 | -use yii\helpers\Inflector; |
|
5 | 4 | |
6 | 5 | /* |
7 | 6 | * @var yii\web\View $this |
@@ -1,10 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | use dmstr\helpers\Html; |
4 | -use yii\helpers\Url; |
|
5 | -use yii\grid\GridView; |
|
6 | 4 | use yii\widgets\DetailView; |
7 | -use yii\widgets\Pjax; |
|
8 | 5 | use dmstr\bootstrap\Tabs; |
9 | 6 | |
10 | 7 | /** |
@@ -76,15 +76,15 @@ |
||
76 | 76 | |
77 | 77 | |
78 | 78 | <?= Tabs::widget( |
79 | - [ |
|
80 | - 'id' => 'relation-tabs', |
|
81 | - 'encodeLabels' => false, |
|
82 | - 'items' => [ [ |
|
79 | + [ |
|
80 | + 'id' => 'relation-tabs', |
|
81 | + 'encodeLabels' => false, |
|
82 | + 'items' => [ [ |
|
83 | 83 | 'label' => '<b class=""># '.$model->id.'</b>', |
84 | 84 | 'content' => $this->blocks['app\modules\prototype\models\Less'], |
85 | 85 | 'active' => true, |
86 | 86 | ], ] |
87 | - ] |
|
87 | + ] |
|
88 | 88 | ); |
89 | 89 | ?> |
90 | 90 | </div> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | $copyParams = $model->attributes; |
15 | 15 | |
16 | -$this->title = 'Less ' . $model->id; |
|
16 | +$this->title = 'Less '.$model->id; |
|
17 | 17 | $this->params['breadcrumbs'][] = ['label' => 'Lesses', 'url' => ['index']]; |
18 | 18 | $this->params['breadcrumbs'][] = ['label' => (string)$model->id, 'url' => ['view', 'id' => $model->id]]; |
19 | 19 | $this->params['breadcrumbs'][] = Yii::t('app', 'View'); |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | <div class="clearfix crud-navigation"> |
40 | 40 | <!-- menu buttons --> |
41 | 41 | <div class='pull-left'> |
42 | - <?= Html::a('<span class="glyphicon glyphicon-pencil"></span> ' . Yii::t('app', 'Edit'), ['update', 'id' => $model->id],['class' => 'btn btn-info']) ?> |
|
43 | - <?= Html::a('<span class="glyphicon glyphicon-copy"></span> ' . Yii::t('app', 'Copy'), ['create', 'id' => $model->id, 'Less'=>$copyParams],['class' => 'btn btn-success']) ?> |
|
44 | - <?= Html::a('<span class="glyphicon glyphicon-plus"></span> ' . Yii::t('app', 'New'), ['create'], ['class' => 'btn btn-success']) ?> |
|
42 | + <?= Html::a('<span class="glyphicon glyphicon-pencil"></span> '.Yii::t('app', 'Edit'), ['update', 'id' => $model->id], ['class' => 'btn btn-info']) ?> |
|
43 | + <?= Html::a('<span class="glyphicon glyphicon-copy"></span> '.Yii::t('app', 'Copy'), ['create', 'id' => $model->id, 'Less'=>$copyParams], ['class' => 'btn btn-success']) ?> |
|
44 | + <?= Html::a('<span class="glyphicon glyphicon-plus"></span> '.Yii::t('app', 'New'), ['create'], ['class' => 'btn btn-success']) ?> |
|
45 | 45 | </div> |
46 | 46 | <div class="pull-right"> |
47 | - <?= Html::a('<span class="glyphicon glyphicon-list"></span> ' . Yii::t('app', 'List Lesses'), ['index'], ['class'=>'btn btn-default']) ?> |
|
47 | + <?= Html::a('<span class="glyphicon glyphicon-list"></span> '.Yii::t('app', 'List Lesses'), ['index'], ['class'=>'btn btn-default']) ?> |
|
48 | 48 | </div> |
49 | 49 | |
50 | 50 | </div> |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | |
66 | 66 | <hr/> |
67 | 67 | |
68 | - <?= Html::a('<span class="glyphicon glyphicon-trash"></span> ' . Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], |
|
68 | + <?= Html::a('<span class="glyphicon glyphicon-trash"></span> '.Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], |
|
69 | 69 | [ |
70 | 70 | 'class' => 'btn btn-danger', |
71 | - 'data-confirm' => '' . Yii::t('app', 'Are you sure to delete this item?') . '', |
|
71 | + 'data-confirm' => ''.Yii::t('app', 'Are you sure to delete this item?').'', |
|
72 | 72 | 'data-method' => 'post', |
73 | 73 | ]); ?> |
74 | 74 | <?php $this->endBlock(); ?> |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | [ |
80 | 80 | 'id' => 'relation-tabs', |
81 | 81 | 'encodeLabels' => false, |
82 | - 'items' => [ [ |
|
82 | + 'items' => [[ |
|
83 | 83 | 'label' => '<b class=""># '.$model->id.'</b>', |
84 | 84 | 'content' => $this->blocks['app\modules\prototype\models\Less'], |
85 | 85 | 'active' => true, |
@@ -2,8 +2,6 @@ |
||
2 | 2 | |
3 | 3 | use app\assets\AppAsset; |
4 | 4 | use app\widgets\Alert; |
5 | -use yii\bootstrap\Nav; |
|
6 | -use yii\bootstrap\NavBar; |
|
7 | 5 | use yii\helpers\Html; |
8 | 6 | |
9 | 7 | /* @var $this \yii\web\View */ |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Configuration file for the "yii asset" console command. |
|
4 | - * Note that in the console environment, some path aliases like '@webroot' and '@web' may not exist. |
|
5 | - * Please define these missing path aliases. |
|
6 | - */ |
|
3 | + * Configuration file for the "yii asset" console command. |
|
4 | + * Note that in the console environment, some path aliases like '@webroot' and '@web' may not exist. |
|
5 | + * Please define these missing path aliases. |
|
6 | + */ |
|
7 | 7 | return [ |
8 | 8 | // Adjust command/callback for JavaScript files compressing: |
9 | 9 | 'jsCompressor' => 'java -jar /root/compiler.jar --js {from} --js_output_file {to}', |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use schmunk42\giiant\generators\crud\callbacks\yii\Db; |
6 | 6 | use schmunk42\giiant\generators\crud\callbacks\yii\Html; |
7 | 7 | |
8 | -$aceEditorField = function ($attribute, $model, $generator) { |
|
8 | +$aceEditorField = function($attribute, $model, $generator) { |
|
9 | 9 | return "\$form->field(\$model, '{$attribute}')->widget(\\trntv\\aceeditor\\AceEditor::className())"; |
10 | 10 | }; |
11 | 11 |