@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | if (isset($request['error']) && isset($request['error'][1])) { |
12 | 12 | $error = \bedezign\yii2\audit\models\AuditError::findOne($request['error'][1]); |
13 | - $request['error'] = Html::a('[' . $request['error'][0] . '] ' . $error->message, ['error/view', 'id' => $error->id]); |
|
13 | + $request['error'] = Html::a('['.$request['error'][0].'] '.$error->message, ['error/view', 'id' => $error->id]); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | ?> |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | if (is_array($value) || is_object($value)) |
32 | 32 | $value = \yii\helpers\ArrayHelper::toArray($value); |
33 | 33 | elseif ($name == 'duration') |
34 | - $value = number_format($value, 2) . 's'; |
|
34 | + $value = number_format($value, 2).'s'; |
|
35 | 35 | echo $name == 'error' ? $value : $formatter->asText(is_scalar($value) ? $value : VarDumper::dumpAsString($value)); |
36 | 36 | ?> |
37 | 37 | </td> |
@@ -28,10 +28,11 @@ |
||
28 | 28 | <th><?= Html::encode(\yii\helpers\Inflector::humanize($name)) ?></th> |
29 | 29 | <td> |
30 | 30 | <?php |
31 | - if (is_array($value) || is_object($value)) |
|
32 | - $value = \yii\helpers\ArrayHelper::toArray($value); |
|
33 | - elseif ($name == 'duration') |
|
34 | - $value = number_format($value, 2) . 's'; |
|
31 | + if (is_array($value) || is_object($value)) { |
|
32 | + $value = \yii\helpers\ArrayHelper::toArray($value); |
|
33 | + } elseif ($name == 'duration') { |
|
34 | + $value = number_format($value, 2) . 's'; |
|
35 | + } |
|
35 | 36 | echo $name == 'error' ? $value : $formatter->asText(is_scalar($value) ? $value : VarDumper::dumpAsString($value)); |
36 | 37 | ?> |
37 | 38 | </td> |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | 'class' => 'yii\grid\ActionColumn', |
21 | 21 | 'template' => '{view}', |
22 | 22 | 'buttons' => [ |
23 | - 'view' => function ($url, $model) { |
|
23 | + 'view' => function($url, $model) { |
|
24 | 24 | return Html::a( |
25 | 25 | Html::tag('span', '', ['class' => 'glyphicon glyphicon-eye-open']), ['trail/view', 'id' => $model->id] |
26 | 26 | ); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'attribute' => 'user_id', |
41 | 41 | 'label' => Yii::t('audit', 'User ID'), |
42 | 42 | 'class' => 'yii\grid\DataColumn', |
43 | - 'value' => function ($data) { |
|
43 | + 'value' => function($data) { |
|
44 | 44 | return Audit::getInstance()->getUserIdentifier($data->user_id); |
45 | 45 | }, |
46 | 46 | 'options' => [ |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ], |
76 | 76 | [ |
77 | 77 | 'label' => Yii::t('audit', 'Diff'), |
78 | - 'value' => function ($data) { |
|
78 | + 'value' => function($data) { |
|
79 | 79 | return $data->getDiffHtml(); |
80 | 80 | }, |
81 | 81 | 'format' => 'raw', |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $this->title = Yii::t('audit', 'Entry #{id}', ['id' => $model->id]); |
21 | 21 | $this->params['breadcrumbs'][] = ['label' => Yii::t('audit', 'Audit'), 'url' => ['default/index']]; |
22 | 22 | $this->params['breadcrumbs'][] = ['label' => Yii::t('audit', 'Entries'), 'url' => ['index']]; |
23 | -$this->params['breadcrumbs'][] = '#' . $model->id; |
|
23 | +$this->params['breadcrumbs'][] = '#'.$model->id; |
|
24 | 24 | |
25 | 25 | ?> |
26 | 26 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | <div class="list-group"> |
84 | 84 | <?php |
85 | 85 | foreach ($panels as $id => $panel) { |
86 | - $label = '<i class="glyphicon glyphicon-chevron-right"></i>' . $panel->getLabel(); |
|
86 | + $label = '<i class="glyphicon glyphicon-chevron-right"></i>'.$panel->getLabel(); |
|
87 | 87 | echo Html::a($label, ['view', 'id' => $model->id, 'panel' => $id], [ |
88 | 88 | 'class' => $panel === $activePanel ? 'list-group-item active' : 'list-group-item', |
89 | 89 | ]); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | [ |
32 | 32 | 'attribute' => 'entry_id', |
33 | 33 | 'class' => 'yii\grid\DataColumn', |
34 | - 'value' => function ($data) { |
|
34 | + 'value' => function($data) { |
|
35 | 35 | return $data->entry_id ? Html::a($data->entry_id, ['entry/view', 'id' => $data->entry_id]) : ''; |
36 | 36 | }, |
37 | 37 | 'format' => 'raw', |
@@ -9,7 +9,7 @@ |
||
9 | 9 | $this->title = Yii::t('audit', 'Javascript #{id}', ['id' => $model->id]); |
10 | 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('audit', 'Audit'), 'url' => ['default/index']]; |
11 | 11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('audit', 'Javascripts'), 'url' => ['index']]; |
12 | -$this->params['breadcrumbs'][] = '#' . $model->id; |
|
12 | +$this->params['breadcrumbs'][] = '#'.$model->id; |
|
13 | 13 | |
14 | 14 | echo Html::tag('h1', $this->title); |
15 | 15 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | [ |
28 | 28 | 'attribute' => 'entry_id', |
29 | 29 | 'class' => 'yii\grid\DataColumn', |
30 | - 'value' => function ($data) { |
|
30 | + 'value' => function($data) { |
|
31 | 31 | return $data->entry_id ? Html::a($data->entry_id, ['entry/view', 'id' => $data->entry_id]) : ''; |
32 | 32 | }, |
33 | 33 | 'format' => 'raw', |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | 'attribute' => 'user_id', |
37 | 37 | 'label' => Yii::t('audit', 'User ID'), |
38 | 38 | 'class' => 'yii\grid\DataColumn', |
39 | - 'value' => function ($data) { |
|
39 | + 'value' => function($data) { |
|
40 | 40 | return Audit::getInstance()->getUserIdentifier($data->user_id); |
41 | 41 | }, |
42 | 42 | 'format' => 'raw', |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'field', |
51 | 51 | [ |
52 | 52 | 'label' => Yii::t('audit', 'Diff'), |
53 | - 'value' => function ($model) { |
|
53 | + 'value' => function($model) { |
|
54 | 54 | return $model->getDiffHtml(); |
55 | 55 | }, |
56 | 56 | 'format' => 'raw', |
@@ -10,7 +10,7 @@ |
||
10 | 10 | $this->title = Yii::t('audit', 'Trail #{id}', ['id' => $model->id]); |
11 | 11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('audit', 'Audit'), 'url' => ['default/index']]; |
12 | 12 | $this->params['breadcrumbs'][] = ['label' => Yii::t('audit', 'Trails'), 'url' => ['trail/index']]; |
13 | -$this->params['breadcrumbs'][] = '#' . $model->id; |
|
13 | +$this->params['breadcrumbs'][] = '#'.$model->id; |
|
14 | 14 | |
15 | 15 | echo Html::tag('h1', $this->title); |
16 | 16 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | $this->title = Yii::t('audit', 'Mail #{id}', ['id' => $model->id]); |
14 | 14 | $this->params['breadcrumbs'][] = ['label' => Yii::t('audit', 'Audit'), 'url' => ['default/index']]; |
15 | 15 | $this->params['breadcrumbs'][] = ['label' => Yii::t('audit', 'Mails'), 'url' => ['index']]; |
16 | -$this->params['breadcrumbs'][] = '#' . $model->id; |
|
16 | +$this->params['breadcrumbs'][] = '#'.$model->id; |
|
17 | 17 | |
18 | 18 | echo Html::tag('h1', $this->title); |
19 | 19 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | echo Html::tag('h2', Yii::t('audit', 'HTML')); |
51 | 51 | echo '<div class="well">'; |
52 | -echo '<iframe src="' . Url::to(['mail/view-html', 'id' => $model->id]) . '" style="width:100%;" onload="this.style.height = this.contentWindow.document.body.scrollHeight + \'px\';" frameborder="0"></iframe>'; |
|
52 | +echo '<iframe src="'.Url::to(['mail/view-html', 'id' => $model->id]).'" style="width:100%;" onload="this.style.height = this.contentWindow.document.body.scrollHeight + \'px\';" frameborder="0"></iframe>'; |
|
53 | 53 | //echo Yii::$app->formatter->asHtml($model->html); |
54 | 54 | echo '</div>'; |
55 | 55 |
@@ -3,7 +3,6 @@ |
||
3 | 3 | /** @var View $this */ |
4 | 4 | /** @var AuditMail $model */ |
5 | 5 | |
6 | -use bedezign\yii2\audit\components\Helper; |
|
7 | 6 | use bedezign\yii2\audit\models\AuditMail; |
8 | 7 | use yii\helpers\Html; |
9 | 8 | use yii\helpers\Url; |
@@ -218,8 +218,8 @@ |
||
218 | 218 | $query = new Query; |
219 | 219 | |
220 | 220 | $query->select($queryParams['returnField']) |
221 | - ->from($queryParams['tableName']) |
|
222 | - ->where([$queryParams['searchField'] => $searchFieldValue]); |
|
221 | + ->from($queryParams['tableName']) |
|
222 | + ->where([$queryParams['searchField'] => $searchFieldValue]); |
|
223 | 223 | |
224 | 224 | $rows = $query->all(); |
225 | 225 |
@@ -237,13 +237,15 @@ |
||
237 | 237 | $oldAttributes = $this->cleanAttributes($this->getOldAttributes()); |
238 | 238 | |
239 | 239 | // ensure to handle serialized attributes properly |
240 | - foreach($newAttributes as $key => $value) |
|
241 | - if(is_array($newAttributes[$key])) |
|
240 | + foreach($newAttributes as $key => $value) { |
|
241 | + if(is_array($newAttributes[$key])) |
|
242 | 242 | $newAttributes[$key] = Json::encode($newAttributes[$key]); |
243 | + } |
|
243 | 244 | |
244 | - foreach($oldAttributes as $key => $value) |
|
245 | - if(is_array($oldAttributes[$key])) |
|
245 | + foreach($oldAttributes as $key => $value) { |
|
246 | + if(is_array($oldAttributes[$key])) |
|
246 | 247 | $oldAttributes[$key] = Json::encode($oldAttributes[$key]); |
248 | + } |
|
247 | 249 | |
248 | 250 | // If no difference then get out of here |
249 | 251 | if (count(array_diff_assoc($newAttributes, $oldAttributes)) <= 0) { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | protected function cleanAttributesIgnored($attributes) |
182 | 182 | { |
183 | - if(is_array($this->timestamp_fields) && count($this->timestamp_fields) > 0) { |
|
183 | + if (is_array($this->timestamp_fields) && count($this->timestamp_fields) > 0) { |
|
184 | 184 | $this->ignored = array_merge($this->ignored, $this->timestamp_fields); |
185 | 185 | } |
186 | 186 | |
@@ -202,12 +202,12 @@ discard block |
||
202 | 202 | */ |
203 | 203 | protected function cleanAttributesOverride($attributes) |
204 | 204 | { |
205 | - if (sizeof($this->override) > 0 && sizeof($attributes) >0) { |
|
205 | + if (sizeof($this->override) > 0 && sizeof($attributes) > 0) { |
|
206 | 206 | foreach ($this->override as $field => $queryParams) { |
207 | 207 | $newOverrideValues = $this->getNewOverrideValues($attributes[$field], $queryParams); |
208 | 208 | $saveField = \yii\helpers\ArrayHelper::getValue($queryParams, 'saveField', $field); |
209 | 209 | |
210 | - if (count($newOverrideValues) >1) { |
|
210 | + if (count($newOverrideValues) > 1) { |
|
211 | 211 | $attributes[$saveField] = implode(', ', |
212 | 212 | \yii\helpers\ArrayHelper::map($newOverrideValues, $queryParams['returnField'], $queryParams['returnField']) |
213 | 213 | ); |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | $oldAttributes = $this->cleanAttributes($this->getOldAttributes()); |
250 | 250 | |
251 | 251 | // ensure to handle serialized attributes properly |
252 | - foreach($newAttributes as $key => $value) |
|
253 | - if(is_array($newAttributes[$key])) |
|
252 | + foreach ($newAttributes as $key => $value) |
|
253 | + if (is_array($newAttributes[$key])) |
|
254 | 254 | $newAttributes[$key] = Json::encode($newAttributes[$key]); |
255 | 255 | |
256 | - foreach($oldAttributes as $key => $value) |
|
257 | - if(is_array($oldAttributes[$key])) |
|
256 | + foreach ($oldAttributes as $key => $value) |
|
257 | + if (is_array($oldAttributes[$key])) |
|
258 | 258 | $oldAttributes[$key] = Json::encode($oldAttributes[$key]); |
259 | 259 | |
260 | 260 | // If no difference then get out of here |