@@ -72,7 +72,7 @@ |
||
72 | 72 | 'attributes' => [ |
73 | 73 | ActiveRecord::EVENT_BEFORE_INSERT => 'user_id' |
74 | 74 | ], |
75 | - 'value' => function () { |
|
75 | + 'value' => function() { |
|
76 | 76 | return Yii::$app->user->id; |
77 | 77 | } |
78 | 78 | ], |
@@ -3,7 +3,7 @@ |
||
3 | 3 | $config = [ |
4 | 4 | 'components' => [ |
5 | 5 | 'cache' => [ |
6 | - 'keyPrefix' => 'rest', //前缀 |
|
6 | + 'keyPrefix' => 'rest', //前缀 |
|
7 | 7 | ], |
8 | 8 | 'request' => [ |
9 | 9 | 'class' => yuncms\console\Request::class, |
@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | use Yii; |
22 | 22 | use <?= $generator->baseClass?>; |
23 | 23 | use yii\db\Connection; |
24 | -<?php if(isset($labels['slug']) || isset($labels['uuid'])): ?> |
|
24 | +<?php if (isset($labels['slug']) || isset($labels['uuid'])): ?> |
|
25 | 25 | use yii\helpers\Inflector; |
26 | 26 | <?php endif; ?> |
27 | 27 | |
28 | 28 | use yii\caching\DbDependency; |
29 | 29 | use yii\caching\ChainedDependency; |
30 | -<?php if(isset($labels['created_at'])): ?> |
|
30 | +<?php if (isset($labels['created_at'])): ?> |
|
31 | 31 | use yii\behaviors\TimestampBehavior; |
32 | 32 | <?php endif; ?> |
33 | -<?php if(isset($labels['user_id'])): ?> |
|
33 | +<?php if (isset($labels['user_id'])): ?> |
|
34 | 34 | use yii\behaviors\BlameableBehavior; |
35 | 35 | <?php endif; ?> |
36 | -<?php if(isset($labels['slug']) || isset($labels['uuid'])): ?> |
|
36 | +<?php if (isset($labels['slug']) || isset($labels['uuid'])): ?> |
|
37 | 37 | use yii\behaviors\AttributeBehavior; |
38 | 38 | <?php endif; ?> |
39 | 39 | use yuncms\helpers\DateHelper; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | <?php endif; ?> |
54 | 54 | * |
55 | 55 | * @property-read boolean $isAuthor 是否是作者 |
56 | -<?php if(isset($labels['status'])): ?> |
|
56 | +<?php if (isset($labels['status'])): ?> |
|
57 | 57 | * @property-read boolean $isDraft 是否草稿 |
58 | 58 | * @property-read boolean $isPublished 是否发布 |
59 | 59 | <?php endif; ?> |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | //场景定义 |
65 | 65 | const SCENARIO_CREATE = 'create';//创建 |
66 | 66 | const SCENARIO_UPDATE = 'update';//更新 |
67 | -<?php if(isset($labels['status'])): ?> |
|
67 | +<?php if (isset($labels['status'])): ?> |
|
68 | 68 | //状态定义 |
69 | 69 | const STATUS_DRAFT = 0b0;//草稿 |
70 | 70 | const STATUS_REVIEW = 0b1;//待审核 |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $behaviors['timestamp'] = [ |
98 | 98 | 'class' => TimestampBehavior::className() |
99 | 99 | ]; |
100 | -<?php elseif(isset($labels['created_at'])): ?> |
|
100 | +<?php elseif (isset($labels['created_at'])): ?> |
|
101 | 101 | $behaviors['timestamp'] = [ |
102 | 102 | 'class' => TimestampBehavior::className(), |
103 | 103 | 'attributes' => [ |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | ], |
106 | 106 | ]; |
107 | 107 | <?php endif; ?> |
108 | -<?php if(isset($labels['user_id'])): ?> |
|
108 | +<?php if (isset($labels['user_id'])): ?> |
|
109 | 109 | $behaviors['user'] = [ |
110 | 110 | 'class' => BlameableBehavior::className(), |
111 | 111 | 'attributes' => [ |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | ], |
114 | 114 | ]; |
115 | 115 | <?php endif; ?> |
116 | -<?php if(isset($labels['slug'])): ?> |
|
116 | +<?php if (isset($labels['slug'])): ?> |
|
117 | 117 | $behaviors['slug'] = [ |
118 | 118 | 'class' => AttributeBehavior::className(), |
119 | 119 | 'attributes' => [ |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | ]; |
126 | 126 | <?php endif; ?> |
127 | -<?php if(isset($labels['uuid'])): ?> |
|
127 | +<?php if (isset($labels['uuid'])): ?> |
|
128 | 128 | $behaviors['uuid'] = [ |
129 | 129 | 'class' => AttributeBehavior::className(), |
130 | 130 | 'attributes' => [ |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function rules() |
168 | 168 | { |
169 | - return [<?= "\n " . implode(",\n ", $rules) . ",\n " ?> <?php if(isset($labels['status'])): ?>// status rule |
|
169 | + return [<?= "\n " . implode(",\n ", $rules) . ",\n " ?> <?php if (isset($labels['status'])): ?>// status rule |
|
170 | 170 | ['status', 'default', 'value' => self::STATUS_REVIEW], |
171 | 171 | ['status', 'in', 'range' => [self::STATUS_DRAFT, self::STATUS_REVIEW, self::STATUS_REJECTED, self::STATUS_PUBLISHED]],<?php endif; ?> |
172 | 172 | ]; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | { |
216 | 216 | return $this->user_id == Yii::$app->user->id; |
217 | 217 | } |
218 | -<?php if(isset($labels['status'])): ?> |
|
218 | +<?php if (isset($labels['status'])): ?> |
|
219 | 219 | /** |
220 | 220 | * 是否草稿状态 |
221 | 221 | * @return bool |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | ])); |
365 | 365 | return $total; |
366 | 366 | } |
367 | -<?php if(isset($labels['created_at'])): ?> |
|
367 | +<?php if (isset($labels['created_at'])): ?> |
|
368 | 368 | |
369 | 369 | /** |
370 | 370 | * 获取模型今日新增总数 |
@@ -68,7 +68,7 @@ |
||
68 | 68 | return [ |
69 | 69 | [['ruleName'], 'checkRule'], |
70 | 70 | [['name', 'type'], 'required'], |
71 | - [['name'], 'checkUnique', 'when' => function () { |
|
71 | + [['name'], 'checkUnique', 'when' => function() { |
|
72 | 72 | return $this->isNewRecord || ($this->_item->name != $this->name); |
73 | 73 | }], |
74 | 74 | [['type'], 'integer'], |
@@ -81,7 +81,7 @@ |
||
81 | 81 | $model = new UserAuthItem(null); |
82 | 82 | $model->type = $this->type; |
83 | 83 | if ($model->load(Yii::$app->getRequest()->post()) && $model->save()) { |
84 | - Yii::$app->getSession()->setFlash('success', Yii::t('yuncms','Create success.')); |
|
84 | + Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'Create success.')); |
|
85 | 85 | return $this->redirect(['view', 'id' => $model->name]); |
86 | 86 | } else { |
87 | 87 | return $this->render('create', ['model' => $model]); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | unset($rules[RouteRule::RULE_NAME]); |
16 | 16 | ?> |
17 | 17 | |
18 | -<?php $form = ActiveForm::begin(['layout' => 'horizontal',]); ?> |
|
18 | +<?php $form = ActiveForm::begin(['layout' => 'horizontal', ]); ?> |
|
19 | 19 | <?= $form->field($model, 'name')->textInput(['maxlength' => 64]) ?> |
20 | 20 | <div class="hr-line-dashed"></div> |
21 | 21 | <?= $form->field($model, 'description')->textarea(['rows' => 2]) ?> |
@@ -81,7 +81,7 @@ |
||
81 | 81 | 'attribute' => 'description', |
82 | 82 | 'label' => Yii::t('yuncms', 'Role Description'), |
83 | 83 | ], |
84 | - ['class' => 'yuncms\grid\ActionColumn',], |
|
84 | + ['class' => 'yuncms\grid\ActionColumn', ], |
|
85 | 85 | ], |
86 | 86 | ]) |
87 | 87 | ?> |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | $model = new UserBizRule(null); |
74 | 74 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
75 | 75 | UserRBACHelper::invalidate(); |
76 | - Yii::$app->getSession()->setFlash('success', Yii::t('yuncms','Create success.')); |
|
76 | + Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'Create success.')); |
|
77 | 77 | return $this->redirect(['view', 'id' => $model->name]); |
78 | 78 | } else { |
79 | - return $this->render('create', ['model' => $model,]); |
|
79 | + return $this->render('create', ['model' => $model, ]); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | $model = $this->findModel($id); |
94 | 94 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
95 | 95 | UserRBACHelper::invalidate(); |
96 | - Yii::$app->getSession()->setFlash('success', Yii::t('yuncms','Update success.')); |
|
96 | + Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'Update success.')); |
|
97 | 97 | return $this->redirect(['view', 'id' => $model->name]); |
98 | 98 | } |
99 | 99 | |
100 | - return $this->render('update', ['model' => $model,]); |
|
100 | + return $this->render('update', ['model' => $model, ]); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $model = $this->findModel($id); |
114 | 114 | Yii::$app->authManager->remove($model->item); |
115 | 115 | UserRBACHelper::invalidate(); |
116 | - Yii::$app->getSession()->setFlash('success', Yii::t('yuncms','Delete success.')); |
|
116 | + Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'Delete success.')); |
|
117 | 117 | return $this->redirect(['index']); |
118 | 118 | } |
119 | 119 |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | // ], |
75 | 75 | [ |
76 | 76 | 'attribute' => 'registration_ip', |
77 | - 'value' => function ($model) { |
|
77 | + 'value' => function($model) { |
|
78 | 78 | return $model->registration_ip == null |
79 | 79 | ? '<span class="not-set">' . Yii::t('yii', '(not set)') . '</span>' |
80 | 80 | : $model->registration_ip; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | ], |
97 | 97 | [ |
98 | 98 | 'header' => Yii::t('yuncms', 'Confirmation'), |
99 | - 'value' => function ($model) { |
|
99 | + 'value' => function($model) { |
|
100 | 100 | if ($model->isEmailConfirmed) { |
101 | 101 | return '<div class="text-center"><span class="text-success">' . Yii::t('yuncms', 'Confirmed') . '</span></div>'; |
102 | 102 | } else { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | ], |
113 | 113 | [ |
114 | 114 | 'header' => Yii::t('yuncms', 'Block status'), |
115 | - 'value' => function ($model) { |
|
115 | + 'value' => function($model) { |
|
116 | 116 | if ($model->isBlocked) { |
117 | 117 | return Html::a(Yii::t('yuncms', 'Unblock'), ['block', 'id' => $model->id], [ |
118 | 118 | 'class' => 'btn btn-xs btn-success btn-block', |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | [ |
133 | 133 | 'class' => 'yuncms\grid\ActionColumn', |
134 | 134 | 'template' => '{assignment} {view} {update} {delete}', |
135 | - 'buttons' => ['assignment' => function ($url, $model, $key) { |
|
135 | + 'buttons' => ['assignment' => function($url, $model, $key) { |
|
136 | 136 | return Html::a('<span class="glyphicon glyphicon-dashboard"></span>', |
137 | 137 | Url::toRoute(['user-assignment/view', 'id' => $model->id]), [ |
138 | 138 | 'title' => Yii::t('yuncms', 'Assignment'), |