Browse Source

PHP8 support 2

master
Error202 3 years ago
parent
commit
d342f81838
  1. 2
      Vagrantfile
  2. 3
      backend/assets/AdminLteSkinAsset.php
  3. 11
      backend/assets/AppAsset.php
  4. 2
      backend/bootstrap/SetUp.php
  5. 35
      backend/components/ToggleAction.php
  6. 30
      backend/components/ToggleColumn.php
  7. 50
      backend/components/menu/css/menu.css
  8. 11
      backend/components/menu/widgets/MenuEditorWidget.php
  9. 49
      backend/components/menu/widgets/views/_item.php
  10. 17
      backend/components/menu/widgets/views/_item_tab.php
  11. 161
      backend/components/menu/widgets/views/menu.php
  12. 42
      backend/config/main.php
  13. 11
      backend/controllers/AuthController.php
  14. 59
      backend/controllers/MenuController.php
  15. 61
      backend/controllers/ModuleController.php
  16. 38
      backend/controllers/PermissionController.php
  17. 70
      backend/controllers/RoleController.php
  18. 43
      backend/controllers/SiteController.php
  19. 40
      backend/controllers/SliderController.php
  20. 56
      backend/controllers/UserController.php
  21. 39
      backend/controllers/post/CategoryController.php
  22. 40
      backend/controllers/post/CommentController.php
  23. 71
      backend/controllers/post/PostController.php
  24. 37
      backend/controllers/post/TagController.php
  25. 27
      backend/controllers/post/TypeController.php
  26. 52
      backend/controllers/settings/ListController.php
  27. 18
      backend/forms/SettingsSearch.php
  28. 19
      backend/forms/UserSearch.php
  29. 14
      backend/forms/rbac/RbacCreatePermissionForm.php
  30. 14
      backend/forms/rbac/RbacCreateRoleForm.php
  31. 15
      backend/forms/rbac/RbacEditPermissionForm.php
  32. 15
      backend/forms/rbac/RbacEditRoleForm.php
  33. 6
      backend/forms/rbac/RbacUpdateChildren.php
  34. 13
      backend/helpers/DashboardHelper.php
  35. 1
      backend/messages/ru/menu.php
  36. 8
      backend/views/auth/login.php
  37. 238
      backend/views/layouts/content-origin.php
  38. 289
      backend/views/layouts/content.php
  39. 33
      backend/views/layouts/error-origin.php
  40. 11
      backend/views/layouts/error.php
  41. 265
      backend/views/layouts/header-origin.php
  42. 306
      backend/views/layouts/header.php
  43. 211
      backend/views/layouts/left-origin.php
  44. 371
      backend/views/layouts/left.php
  45. 31
      backend/views/layouts/main-login-origin.php
  46. 29
      backend/views/layouts/main-login.php
  47. 66
      backend/views/layouts/main-origin.php
  48. 140
      backend/views/layouts/main.php
  49. 18
      backend/views/menu/_form.php
  50. 11
      backend/views/menu/_form_tab.php
  51. 4
      backend/views/menu/create.php
  52. 74
      backend/views/menu/menu.php
  53. 10
      backend/views/menu/select_menu.php
  54. 7
      backend/views/menu/update.php
  55. 14
      backend/views/module/list.php
  56. 3
      backend/views/module/remote-list.php
  57. 14
      backend/views/permission/create.php
  58. 12
      backend/views/permission/index.php
  59. 18
      backend/views/permission/update.php
  60. 14
      backend/views/permission/view.php
  61. 18
      backend/views/post/articles/_form.php
  62. 7
      backend/views/post/articles/create.php
  63. 12
      backend/views/post/articles/index.php
  64. 13
      backend/views/post/articles/update.php
  65. 6
      backend/views/post/articles/view.php
  66. 18
      backend/views/post/blog/_form.php
  67. 7
      backend/views/post/blog/create.php
  68. 9
      backend/views/post/blog/index.php
  69. 13
      backend/views/post/blog/update.php
  70. 6
      backend/views/post/blog/view.php
  71. 5
      backend/views/post/category/_form.php
  72. 7
      backend/views/post/category/create.php
  73. 6
      backend/views/post/category/index.php
  74. 10
      backend/views/post/category/update.php
  75. 6
      backend/views/post/category/view.php
  76. 3
      backend/views/post/comment/index.php
  77. 6
      backend/views/post/comment/update.php
  78. 8
      backend/views/post/comment/view.php
  79. 16
      backend/views/post/gallery/_form.php
  80. 7
      backend/views/post/gallery/create.php
  81. 9
      backend/views/post/gallery/index.php
  82. 10
      backend/views/post/gallery/update.php
  83. 6
      backend/views/post/gallery/view.php
  84. 18
      backend/views/post/news/_form.php
  85. 7
      backend/views/post/news/create.php
  86. 12
      backend/views/post/news/index.php
  87. 13
      backend/views/post/news/update.php
  88. 6
      backend/views/post/news/view.php
  89. 18
      backend/views/post/post/_form.php
  90. 7
      backend/views/post/post/create.php
  91. 12
      backend/views/post/post/index.php
  92. 13
      backend/views/post/post/update.php
  93. 6
      backend/views/post/post/view.php
  94. 3
      backend/views/post/tag/_form.php
  95. 7
      backend/views/post/tag/create.php
  96. 6
      backend/views/post/tag/index.php
  97. 10
      backend/views/post/tag/update.php
  98. 6
      backend/views/post/tag/view.php
  99. 3
      backend/views/post/type/_form.php
  100. 4
      backend/views/post/type/create.php
  101. Some files were not shown because too many files have changed in this diff Show More

2
Vagrantfile vendored

@ -32,7 +32,7 @@ end
# vagrant configurate
Vagrant.configure(2) do |config|
# select the box
config.vm.box = 'bento/ubuntu-16.04'
config.vm.box = 'bento/ubuntu-20.04'
# should we ask about box updates?
config.vm.box_check_update = options['box_check_update']

3
backend/assets/AdminLteSkinAsset.php

@ -6,7 +6,6 @@
namespace backend\assets;
use yii\web\AssetBundle;
class AdminLteSkinAsset extends AssetBundle
@ -14,4 +13,4 @@ class AdminLteSkinAsset extends AssetBundle
public $css = [
'css/skin.css',
];
}
}

11
backend/assets/AppAsset.php

@ -2,7 +2,10 @@
namespace backend\assets;
use yii\bootstrap\BootstrapAsset;
use yii\bootstrap\BootstrapPluginAsset;
use yii\web\AssetBundle;
use yii\web\YiiAsset;
/**
* Main backend application asset bundle.
@ -12,12 +15,14 @@ class AppAsset extends AssetBundle
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/site.css',
'css/site.css?v1.01',
'css/ui.jqgrid-bootstrap.css'
];
public $js = [
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapPluginAsset',
YiiAsset::class,
BootstrapAsset::class,
BootstrapPluginAsset::class
];
}

2
backend/bootstrap/SetUp.php

@ -46,7 +46,7 @@ class SetUp implements BootstrapInterface
// load settings
$settings = Settings::find()->with('translations')->andWhere(['active' => 1])->all();
$settings_array = $settings ? ArrayHelper::map($settings, 'key', function ($el) {
return isset($el->translation->value) ? $el->translation->value : '';
return $el->translation->value ?? '';
}, 'section') : [];
$app->params['settings'] = $settings_array;

35
backend/components/ToggleAction.php

@ -7,59 +7,68 @@
namespace backend\components;
use yii\base\Action;
use yii\base\ExitException;
use yii\db\ActiveRecord;
use yii\db\Expression;
use yii\base\InvalidConfigException;
use yii\web\MethodNotAllowedHttpException;
use Yii;
use yii\web\Response;
class ToggleAction extends Action
{
/**
* @var string name of the model
*/
public $modelClass;
public string $modelClass;
/**
* @var string model attribute
*/
public $attribute = 'active';
public string $attribute = 'active';
/**
* @var string scenario model
*/
public $scenario = null;
public ?string $scenario = null;
/**
* @var string|array additional condition for loading the model
*/
public $andWhere;
public string|array $andWhere;
/**
* @var string|int|boolean|Expression what to set active models to
*/
public $onValue = 1;
public string|int|bool|Expression $onValue = 1;
/**
* @var string|int|boolean what to set inactive models to
*/
public $offValue = 0;
public string|int|bool $offValue = 0;
/**
* @var bool whether to set flash messages or not
*/
public $setFlash = false;
public bool $setFlash = false;
/**
* @var string flash message on success
*/
public $flashSuccess = 'Model saved';
public string $flashSuccess = 'Model saved';
/**
* @var string flash message on error
*/
public $flashError = 'Error saving Model';
public string $flashError = 'Error saving Model';
/**
* @var string|array URL to redirect to
*/
public $redirect;
public string|array $redirect;
/**
* @var string pk field name
*/
public $primaryKey = 'id';
public string $primaryKey = 'id';
/**
* @param $id
* @return Response
* @throws InvalidConfigException
* @throws MethodNotAllowedHttpException
* @throws ExitException
*/
public function run($id)
{
if (!Yii::$app->request->getIsPost()) {
@ -70,7 +79,7 @@ class ToggleAction extends Action
if (empty($this->modelClass) || !class_exists($this->modelClass)) {
throw new InvalidConfigException("Model class doesn't exist");
}
/* @var $modelClass \yii\db\ActiveRecord */
/* @var $modelClass ActiveRecord */
$modelClass = $this->modelClass;
$attribute = $this->attribute;
$model = $modelClass::find()->where([$this->primaryKey => $id]);

30
backend/components/ToggleColumn.php

@ -17,54 +17,54 @@ class ToggleColumn extends DataColumn
* Toggle action that will be used as the toggle action in your controller
* @var string
*/
public $action = 'toggle';
public string $action = 'toggle';
/**
* @var string pk field name
*/
public $primaryKey = 'primaryKey';
public string $primaryKey = 'primaryKey';
/**
* Whether to use ajax or not
* @var bool
*/
public $enableAjax = true;
public bool $enableAjax = true;
/**
* @var string glyphicon for 'on' value
*/
public $iconOn = 'ok';
public string $iconOn = 'ok';
/**
* @var string glyphicon for 'off' value
*/
public $iconOff = 'remove';
public string $iconOff = 'remove';
/**
* @var string text to display on the 'on' link
* @var string|null text to display on the 'on' link
*/
public $onText;
public ?string $onText = null;
/**
* @var string text to display on the 'off' link
* @var string|null text to display on the 'off' link
*/
public $offText;
public ?string $offText = null;
/**
* @var string text to display next to the 'on' link
* @var string|bool text to display next to the 'on' link
*/
public $displayValueText = false;
public string|bool $displayValueText = false;
/**
* @var string text to display next to the 'on' link
* @var string|null text to display next to the 'on' link
*/
public $onValueText;
public ?string $onValueText = null;
/**
* @var string text to display next to the 'off' link
* @var string|null text to display next to the 'off' link
*/
public $offValueText;
public ?string $offValueText = null;
public function init()

50
backend/components/menu/css/menu.css

@ -22,7 +22,7 @@ p { line-height: 1.5em; }
position: relative;
display: block;
margin: 0; padding: 0;
max-width: 600px;
/*max-width: 600px;*/
list-style: none;
font-size: 13px;
line-height: 20px;
@ -43,7 +43,8 @@ p { line-height: 1.5em; }
.dd-placeholder {
display: block;
position: relative;
margin: 0; padding: 1px;
margin: 0;
padding: 1px;
min-height: 20px;
font-size: 13px;
line-height: 10px;
@ -134,7 +135,7 @@ p { line-height: 1.5em; }
@media only screen and (min-width: 700px) {
.dd { float: left; width: 70%; }
.dd { float: left; width: 100%; }
.dd + .dd { margin-left: 2%; }
}
@ -167,9 +168,19 @@ p { line-height: 1.5em; }
.dd-dragel > .dd3-item > .dd3-content { margin: 0; }
.dd3-item > button { margin-left: 30px; }
.dd3-item > button {
position: absolute;
margin-left: 30px;
}
.dd3-handle { position: absolute; margin: 0; left: 0; top: 0; cursor: pointer; width: 30px; text-indent: 100%; white-space: nowrap; overflow: hidden;
.dd3-handle {
position: absolute;
margin: 0; left: 0; top: 0;
cursor: pointer;
width: 30px;
/*text-indent: 100%;*/
white-space: nowrap;
overflow: hidden;
border: 1px solid #aaa;
background: #ddd;
background: -webkit-linear-gradient(top, #ddd 0%, #bbb 100%);
@ -179,8 +190,8 @@ p { line-height: 1.5em; }
border-bottom-right-radius: 0;
}
.dd3-handle:before {
content: "\f047";
font-family: FontAwesome;
content: "\f0b2";
font-family: "Font Awesome 5 Free";
display: block;
position: absolute;
left: 0; top: 10px;
@ -189,16 +200,29 @@ p { line-height: 1.5em; }
text-indent: 0;
color: #fff;
font-size: 15px;
font-weight: normal;
/*font-weight: normal;*/
}
.dd3-handle:hover { background: #ddd; }
.panel-group {
.card-group {
margin-bottom: 0 !important;
}
.panel-heading {
position: relative;
.card-header {
position: relative !important;
color: #333333 !important;
background-color: #f5f5f5 !important;
border-color: #ddd !important;
}
.card-header h4 {
padding-left: 15px;
font-size: 16px;
}
.panel-heading h4 {
padding-left: 25px;
.card-header h4 a {
color: #333333;
}
.menu-selector p, .menu-selector .form-group {
margin: 0 !important;
padding: 0 !important;
}

11
backend/components/menu/widgets/MenuEditorWidget.php

@ -12,9 +12,9 @@ use yii\base\Widget;
class MenuEditorWidget extends Widget
{
public $menu_id;
public int $menu_id;
public function run()
public function run(): string
{
$menu = Menu::findOne($this->menu_id);
$items = $menu->items;
@ -26,14 +26,15 @@ class MenuEditorWidget extends Widget
}
/**
* @param $items MenuItem[]
*
* @param array $items
* @param null $paren_id
* @return array
*/
private function getMenu($items, $paren_id = null)
private function getMenu(array $items, $paren_id = null): array
{
$array = [];
foreach ($items as $item) {
/* @var $item MenuItem */
if ($item->parent_id != $paren_id) {
continue;
}

49
backend/components/menu/widgets/views/_item.php

@ -4,33 +4,44 @@
* Date: 11.07.2018
*/
use core\components\bootstrap4\widgets\Tab4;
use core\entities\menu\MenuItem;
use core\forms\menu\MenuItemForm;
use yii\helpers\Html;
use kartik\form\ActiveForm;
use yii\web\View;
/**
* @var $this \yii\web\View
* @var $this View
* @var $item array
* @var $model \core\forms\menu\MenuItemForm
* @var $model MenuItemForm
*/
/* @var $menu_item \core\entities\menu\MenuItem */
/* @var $menu_item MenuItem */
$menu_item = $item['item'];
?>
<li class="dd-item dd3-item" data-id="<?= $menu_item->id ?>">
<li class="dd-item dd3-item" data-id="<?= $menu_item->id ?>" xmlns="http://www.w3.org/1999/html">
<div class="dd3-content">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="card-group" id="accordion">
<div class="card m-0">
<div class="card-header" style="border: 0 !important; padding-left: 40px;">
<h4 class="card-title">
<div class="dd-handle dd3-handle"> </div>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse<?= $menu_item->id ?>"><?= $menu_item->translation->name ?>
<i class="fa fa-angle-down pull-right" aria-hidden="true"></i> <span style="font-size: 14px; color: #999" class="pull-right"><?= Yii::t($menu_item->module, ucfirst($menu_item->module)) ?></span></a>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse<?= $menu_item->id ?>">
<?= $menu_item->translation->name ?>
<div style="position: absolute; right: 10px; top: 10px;">
<span style="font-size: 14px; color: #999"><?= Yii::t($menu_item->module, ucfirst($menu_item->module)) ?></span>
<i class="fas fa-angle-down" aria-hidden="true"></i>
</div>
</a>
</h4>
<div>
</div>
</div>
<div id="collapse<?= $menu_item->id ?>" class="panel-collapse collapse">
<div class="panel-body">
<div class="panel-body p-2">
<?php $form = ActiveForm::begin([
'action' => ['/menu/save-item', 'id' => $menu_item->id],
@ -51,7 +62,7 @@ $menu_item = $item['item'];
?>
<div class="nav-tabs-custom">
<?= \yii\bootstrap\Tabs::widget([
<?= Tab4::widget([
'items' => $items
]) ?>
</div>
@ -61,18 +72,20 @@ $menu_item = $item['item'];
<?= $form->field($model, 'target')->dropDownList([
'' => Yii::t('menu', 'Self Window'),
'_blank' => Yii::t('menu', 'Blank Window'),
]) ?>
<?= $form->field($model, 'style')->textInput(['maxlength' => true]) ?>
], [
'class' => 'form-control form-control-sm'
]) ?>
<?= $form->field($model, 'style')->textInput(['maxlength' => true, 'class' => 'form-control form-control-sm'],) ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'css')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'css')->textInput(['maxlength' => true, 'class' => 'form-control form-control-sm']) ?>
<?php if (!$menu_item->url_params): ?>
<?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'url')->textInput(['maxlength' => true, 'class' => 'form-control form-control-sm']) ?>
<?php endif; ?>
</div>
</div>
<div class="pull-right">
<div class="float-right">
<?= Html::a(Yii::t('buttons', 'Delete'), '#', [
'class' => 'item-delete-button btn btn-sm btn-danger',
'data-id' => $menu_item->id,

17
backend/components/menu/widgets/views/_item_tab.php

@ -4,22 +4,25 @@
* Date: 24.08.2018
*/
use core\forms\menu\MenuItemForm;
use yii\web\View;
use yii\widgets\ActiveForm;
/**
* @var $this \yii\web\View
* @var $form \yii\widgets\ActiveForm
* @var $model \core\forms\menu\MenuItemForm
* @var $this View
* @var $form ActiveForm
* @var $model MenuItemForm
* @var $language string
*/
$postfix = $language == Yii::$app->params['defaultLanguage'] ? '' : '_' . $language;
?>
<div class="row">
<div class="row mt-3">
<div class="col-md-6">
<?= $form->field($model, 'name' . $postfix)->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'name' . $postfix)->textInput(['maxlength' => true, 'class' => 'form-control form-control-sm']) ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'title_attr' . $postfix)->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'title_attr' . $postfix)->textInput(['maxlength' => true, 'class' => 'form-control form-control-sm']) ?>
</div>
</div>

161
backend/components/menu/widgets/views/menu.php

@ -4,21 +4,24 @@
* Date: 11.07.2018
*/
/**
* @var $this \yii\web\View
* @var $items array
* @var $menu \core\entities\menu\Menu
*/
use backend\components\menu\assets\MenuAsset;
use core\entities\menu\Menu;
use core\forms\menu\MenuItemForm;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\web\JsExpression;
use yii\web\View;
/**
* @var $this View
* @var $items array
* @var $menu Menu
*/
MenuAsset::register($this);
function menu_generate($items) {
function menu_generate($items): string
{
$html = '<ol class="dd-list">';
foreach ($items as $item) {
$menuItemForm = new MenuItemForm($item['item']);
@ -31,39 +34,11 @@ function menu_generate($items) {
}
$name_empty_error = Yii::t('menu', 'Name must be specified');
//$item_save_url = Url::to(['menu/save-menu-item-data']);
$item_save_url = ''; // delete this
$item_delete_url = Url::to(['menu/delete-menu-item']);
$confirm_delete_message = Yii::t('buttons', 'Are you sure you want to delete this item?');
$current_url = Url::to(['menu/index', 'id' => $menu->id]);
$js = <<<JS
/*$(".item-save-button").on('click', function(e) {
e.preventDefault();
var id = $(this).data('id');
var name = $("#item-name-" + id).val();
var title = $("#item-title-attr-" + id).val();
var style = $("#item-style-" + id).val();
var css = $("#item-css-" + id).val();
var url = $("#item-url-" + id).val();
var target = $("#item-target-" + id).val();
if (name) {
$.ajax({
method: "POST",
url: "{$item_save_url}",
data: { name: name, title: title, style: style, css: css, url: url, target: target, id: id }
})
.done(function( data ) {
if (data.result === 'success') {
document.location.href = '{$current_url}';
}
});
}
else {
alert('{$name_empty_error}');
}
});*/
$(".item-delete-button").on('click', function(e) {
e.preventDefault();
if (confirm('{$confirm_delete_message}')) {
@ -91,121 +66,11 @@ $redirect = Url::to(['menu/index', 'id' => $menu->id]);
<?= menu_generate($items) ?>
</div>
<!--
<div class="dd" id="nestable2">
<ol class="dd-list">
<li class="dd-item dd3-item" data-id="13">
<div class="dd3-content">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="dd-handle dd3-handle"> </div>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">Item 13
<i class="fa fa-angle-down pull-right" aria-hidden="true"></i></a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse">
<div class="panel-body">
Content Panel
</div>
</div>
</div>
</div>
</div>
</li>
<li class="dd-item dd3-item" data-id="14">
<div class="dd3-content">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="dd-handle dd3-handle"> </div>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">Item 14
<i class="fa fa-angle-down pull-right" aria-hidden="true"></i></a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse">
<div class="panel-body">
Content Panel
</div>
</div>
</div>
</div>
</div>
</li>
<li class="dd-item dd3-item" data-id="15">
<div class="dd3-content">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="dd-handle dd3-handle"> </div>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse3">Item 15
<i class="fa fa-angle-down pull-right" aria-hidden="true"></i></a>
</h4>
</div>
<div id="collapse3" class="panel-collapse collapse">
<div class="panel-body">
Content Panel
</div>
</div>
</div>
</div>
</div>
<ol class="dd-list">
<li class="dd-item dd3-item" data-id="16">
<div class="dd3-content">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="dd-handle dd3-handle"> </div>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse4">Item 16
<i class="fa fa-angle-down pull-right" aria-hidden="true"></i></a>
</h4>
</div>
<div id="collapse4" class="panel-collapse collapse">
<div class="panel-body">
Content Panel
</div>
</div>
</div>
</div>
</div>
</li>
</ol>
</li>
</ol>
</div>
</div>
<div style="clear: both;"></div>
<hr>
<button class="btn btn-primary" id="serialize">Serialize</button>
<hr>
<textarea class="form-control" id="output"></textarea>
<hr>
<textarea class="form-control" id="output2"></textarea>
-->
<div style="clear: both;"></div>
<hr>
<?= Html::button(Yii::t('buttons', 'Save'), [
'class' => 'btn btn-success pull-right',
'class' => 'btn btn-success float-right',
'onclick' => new JsExpression('sendTree('.$menu->id.', "'.$url.'", "'.$redirect.'")'),
]) ?>
]) ?>

42
backend/config/main.php

@ -149,6 +149,48 @@ return [
],
],
],
'assetManager' => [
'bundles' => [
'yii\bootstrap\BootstrapAsset' => [
'sourcePath' => '@core/components/bootstrap4', // do not publish the bundle
'css' => [
YII_ENV_DEV ? 'css/bootstrap.css' : 'css/bootstrap.min.css'
],
],
'yii\bootstrap\BootstrapPluginAsset' => [
'sourcePath' => '@core/components/bootstrap4',
'js' => [
YII_ENV_DEV ? 'js/bootstrap.bundle.js' : 'js/bootstrap.bundle.min.js'
],
'depends' => [
'yii\web\JqueryAsset',
'yii\bootstrap\BootstrapAsset',
],
],
/*'yii\web\JqueryAsset' => [
'sourcePath' => '@cp/assets/libs/jquery321', // do not publish the bundle
'js' => [
YII_ENV_DEV ? 'jquery-3.2.1.js' : 'jquery-3.2.1.min.js'
],
],
'yii\bootstrap\BootstrapAsset' => [
'sourcePath' => '@cp/assets/libs/bootstrap4/css', // do not publish the bundle
'css' => [
YII_ENV_DEV ? 'bootstrap.css' : 'bootstrap.min.css'
],
],
'yii\bootstrap\BootstrapPluginAsset' => [
'sourcePath' => '@cp/assets/libs/bootstrap4/js', // do not publish the bundle
'js' => [
YII_ENV_DEV ? 'bootstrap.js' : 'bootstrap.min.js'
],
'depends' => [
'yii\web\JqueryAsset',
'yii\bootstrap\BootstrapAsset',
],
],*/
],
],
],
'params' => $params,
];

11
backend/controllers/AuthController.php

@ -10,10 +10,11 @@ use yii\filters\VerbFilter;
use core\forms\auth\LoginForm;
use yii\filters\AccessControl;
use DomainException;
use yii\web\Response;
class AuthController extends Controller
{
private $auth_service;
private AuthService $auth_service;
public function __construct($id, $module, AuthService $service, $config = [])
{
@ -56,9 +57,9 @@ class AuthController extends Controller
}
/**
* @return mixed
* @return string|Response
*/
public function actionLogin()
public function actionLogin(): string|Response
{
if (!Yii::$app->user->isGuest) {
return $this->goHome();
@ -85,9 +86,9 @@ class AuthController extends Controller
}
/**
* @return mixed
* @return Response
*/
public function actionLogout()
public function actionLogout(): Response
{
Yii::$app->user->logout();

59
backend/controllers/MenuController.php

@ -14,6 +14,7 @@ use core\forms\menu\MenuItemForm;
use core\forms\menu\MenuSelectForm;
use core\services\menu\MenuItemManageService;
use core\services\menu\MenuManageService;
use yii\db\StaleObjectException;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use yii\helpers\Json;
@ -26,8 +27,8 @@ use Yii;
class MenuController extends Controller
{
public $menu_service;
public $menu_item_service;
public MenuManageService $menu_service;
public MenuItemManageService $menu_item_service;
public function __construct(
string $id,
@ -68,7 +69,12 @@ class MenuController extends Controller
];
}
public function actionIndex($id = null)
/**
* @param null $id
* @return Response|string
* @throws NotFoundHttpException
*/
public function actionIndex($id = null): Response|string
{
$menus = []; // menu list
$menu_records = Menu::find()->all();
@ -82,10 +88,12 @@ class MenuController extends Controller
if ($form->load(Yii::$app->request->get()) && $form->validate()) {
return $this->redirect(['menu/index', 'id' => $form->id]);
} elseif ($id) {
$this->createMenuItem(); // create menu item if MenuItemForm sent
$menu = $this->findModel($id);
if ($this->createMenuItem()) {
return $this->redirect(['/menu/index', 'id' => $id]);
}; // create menu item if MenuItemForm sent
$creatorWidgets = $this->getCreatorWidgets($menu->id);
return $this->render('menu', [
@ -102,7 +110,7 @@ class MenuController extends Controller
}
}
public function actionCreate()
public function actionCreate(): Response|string
{
$form = new MenuForm();
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
@ -121,7 +129,12 @@ class MenuController extends Controller
]);
}
public function actionUpdate($id)
/**
* @param $id
* @return Response|string
* @throws NotFoundHttpException
*/
public function actionUpdate($id): Response|string
{
$menu = $this->findModel($id);
@ -143,7 +156,7 @@ class MenuController extends Controller
]);
}
public function actionDelete($id)
public function actionDelete($id): Response
{
try {
$this->menu_service->remove($id);
@ -155,7 +168,12 @@ class MenuController extends Controller
return $this->redirect(['index']);
}
public function actionSaveItem($id)
/**
* @param $id
* @return Response
* @throws NotFoundHttpException
*/
public function actionSaveItem($id): Response
{
$item = $this->findItemModel($id);
$form = new MenuItemForm($item);
@ -173,7 +191,12 @@ class MenuController extends Controller
return $this->redirect(['index', 'id' => $item->menu_id]);
}
public function actionDeleteMenuItem()
/**
* @return array
* @throws NotFoundHttpException
* @throws StaleObjectException
*/
public function actionDeleteMenuItem(): array
{
Yii::$app->response->format = Response::FORMAT_JSON;
if (Yii::$app->request->isAjax) {
@ -193,7 +216,7 @@ class MenuController extends Controller
return ['result' => 'error', 'message' => 'Request error'];
}
public function actionSaveMenuItems()
public function actionSaveMenuItems(): array
{
$json = Yii::$app->request->post('json');
Yii::$app->response->format = Response::FORMAT_JSON;
@ -230,18 +253,25 @@ class MenuController extends Controller
return $widgets;
}
private function createMenuItem()
private function createMenuItem(): bool
{
$form = new MenuItemForm();
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
try {
$this->menu_item_service->create($form);
return true;
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
}
}
return false;
}
/**
* @param $id
* @return Menu
* @throws NotFoundHttpException
*/
protected function findModel($id): Menu
{
if (($model = Menu::findOne($id)) !== null) {
@ -250,6 +280,11 @@ class MenuController extends Controller
throw new NotFoundHttpException('The requested menu does not exist.');
}
/**
* @param $id
* @return MenuItem
* @throws NotFoundHttpException
*/
protected function findItemModel($id): MenuItem
{
if (($model = MenuItem::findOne($id)) !== null) {

61
backend/controllers/ModuleController.php

@ -7,12 +7,15 @@
namespace backend\controllers;
use core\entities\ModuleRecord;
use core\helpers\FileHelper;
use core\services\ModuleService;
use Yii;
use yii\base\ErrorException;
use yii\db\Exception;
use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use yii\web\NotFoundHttpException;
use yii\web\Response;
/**
* Modules Management
@ -24,12 +27,12 @@ class ModuleController extends Controller
/**
* @var ModuleService Modules management service
*/
private $_service;
private $service;
public function __construct(string $id, $module, ModuleService $service, array $config = [])
{
parent::__construct($id, $module, $config);
$this->_service = $service;
$this->service = $service;
}
public function behaviors(): array
@ -65,40 +68,57 @@ class ModuleController extends Controller
* List of modules
* @return string
*/
public function actionList()
public function actionList(): string
{
$modules = \Yii::$app->moduleManager->getModules();
$modules = Yii::$app->moduleManager->getModules();
return $this->render('list', [
'modules' => $modules,
]);
}
public function actionDelete($id)
/**
* @param $id
* @return Response
* @throws NotFoundHttpException
* @throws ErrorException
* @throws Exception
*/
public function actionDelete($id): Response
{
$module = $this->findModel($id);
$this->_service->delete($module);
$this->service->delete($module);
return $this->redirect(['module/list']);
}
public function actionDisable($id)
/**
* @param $id
* @return Response
* @throws NotFoundHttpException
*/
public function actionDisable($id): Response
{
$module = $this->findModel($id);
$this->_service->disable($module);
$this->service->disable($module);
return $this->redirect(['module/list']);
}
public function actionEnable($id)
/**
* @param $id
* @return Response
* @throws NotFoundHttpException
*/
public function actionEnable($id): Response
{
$module = $this->findModel($id);
$this->_service->enable($module);
$this->service->enable($module);
return $this->redirect(['module/list']);
}
public function actionSearch()
public function actionSearch(): string
{
$message = null;
try {
@ -113,22 +133,22 @@ class ModuleController extends Controller
continue;
}
$languageFile = str_replace('manifest.php', 'messages/' . \Yii::$app->language . '/' . $manifest['name'] . '.php', $link);
$languageFile = str_replace('manifest.php', 'messages/' . Yii::$app->language . '/' . $manifest['name'] . '.php', $link);
try {
$language = file_get_contents($languageFile);
$language = eval(str_replace('<?php', '', $language));
$manifest['locale_name'] = isset($language[$manifest['name']]) ? $language[$manifest['name']] : $manifest['name'];
$manifest['locale_description'] = isset($language[$manifest['description']]) ? $language[$manifest['description']] : $manifest['description'];
} catch (\Exception $e) {
$manifest['locale_name'] = $language[$manifest['name']] ?? $manifest['name'];
$manifest['locale_description'] = $language[$manifest['description']] ?? $manifest['description'];
} catch (\Exception) {
$manifest['locale_name'] = $manifest['name'];
$manifest['locale_description'] = $manifest['description'];
}
$modules[] = $manifest;
}
} catch (\Exception $e) {
} catch (\Exception) {
$modules = [];
$message = \Yii::t('main', 'Available modules not found');
$message = Yii::t('main', 'Available modules not found');
}
return $this->render('remote-list', [
@ -137,6 +157,11 @@ class ModuleController extends Controller
]);
}
/**
* @param $id
* @return ModuleRecord
* @throws NotFoundHttpException
*/
protected function findModel($id): ModuleRecord
{
if (($model = ModuleRecord::findOne($id)) !== null) {

38
backend/controllers/PermissionController.php

@ -9,6 +9,8 @@ namespace backend\controllers;
use backend\forms\rbac\RbacCreatePermissionForm;
use backend\forms\rbac\RbacEditPermissionForm;
use core\services\PermissionManager;
use DomainException;
use Exception;
use yii\behaviors\TimestampBehavior;
use yii\data\ArrayDataProvider;
use yii\rbac\Permission;
@ -16,15 +18,16 @@ use yii\web\Controller;
use yii\filters\VerbFilter;
use Yii;
use yii\filters\AccessControl;
use yii\web\Response;
class PermissionController extends Controller
{
private $_permission;
private PermissionManager $permission;
public function __construct($id, $module, PermissionManager $permission, $config = [])
{
parent::__construct($id, $module, $config);
$this->_permission = $permission;
$this->permission = $permission;
}
/**
@ -59,14 +62,14 @@ class PermissionController extends Controller
];
}
public function actionIndex()
public function actionIndex(): string
{
$data = array_map(function (Permission $permission) {
return [
'name' => $permission->name,
'description' => $permission->description,
];
}, $this->_permission->getPermissions());
}, $this->permission->getPermissions());
$dataProvider = new ArrayDataProvider([
'allModels' => $data,
@ -81,15 +84,15 @@ class PermissionController extends Controller
return $this->render('index', ['dataProvider' => $dataProvider]);
}
public function actionCreate()
public function actionCreate(): Response|string
{
$form = new RbacCreatePermissionForm();
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
try {
$this->_permission->create($form->name, $form->description, $form->rule_name, $form->data);
$this->permission->create($form->name, $form->description, $form->rule_name, $form->data);
return $this->redirect(['view', 'id' => $form->name]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -100,17 +103,22 @@ class PermissionController extends Controller
]);
}
public function actionUpdate($id)
/**
* @param $id
* @return Response|string
* @throws Exception
*/
public function actionUpdate($id): Response|string
{
$permission = $this->findModel($id);
$form = new RbacEditPermissionForm($permission);
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
try {
$this->_permission->update($permission->name, $form->name, $form->description, $form->rule_name, $form->data);
$this->permission->update($permission->name, $form->name, $form->description, $form->rule_name, $form->data);
return $this->redirect(['view', 'id' => $form->name]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -121,22 +129,22 @@ class PermissionController extends Controller
]);
}
public function actionDelete($id)
public function actionDelete($id): Response
{
$this->_permission->delete($id);
$this->permission->delete($id);
return $this->redirect(['index']);
}
public function actionView($id)
public function actionView($id): string
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
protected function findModel($id)
protected function findModel($id): ?Permission
{
return $this->_permission->getPermission($id);
return $this->permission->getPermission($id);
}
}

70
backend/controllers/RoleController.php

@ -9,25 +9,29 @@ namespace backend\controllers;
use backend\forms\rbac\RbacEditRoleForm;
use backend\forms\rbac\RbacUpdateChildren;
use core\services\PermissionManager;
use DomainException;
use Exception;
use yii\behaviors\TimestampBehavior;
use backend\forms\rbac\RbacCreateRoleForm;
use core\services\RoleManager;
use yii\data\ArrayDataProvider;
use yii\rbac\Role;
use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use Yii;
use yii\web\Response;
class RoleController extends Controller
{
private $_role;
private $_permission;
private RoleManager $role;
private PermissionManager $permission;
public function __construct($id, $module, RoleManager $role, PermissionManager $permission, $config = [])
{
parent::__construct($id, $module, $config);
$this->_role = $role;
$this->_permission = $permission;
$this->role = $role;
$this->permission = $permission;
}
/**
@ -62,9 +66,9 @@ class RoleController extends Controller
];
}
public function actionIndex()
public function actionIndex(): string
{
$data = $this->_role->getRolesListArray();
$data = $this->role->getRolesListArray();
$dataProvider = new ArrayDataProvider([
'allModels' => $data,
@ -79,15 +83,19 @@ class RoleController extends Controller
return $this->render('index', ['dataProvider' => $dataProvider]);
}
public function actionCreate()
/**
* @return Response|string
* @throws Exception
*/
public function actionCreate(): Response|string
{
$form = new RbacCreateRoleForm();
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
try {
$this->_role->create($form->name, $form->description, $form->rule_name, $form->data);
$this->role->create($form->name, $form->description, $form->rule_name, $form->data);
return $this->redirect(['view', 'id' => $form->name]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -98,17 +106,22 @@ class RoleController extends Controller
]);
}
public function actionUpdate($id)
/**
* @param $id
* @return string|Response
* @throws Exception
*/
public function actionUpdate($id): Response|string
{
$role = $this->findModel($id);
$form = new RbacEditRoleForm($role);
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
try {
$this->_role->update($role->name, $form->name, $form->description, $form->rule_name, $form->data);
$this->role->update($role->name, $form->name, $form->description, $form->rule_name, $form->data);
return $this->redirect(['view', 'id' => $form->name]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -119,11 +132,11 @@ class RoleController extends Controller
]);
}
public function actionDelete($id)
public function actionDelete($id): Response
{
try {
$this->_role->delete($id);
} catch (\DomainException $e) {
$this->role->delete($id);
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -131,21 +144,26 @@ class RoleController extends Controller
return $this->redirect(['index']);
}
public function actionView($id)
/**
* @param $id
* @return string
* @throws \yii\base\Exception
*/
public function actionView($id): string
{
$currentRole = $this->_role->getRole($id);
$rolesSelectArray = array_diff_assoc($this->_role->getRolesSelectArray(), [$currentRole->name => $currentRole->description]);
$currentRole = $this->role->getRole($id);
$rolesSelectArray = array_diff_assoc($this->role->getRolesSelectArray(), [$currentRole->name => $currentRole->description]);
$itemsForm = new RbacUpdateChildren();
if ($itemsForm->load(Yii::$app->request->post()) && $itemsForm->validate()) {
$this->_role->saveChildren($id, $itemsForm->roles, $itemsForm->permissions);
$this->role->saveChildren($id, $itemsForm->roles, $itemsForm->permissions);
Yii::$app->session->setFlash('success', Yii::t('user', 'Children roles and permissions for "{role}" is updated.', ['role' => $currentRole->description]));
}
$rolesSelected = $this->_role->getRolesSelectArrayByRole($id);
$rolesSelected = $this->role->getRolesSelectArrayByRole($id);
$permissionsSelectArray = $this->_permission->getPermissionsSelectArray();
$permissionsSelected = $this->_permission->getPermissionsSelectArrayByRole($id);
$permissionsSelectArray = $this->permission->getPermissionsSelectArray();
$permissionsSelected = $this->permission->getPermissionsSelectArrayByRole($id);
$itemsForm->roles = $rolesSelected;
$itemsForm->permissions = $permissionsSelected;
@ -158,8 +176,12 @@ class RoleController extends Controller
]);
}
protected function findModel($id)
/**
* @param $id
* @return Role|null
*/
protected function findModel($id): ?Role
{
return $this->_role->getRole($id);
return $this->role->getRole($id);
}
}

43
backend/controllers/SiteController.php

@ -5,24 +5,29 @@ namespace backend\controllers;
use core\entities\Search;
use core\forms\SearchForm;
use core\services\user\UserManageService;
use DomainException;
use RuntimeException;
use Yii;
use yii\base\Action;
use yii\data\ActiveDataProvider;
use yii\web\BadRequestHttpException;
use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use core\helpers\UserHelper;
use yii\web\Response;
/**
* Site controller
*/
class SiteController extends Controller
{
private $_service;
private UserManageService $service;
public function __construct(string $id, $module, UserManageService $service, array $config = [])
{
parent::__construct($id, $module, $config);
$this->_service = $service;
$this->service = $service;
}
/**
@ -75,12 +80,12 @@ class SiteController extends Controller
*
* @return string
*/
public function actionIndex()
public function actionIndex(): string
{
return $this->render('index');
}
public function actionSearch()
public function actionSearch(): string
{
$form = new SearchForm();
@ -102,28 +107,28 @@ class SiteController extends Controller
'provider' => $provider,
'form' => $form
]);
//$page = $this->service->create($form);
//return $this->redirect(['view', 'id' => $page->id]);
} catch (\DomainException $e) {
//Yii::$app->errorHandler->logException($e);
//Yii::$app->session->setFlash('error', $e->getMessage());
} catch (DomainException) {
}
}
return '';
}
public function actionLanguage($language)
public function actionLanguage($language): Response
{
if ($language && in_array($language, array_keys(Yii::$app->params['backendTranslatedLanguages']))) {
$this->_service->setBackendLanguage($language);
$this->service->setBackendLanguage($language);
}
return $this->redirect(Yii::$app->request->referrer);
}
public function beforeAction($action)
/**
* @param Action $action
* @return bool
* @throws BadRequestHttpException
*/
public function beforeAction($action): bool
{
if ($action->id === 'error') {
$this->layout = 'error';
@ -132,20 +137,20 @@ class SiteController extends Controller
return parent::beforeAction($action);
}
public function actionGetWidgetsList()
public function actionGetWidgetsList(): string
{
return $this->renderAjax('widgets-list');
}
public function actionAddWidget($itemIdx, $color = '')
public function actionAddWidget($itemIdx, $color = ''): string
{
if (!Yii::$app->request->isAjax) {
throw new \RuntimeException(Yii::t('main', 'The requested page does not exist.'));
throw new RuntimeException(Yii::t('main', 'The requested page does not exist.'));
}
$widgets = UserHelper::getSetting('widgetsLayout', []);
$item = Yii::$app->params['dashboard_widgets'][$itemIdx]; //require($itemFile);
$resizable = isset($item['resizable']) ? $item['resizable'] : 0;
$resizable = $item['resizable'] ?? 0;
$newWidget = [
'w' => $item['size']['width'] ?: 0,
'h' => $item['size']['height'] ?: 0,
@ -168,7 +173,7 @@ class SiteController extends Controller
public function actionRemoveWidget($idx)
{
if (!Yii::$app->request->isAjax) {
throw new \RuntimeException(Yii::t('main', 'The requested page does not exist.'));
throw new RuntimeException(Yii::t('main', 'The requested page does not exist.'));
}
$widgets = UserHelper::getSetting('widgetsLayout', []);
array_splice($widgets, $idx, 1);
@ -184,7 +189,7 @@ class SiteController extends Controller
}
}
public function actionGetSelectedWidgetsList()
public function actionGetSelectedWidgetsList(): string
{
return $this->renderAjax( 'widgets-selected-list');
}

40
backend/controllers/SliderController.php

@ -5,21 +5,23 @@ namespace backend\controllers;
use core\entities\Slider;
use core\forms\SliderForm;
use core\services\SliderService;
use DomainException;
use Yii;
use yii\data\ActiveDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use yii\web\Response;
class SliderController extends Controller
{
private $_service;
private SliderService $service;
public function __construct($id, $module, SliderService $service, $config = [])
{
parent::__construct($id, $module, $config);
$this->_service = $service;
$this->service = $service;
}
/**
@ -51,10 +53,8 @@ class SliderController extends Controller
];
}
public function actionIndex()
public function actionIndex(): string
{
//$searchModel = new UserSearch();
//$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$query = Slider::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
@ -79,7 +79,7 @@ class SliderController extends Controller
* @return string
* @throws NotFoundHttpException
*/
public function actionView($id)
public function actionView($id): string
{
return $this->render('view', [
'model' => $this->findModel($id),
@ -89,18 +89,18 @@ class SliderController extends Controller
/**
* Creates a new User model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
* @return string|Response
*/
public function actionCreate()
public function actionCreate(): Response|string
{
$form = new SliderForm();
$form->scenario = Slider::SCENARIO_CREATE;
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
try {
$slider = $this->_service->create($form);
$slider = $this->service->create($form);
return $this->redirect(['view', 'id' => $slider->id]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -114,10 +114,10 @@ class SliderController extends Controller
/**
* @param $id
*
* @return string|\yii\web\Response
* @return string|Response
* @throws NotFoundHttpException
*/
public function actionUpdate($id)
public function actionUpdate($id): Response|string
{
$slider = $this->findModel($id);
@ -125,10 +125,10 @@ class SliderController extends Controller
$form->scenario = Slider::SCENARIO_UPDATE;
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
try {
$this->_service->edit($slider->id, $form);
$this->service->edit($slider->id, $form);
return $this->redirect(['view', 'id' => $slider->id]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -143,16 +143,20 @@ class SliderController extends Controller
/**
* @param $id
*
* @return \yii\web\Response
* @return Response
*/
public function actionDelete($id)
public function actionDelete($id): Response
{
$this->_service->remove($id);
$this->service->remove($id);
return $this->redirect(['index']);
}
/**
* @param $id
* @return Slider|null
* @throws NotFoundHttpException
*/
protected function findModel($id): ?Slider
{
if (($model = Slider::findOne($id)) !== null) {

56
backend/controllers/UserController.php

@ -6,13 +6,16 @@ use core\forms\user\ProfileEditForm;
use core\forms\user\UserForm;
use core\services\user\ProfileService;
use core\services\user\UserManageService;
use DomainException;
use Yii;
use core\entities\user\User;
use backend\forms\UserSearch;
use yii\base\Exception;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use yii\web\Response;
use yii\web\UploadedFile;
/**
@ -20,14 +23,14 @@ use yii\web\UploadedFile;
*/
class UserController extends Controller
{
private $_service;
private $_profile_service;
private UserManageService $service;
private ProfileService $profile_service;
public function __construct($id, $module, UserManageService $service, ProfileService $profile_service, $config = [])
{
parent::__construct($id, $module, $config);
$this->_service = $service;
$this->_profile_service = $profile_service;
$this->service = $service;
$this->profile_service = $profile_service;
}
/**
@ -66,9 +69,9 @@ class UserController extends Controller
/**
* Lists all User models.
* @return mixed
* @return string
*/
public function actionIndex()
public function actionIndex(): string
{
$searchModel = new UserSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
@ -85,7 +88,7 @@ class UserController extends Controller
* @return string
* @throws NotFoundHttpException
*/
public function actionView($id)
public function actionView($id): string
{
return $this->render('view', [
'model' => $this->findModel($id),
@ -95,17 +98,19 @@ class UserController extends Controller
/**
* Creates a new User model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
* @return Response|string
* @throws Exception
* @throws \yii\db\Exception
*/
public function actionCreate()
public function actionCreate(): Response|string
{
$form = new UserForm();
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
try {
$user = $this->_service->create($form);
$user = $this->service->create($form);
return $this->redirect(['view', 'id' => $user->id]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -118,21 +123,22 @@ class UserController extends Controller
/**
* @param $id
*
* @return string|\yii\web\Response
* @return Response|string
* @throws Exception
* @throws NotFoundHttpException
* @throws \yii\db\Exception
*/
public function actionUpdate($id)
public function actionUpdate($id): Response|string
{
$user = $this->findModel($id);
$form = new UserForm($user);
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
try {
$this->_service->edit($user->id, $form);
$this->service->edit($user->id, $form);
return $this->redirect(['view', 'id' => $user->id]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -150,16 +156,20 @@ class UserController extends Controller
*
* @param integer $id
*
* @return mixed
* @return Response
*/
public function actionDelete($id)
public function actionDelete(int $id): Response
{
$this->_service->remove($id);
$this->service->remove($id);
return $this->redirect(['index']);
}
public function actionProfile()
/**
* @return Response|string
* @throws NotFoundHttpException|Exception
*/
public function actionProfile(): Response|string
{
$user = $this->findModel(Yii::$app->user->id);
$form = new ProfileEditForm($user);
@ -167,11 +177,11 @@ class UserController extends Controller
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
try {
$form->user_pic = UploadedFile::getInstance($form, 'user_pic');
$this->_profile_service->edit(Yii::$app->user->id, $form);
$this->profile_service->edit(Yii::$app->user->id, $form);
Yii::$app->session->setFlash('success', Yii::t('user', 'Profile is saved.'));
return $this->redirect(['/user/profile']);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -192,7 +202,7 @@ class UserController extends Controller
* @return User the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
protected function findModel(int $id): User
{
if (($model = User::findOne($id)) !== null) {
return $model;

39
backend/controllers/post/CategoryController.php

@ -5,6 +5,7 @@ namespace backend\controllers\post;
use core\entities\post\PostType;
use core\forms\post\PostCategoryForm;
use core\services\post\PostCategoryManageService;
use DomainException;
use Yii;
use core\entities\post\PostCategory;
use core\forms\post\search\PostCategorySearch;
@ -12,10 +13,11 @@ use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use yii\web\Response;
class CategoryController extends Controller
{
private $service;
private PostCategoryManageService $service;
public function __construct($id, $module, PostCategoryManageService $service, $config = [])
{
@ -27,7 +29,7 @@ class CategoryController extends Controller
{
return [
'access' => [
'class' => AccessControl::className(),
'class' => AccessControl::class,
'rules' => [
[
'allow' => true,
@ -40,7 +42,7 @@ class CategoryController extends Controller
],
],
'verbs' => [
'class' => VerbFilter::className(),
'class' => VerbFilter::class,
'actions' => [
'delete' => ['POST'],
],
@ -54,7 +56,7 @@ class CategoryController extends Controller
* @return string
* @throws NotFoundHttpException
*/
public function actionIndex($tid)
public function actionIndex($tid): string
{
$type = $this->findType($tid);
@ -74,7 +76,7 @@ class CategoryController extends Controller
* @return string
* @throws NotFoundHttpException
*/
public function actionView($id)
public function actionView($id): string
{
$category = $this->findModel($id);
$type = $this->findType($category->type_id);
@ -87,10 +89,10 @@ class CategoryController extends Controller
/**
* @param $tid
*
* @return string|\yii\web\Response
* @return string|Response
* @throws NotFoundHttpException
*/
public function actionCreate($tid)
public function actionCreate($tid): Response|string
{
$type = $this->findType($tid);
$form = new PostCategoryForm();
@ -100,7 +102,7 @@ class CategoryController extends Controller
try {
$category = $this->service->create($form);
return $this->redirect(['view', 'id' => $category->id]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -114,10 +116,10 @@ class CategoryController extends Controller
/**
* @param $id
*
* @return string|\yii\web\Response
* @return string|Response
* @throws NotFoundHttpException
*/
public function actionUpdate($id)
public function actionUpdate($id): Response|string
{
$category = $this->findModel($id);
$type = $this->findType($category->type_id);
@ -126,7 +128,7 @@ class CategoryController extends Controller
try {
$this->service->edit($category->id, $form);
return $this->redirect(['view', 'id' => $category->id]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -141,16 +143,16 @@ class CategoryController extends Controller
/**
* @param $id
*
* @return \yii\web\Response
* @return Response
* @throws NotFoundHttpException
*/
public function actionDelete($id)
public function actionDelete($id): Response
{
$category = $this->findModel($id);
$type = $this->findType($category->type_id);
try {
$this->service->remove($id);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -163,7 +165,7 @@ class CategoryController extends Controller
* @return PostCategory the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id): PostCategory
protected function findModel(int $id): PostCategory
{
if (($model = PostCategory::findOne($id)) !== null) {
return $model;
@ -171,7 +173,12 @@ class CategoryController extends Controller
throw new NotFoundHttpException('The requested page does not exist.');
}
protected function findType($id): PostType
/**
* @param integer $id
* @return PostType
* @throws NotFoundHttpException
*/
protected function findType(int $id): PostType
{
if (($type = PostType::findOne($id)) !== null) {
return $type;

40
backend/controllers/post/CommentController.php

@ -5,16 +5,18 @@ namespace backend\controllers\post;
use core\forms\post\search\PostCommentSearch;
use core\forms\post\PostCommentEditForm;
use core\services\post\PostCommentManageService;
use DomainException;
use Yii;
use core\entities\post\Post;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use yii\web\Response;
class CommentController extends Controller
{
private $service;
private PostCommentManageService $service;
public function __construct($id, $module, PostCommentManageService $service, $config = [])
{
@ -26,7 +28,7 @@ class CommentController extends Controller
{
return [
'access' => [
'class' => AccessControl::className(),
'class' => AccessControl::class,
'rules' => [
[
'allow' => true,
@ -39,7 +41,7 @@ class CommentController extends Controller
],
],
'verbs' => [
'class' => VerbFilter::className(),
'class' => VerbFilter::class,
'actions' => [
'delete' => ['POST'],
],
@ -48,9 +50,9 @@ class CommentController extends Controller
}
/**
* @return mixed
* @return string
*/
public function actionIndex()
public function actionIndex(): string
{
$searchModel = new PostCommentSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
@ -65,10 +67,10 @@ class CommentController extends Controller
* @param $post_id
* @param $id
*
* @return string|\yii\web\Response
* @return string|Response
* @throws NotFoundHttpException
*/
public function actionUpdate($post_id, $id)
public function actionUpdate($post_id, $id): Response|string
{
$post = $this->findModel($post_id);
$comment = $post->getComment($id);
@ -78,7 +80,7 @@ class CommentController extends Controller
try {
$this->service->edit($post->id, $comment->id, $form);
return $this->redirect(['view', 'post_id' => $post->id, 'id' => $comment->id]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -86,7 +88,7 @@ class CommentController extends Controller
return $this->render('update', [
'post' => $post,
'model' => $form,
'comment' => $comment,
//'comment' => $comment,
]);
}
@ -97,7 +99,7 @@ class CommentController extends Controller
* @return string
* @throws NotFoundHttpException
*/
public function actionView($post_id, $id)
public function actionView($post_id, $id): string
{
$post = $this->findModel($post_id);
$comment = $post->getComment($id);
@ -112,33 +114,33 @@ class CommentController extends Controller
* @param $post_id
* @param $id
*
* @return \yii\web\Response
* @return Response
* @throws NotFoundHttpException
*/
public function actionActivate($post_id, $id)
public function actionActivate($post_id, $id): Response
{
$post = $this->findModel($post_id);
try {
$this->service->activate($post->id, $id);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->session->setFlash('error', $e->getMessage());
}
return $this->redirect(['view', 'post_id' => $post_id, 'id' => $id]);
}
/**
* @param $post_id
* @param $id
* @param integer $post_id
* @param integer $id
*
* @return \yii\web\Response
* @return Response
* @throws NotFoundHttpException
*/
public function actionDelete($post_id, $id)
public function actionDelete(int $post_id, int $id): Response
{
$post = $this->findModel($post_id);
try {
$this->service->remove($post->id, $id);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->session->setFlash('error', $e->getMessage());
}
return $this->redirect(['index']);
@ -149,7 +151,7 @@ class CommentController extends Controller
* @return Post the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id): Post
protected function findModel(int $id): Post
{
if (($model = Post::findOne($id)) !== null) {
return $model;

71
backend/controllers/post/PostController.php

@ -6,11 +6,11 @@ use core\entities\post\PostTag;
use core\entities\post\PostType;
use core\forms\post\PostForm;
use core\services\post\PostManageService;
use DomainException;
use Yii;
use core\entities\post\Post;
use core\forms\post\search\PostSearch;
use yii\helpers\ArrayHelper;
use yii\log\Logger;
use yii\base\Exception;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
@ -19,7 +19,7 @@ use yii\web\Response;
class PostController extends Controller
{
private $service;
private PostManageService $service;
public function __construct($id, $module, PostManageService $service, $config = [])
{
@ -31,7 +31,7 @@ class PostController extends Controller
{
return [
'access' => [
'class' => AccessControl::className(),
'class' => AccessControl::class,
'rules' => [
[
'allow' => true,
@ -44,7 +44,7 @@ class PostController extends Controller
],
],
'verbs' => [
'class' => VerbFilter::className(),
'class' => VerbFilter::class,
'actions' => [
'delete' => ['POST'],
'activate' => ['POST'],
@ -63,7 +63,7 @@ class PostController extends Controller
* @return string
* @throws NotFoundHttpException
*/
public function actionIndex($tid)
public function actionIndex($tid): string
{
$type = $this->findType($tid);
@ -83,7 +83,7 @@ class PostController extends Controller
* @return string
* @throws NotFoundHttpException
*/
public function actionView($id)
public function actionView($id): string
{
$post = $this->findModel($id);
$type = $this->findType($post->type_id);
@ -93,13 +93,14 @@ class PostController extends Controller
]);
}
/**
* @param $tid
*
* @return string|\yii\web\Response
* @throws NotFoundHttpException
*/
public function actionCreate($tid)
/**
* @param $tid
* @return Response|string
* @throws NotFoundHttpException
* @throws Exception
* @throws \yii\db\Exception
*/
public function actionCreate($tid): Response|string
{
$type = $this->findType($tid);
$form = new PostForm();
@ -109,7 +110,7 @@ class PostController extends Controller
try {
$post = $this->service->create($form);
return $this->redirect(['view', 'id' => $post->id, 'tid' => $post->type_id]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -120,12 +121,13 @@ class PostController extends Controller
]);
}
/**
* @param $id
*
* @return string|\yii\web\Response
* @throws NotFoundHttpException
*/
/**
* @param $id
* @return string|Response
* @throws Exception
* @throws NotFoundHttpException
* @throws \yii\db\Exception
*/
public function actionUpdate($id)
{
$post = $this->findModel($id);
@ -136,7 +138,7 @@ class PostController extends Controller
try {
$this->service->edit($post->id, $form);
return $this->redirect(['view', 'id' => $post->id, 'tid' => $post->type_id]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -151,16 +153,16 @@ class PostController extends Controller
/**
* @param $id
*
* @return \yii\web\Response
* @return Response
* @throws NotFoundHttpException
*/
public function actionDelete($id)
public function actionDelete($id): Response
{
$post = $this->findModel($id);
$type = $this->findType($post->type_id);
try {
$this->service->remove($id);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->session->setFlash('error', $e->getMessage());
}
return $this->redirect(['index', 'tid' => $type->id]);
@ -168,13 +170,13 @@ class PostController extends Controller
/**
* @param integer $id
* @return mixed
* @return Response
*/
public function actionActivate($id)
public function actionActivate(int $id): Response
{
try {
$this->service->activate($id);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->session->setFlash('error', $e->getMessage());
}
return $this->redirect(['view', 'id' => $id]);
@ -182,13 +184,13 @@ class PostController extends Controller
/**
* @param integer $id
* @return mixed
* @return Response
*/
public function actionDraft($id)
public function actionDraft(int $id): Response
{
try {
$this->service->draft($id);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->session->setFlash('error', $e->getMessage());
}
return $this->redirect(['view', 'id' => $id]);
@ -214,7 +216,7 @@ class PostController extends Controller
* @return Post the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id): Post
protected function findModel(int $id): Post
{
if (($model = Post::findOne($id)) !== null) {
return $model;
@ -222,6 +224,11 @@ class PostController extends Controller
throw new NotFoundHttpException('The requested page does not exist.');
}
/**
* @param $id
* @return PostType
* @throws NotFoundHttpException
*/
protected function findType($id): PostType
{
if (($type = PostType::findOne($id)) !== null) {

37
backend/controllers/post/TagController.php

@ -5,6 +5,7 @@ namespace backend\controllers\post;
use core\entities\post\PostType;
use core\forms\post\PostTagSingleForm;
use core\services\post\PostTagManageService;
use DomainException;
use Yii;
use core\entities\post\PostTag;
use core\forms\post\search\PostTagSearch;
@ -12,10 +13,11 @@ use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use yii\web\Response;
class TagController extends Controller
{
private $service;
private PostTagManageService $service;
public function __construct($id, $module, PostTagManageService $service, $config = [])
{
@ -27,7 +29,7 @@ class TagController extends Controller
{
return [
'access' => [
'class' => AccessControl::className(),
'class' => AccessControl::class,
'rules' => [
[
'allow' => true,
@ -40,7 +42,7 @@ class TagController extends Controller
],
],
'verbs' => [
'class' => VerbFilter::className(),
'class' => VerbFilter::class,
'actions' => [
'delete' => ['POST'],
],
@ -54,7 +56,7 @@ class TagController extends Controller
* @return string
* @throws NotFoundHttpException
*/
public function actionIndex($tid)
public function actionIndex($tid): string
{
$type = $this->findType($tid);
@ -74,7 +76,7 @@ class TagController extends Controller
* @return string
* @throws NotFoundHttpException
*/
public function actionView($id)
public function actionView($id): string
{
$tag = $this->findModel($id);
$type = $this->findType($tag->type_id);
@ -87,10 +89,10 @@ class TagController extends Controller
/**
* @param $tid
*
* @return string|\yii\web\Response
* @return string|Response
* @throws NotFoundHttpException
*/
public function actionCreate($tid)
public function actionCreate($tid): Response|string
{
$type = $this->findType($tid);
$form = new PostTagSingleForm();
@ -99,7 +101,7 @@ class TagController extends Controller
try {
$tag = $this->service->create($form);
return $this->redirect(['view', 'id' => $tag->id]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -113,10 +115,10 @@ class TagController extends Controller
/**
* @param $id
*
* @return string|\yii\web\Response
* @return string|Response
* @throws NotFoundHttpException
*/
public function actionUpdate($id)
public function actionUpdate($id): Response|string
{
$tag = $this->findModel($id);
$type = $this->findType($tag->type_id);
@ -125,7 +127,7 @@ class TagController extends Controller
try {
$this->service->edit($tag->id, $form);
return $this->redirect(['view', 'id' => $tag->id]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -140,16 +142,16 @@ class TagController extends Controller
/**
* @param $id
*
* @return \yii\web\Response
* @return Response
* @throws NotFoundHttpException
*/
public function actionDelete($id)
public function actionDelete($id): Response
{
$tag = $this->findModel($id);
$type = $this->findType($tag->type_id);
try {
$this->service->remove($id);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -161,7 +163,7 @@ class TagController extends Controller
* @return PostTag the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id): PostTag
protected function findModel(int $id): PostTag
{
if (($model = PostTag::findOne($id)) !== null) {
return $model;
@ -169,6 +171,11 @@ class TagController extends Controller
throw new NotFoundHttpException('The requested page does not exist.');
}
/**
* @param $id
* @return PostType
* @throws NotFoundHttpException
*/
protected function findType($id): PostType
{
if (($type = PostType::findOne($id)) !== null) {

27
backend/controllers/post/TypeController.php

@ -6,11 +6,13 @@ use core\entities\post\PostType;
use core\forms\post\PostTypeForm;
use core\forms\post\search\PostTypeSearch;
use core\services\post\PostTypeService;
use DomainException;
use yii\web\NotFoundHttpException;
use yii\web\Controller;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use Yii;
use yii\web\Response;
class TypeController extends Controller
{
@ -26,7 +28,7 @@ class TypeController extends Controller
{
return [
'access' => [
'class' => AccessControl::className(),
'class' => AccessControl::class,
'rules' => [
[
'allow' => true,
@ -39,7 +41,7 @@ class TypeController extends Controller
],
],
'verbs' => [
'class' => VerbFilter::className(),
'class' => VerbFilter::class,
'actions' => [
'delete' => ['POST'],
],
@ -50,7 +52,7 @@ class TypeController extends Controller
/**
* @return string
*/
public function actionIndex()
public function actionIndex(): string
{
$searchModel = new PostTypeSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
@ -67,7 +69,7 @@ class TypeController extends Controller
* @return string
* @throws NotFoundHttpException
*/
public function actionView($id)
public function actionView($id): string
{
$type = $this->findModel($id);
return $this->render('view', [
@ -76,9 +78,9 @@ class TypeController extends Controller
}
/**
* @return string|\yii\web\Response
* @return string|Response
*/
public function actionCreate()
public function actionCreate(): Response|string
{
$form = new PostTypeForm();
@ -86,7 +88,7 @@ class TypeController extends Controller
try {
$type = $this->service->create($form);
return $this->redirect(['view', 'id' => $type->id]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -99,10 +101,10 @@ class TypeController extends Controller
/**
* @param $id
*
* @return string|\yii\web\Response
* @return string|Response
* @throws NotFoundHttpException
*/
public function actionUpdate($id)
public function actionUpdate($id): Response|string
{
$type = $this->findModel($id);
@ -111,20 +113,21 @@ class TypeController extends Controller
try {
$this->service->edit($type->id, $form);
return $this->redirect(['view', 'id' => $type->id]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
}
return $this->render('update', [
'model' => $form,
'type' => $type,
]);
}
/**
* @param $id
*
* @return \yii\web\Response
* @return Response
* @throws NotFoundHttpException
*/
public function actionDelete($id)
@ -133,7 +136,7 @@ class TypeController extends Controller
try {
$this->service->remove($id);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}

52
backend/controllers/settings/ListController.php

@ -11,22 +11,25 @@ use core\entities\Settings;
use core\forms\FaviconForm;
use core\forms\SettingsForm;
use core\services\SettingsService;
use DomainException;
use yii\db\ActiveRecord;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use yii\web\Controller;
use backend\components\ToggleAction;
use Yii;
use yii\web\NotFoundHttpException;
use yii\web\Response;
use yii\web\UploadedFile;
class ListController extends Controller
{
private $_service;
private SettingsService $service;
public function __construct(string $id, $module, SettingsService $service, array $config = [])
{
parent::__construct($id, $module, $config);
$this->_service = $service;
$this->service = $service;
}
public function behaviors()
@ -61,12 +64,11 @@ class ListController extends Controller
'toggle' => [
'class' => ToggleAction::class,
'modelClass' => Settings::class,
//'setFlash' => true,
]
];
}
public function actionIndex($section = 'site')
public function actionIndex($section = 'site'): string
{
$searchModel = new SettingsSearch();
$searchModel->section = $section;
@ -82,7 +84,13 @@ class ListController extends Controller
);
}
public function actionView($section, $key)
/**
* @param $section
* @param $key
* @return string
* @throws NotFoundHttpException
*/
public function actionView($section, $key): string
{
return $this->render(
'view',
@ -92,15 +100,15 @@ class ListController extends Controller
);
}
public function actionCreate()
public function actionCreate(): Response|string
{
$form = new SettingsForm();
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
try {
$settings = $this->_service->create($form);
$settings = $this->service->create($form);
return $this->redirect(['view', 'section' => $settings->section, 'key' => $settings->key]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -116,17 +124,23 @@ class ListController extends Controller
);
}
public function actionUpdate($section, $key)
/**
* @param $section
* @param $key
* @return Response|string
* @throws NotFoundHttpException
*/
public function actionUpdate($section, $key): Response|string
{
$settings = $this->findModel($section, $key);
$form = new SettingsForm($settings);
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
try {
$this->_service->edit($settings->section, $settings->key, $form);
$this->service->edit($settings->section, $settings->key, $form);
return $this->redirect(['view', 'section' => $settings->section, 'key' => $settings->key]);
} catch (\DomainException $e) {
} catch (DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
@ -141,14 +155,14 @@ class ListController extends Controller
);
}
public function actionDelete($section, $key)
public function actionDelete($section, $key): Response
{
$this->_service->remove($section, $key);
$this->service->remove($section, $key);
return $this->redirect(['index']);
}
public function actionFavicon()
public function actionFavicon(): Response|string
{
$form = new FaviconForm();
if ($form->load(Yii::$app->request->post())) {
@ -159,7 +173,7 @@ class ListController extends Controller
}
$form->image->saveAs(Yii::getAlias('@staticRoot') . '/origin/favicon/favicon.png');
$this->_service->newFavicon();
$this->service->newFavicon();
Yii::$app->session->setFlash('success', Yii::t('main', 'Favicon generation complete'));
return $this->redirect(['settings/list/index']);
}
@ -173,7 +187,13 @@ class ListController extends Controller
);
}
protected function findModel($section, $key)
/**
* @param $section
* @param $key
* @return array|Settings|ActiveRecord|null
* @throws NotFoundHttpException
*/
protected function findModel($section, $key): array|Settings|ActiveRecord|null
{
if (($model = Settings::find()->andWhere(['section' => $section])->andWhere(['key' => $key])->one()) !== null) {
return $model;

18
backend/forms/SettingsSearch.php

@ -12,14 +12,14 @@ use yii\data\ActiveDataProvider;
class SettingsSearch extends Settings
{
public $id;
public $type;
public $section;
public $key;
public $value;
public $active;
public ?int $id = null;
public ?int $type = null;
public ?string $section = null;
public ?string $key = null;
public ?string $value = null;
public ?int $active = null;
public function rules()
public function rules(): array
{
return [
[['id'], 'integer'],
@ -31,7 +31,7 @@ class SettingsSearch extends Settings
/**
* @return array
*/
public function scenarios()
public function scenarios(): array
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
@ -42,7 +42,7 @@ class SettingsSearch extends Settings
*
* @return ActiveDataProvider
*/
public function search($params)
public function search($params): ActiveDataProvider
{
$query = Settings::find();
$dataProvider = new ActiveDataProvider(

19
backend/forms/UserSearch.php

@ -2,6 +2,7 @@
namespace backend\forms;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use core\entities\user\User;
@ -9,15 +10,15 @@ use yii\helpers\ArrayHelper;
class UserSearch extends Model
{
public $id;
public $date_from;
public $date_to;
public $username;
public $email;
public $status;
public $role;
public ?int $id = null;
public ?string $date_from = null;
public ?string $date_to = null;
public ?string $username = null;
public ?string $email = null;
public ?int $status = null;
public ?string $role = null;
public function rules()
public function rules(): array
{
return [
[['id', 'status'], 'integer'],
@ -66,6 +67,6 @@ class UserSearch extends Model
public function rolesList(): array
{
return ArrayHelper::map(\Yii::$app->authManager->getRoles(), 'name', 'description');
return ArrayHelper::map(Yii::$app->authManager->getRoles(), 'name', 'description');
}
}

14
backend/forms/rbac/RbacCreatePermissionForm.php

@ -11,14 +11,14 @@ use Yii;
class RbacCreatePermissionForm extends Model
{
public $name;
public $description;
public $rule_name;
public $data;
public $created_at;
public $updated_at;
public ?string $name = null;
public ?string $description = null;
public ?string $rule_name = null;
public ?string $data = null;
public ?int $created_at = null;
public ?int $updated_at = null;
public function rules()
public function rules(): array
{
return [
[['name'], 'required'],

14
backend/forms/rbac/RbacCreateRoleForm.php

@ -11,14 +11,14 @@ use Yii;
class RbacCreateRoleForm extends Model
{
public $name;
public $description;
public $rule_name;
public $data;
public $created_at;
public $updated_at;
public ?string $name = null;
public ?string $description = null;
public ?string $rule_name = null;
public ?string $data = null;
public ?int $created_at = null;
public ?int $updated_at = null;
public function rules()
public function rules(): array
{
return [
[['name'], 'required'],

15
backend/forms/rbac/RbacEditPermissionForm.php

@ -12,13 +12,12 @@ use Yii;
class RbacEditPermissionForm extends Model
{
public $name;
public $description;
public $rule_name;
public $data;
public $created_at;
public $updated_at;
public ?string $name = null;
public ?string $description = null;
public ?string $rule_name = null;
public ?string $data = null;
public ?int $created_at = null;
public ?int $updated_at = null;
public function __construct(Permission $permission, $config = [])
{
@ -29,7 +28,7 @@ class RbacEditPermissionForm extends Model
parent::__construct($config);
}
public function rules()
public function rules(): array
{
return [
[['name'], 'required'],

15
backend/forms/rbac/RbacEditRoleForm.php

@ -12,13 +12,12 @@ use Yii;
class RbacEditRoleForm extends Model
{
public $name;
public $description;
public $rule_name;
public $data;
public $created_at;
public $updated_at;
public ?string $name = null;
public ?string $description = null;
public ?string $rule_name = null;
public ?string $data = null;
public ?int $created_at = null;
public ?int $updated_at = null;
public function __construct(Role $role, $config = [])
{
@ -29,7 +28,7 @@ class RbacEditRoleForm extends Model
parent::__construct($config);
}
public function rules()
public function rules(): array
{
return [
[['name'], 'required'],

6
backend/forms/rbac/RbacUpdateChildren.php

@ -10,10 +10,10 @@ use yii\base\Model;
class RbacUpdateChildren extends Model
{
public $roles;
public $permissions;
public ?array $roles = null;
public ?array $permissions = null;
public function rules()
public function rules(): array
{
return [
[['roles', 'permissions'], 'each', 'rule' => ['string']],

13
backend/helpers/DashboardHelper.php

@ -11,7 +11,7 @@ use yii\helpers\Html;
class DashboardHelper
{
public static function getAllWidgets()
public static function getAllWidgets(): array
{
$widgetsCounter = ''; // Counters Widgets
$widgetsInfo = ''; // Information Widgets
@ -20,15 +20,7 @@ class DashboardHelper
$path = Yii::getAlias('@backend/widgets/dashboard');
$files = scandir($path, 0);
//foreach ($files as $file) {
foreach (Yii::$app->params['dashboard_widgets'] as $idx => $item) {
//if (!is_file($path . '/' . $file)) {
// continue;
//}
//$itemFile = $path . '/' . $file;
//$item = require($itemFile);
if (isset($item['rule']) && (Yii::$app->user->can($item['rule']) || Yii::$app->user->can('admin'))) {
} elseif (!isset($item['rule'])) {
} else {
@ -47,11 +39,10 @@ class DashboardHelper
$widgetsInfo .= $line;
}
}
return [$widgetsCounter, $widgetsInfo];
}
public static function getExtColors()
public static function getExtColors(): array
{
return [
'gray' => Yii::t('main', 'Gray'),

1
backend/messages/ru/menu.php

@ -29,4 +29,5 @@ return [
'Title attribute' => 'Аттрибут Title',
'CSS Classes' => 'Классы CSS',
'CSS Style' => 'Стиль CSS',
'Url' => 'Ссылка',
];

8
backend/views/auth/login.php

@ -1,11 +1,12 @@
<?php
use common\widgets\Alert;
use core\forms\auth\LoginForm;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \core\forms\auth\LoginForm */
/* @var $model LoginForm */
$this->title = Yii::t('main', 'Sign in');
@ -34,7 +35,10 @@ $fieldOptions2 = [
<?= Alert::widget() ?>
<?php $form = ActiveForm::begin(['id' => 'login-form', 'enableClientValidation' => false]); ?>
<?php $form = ActiveForm::begin([
'id' => 'login-form',
'enableClientValidation' => false
]); ?>
<?= $form
->field($model, 'username', $fieldOptions1)

238
backend/views/layouts/content-origin.php

@ -0,0 +1,238 @@
<?php
use yii\helpers\Html;
use yii\helpers\Inflector;
use yii\widgets\Breadcrumbs;
use dmstr\widgets\Alert;
?>
<div class="content-wrapper">
<section class="content-header">
<?php if (isset($this->blocks['content-header'])) { ?>
<h1><?= $this->blocks['content-header'] ?></h1>
<?php } else { ?>
<h1>
<?php
if ($this->title !== null) {
echo Html::encode($this->title);
} else {
echo Inflector::camel2words(
Inflector::id2camel($this->context->module->id)
);
echo ($this->context->module->id !== \Yii::$app->id) ? '<small>Module</small>' : '';
} ?>
</h1>
<?php } ?>
<?=
Breadcrumbs::widget(
[
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]
) ?>
</section>
<section class="content">
<?= Alert::widget() ?>
<?= $content ?>
</section>
</div>
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b>Version</b> 2.0
</div>
<strong>Copyright &copy; 2017 - <?= date('Y') ?> <a href="http://zertex.ru">Zertex</a>, Dashboard by <a href="http://almsaeedstudio.com">Almsaeed Studio</a>.</strong> All rights
reserved.
</footer>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Create the tabs -->
<ul class="nav nav-tabs nav-justified control-sidebar-tabs">
<li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
<li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<!-- Home tab content -->
<div class="tab-pane" id="control-sidebar-home-tab">
<h3 class="control-sidebar-heading">Recent Activity</h3>
<ul class='control-sidebar-menu'>
<li>
<a href='javascript::;'>
<i class="menu-icon fa fa-birthday-cake bg-red"></i>
<div class="menu-info">
<h4 class="control-sidebar-subheading">Langdon's Birthday</h4>
<p>Will be 23 on April 24th</p>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<i class="menu-icon fa fa-user bg-yellow"></i>
<div class="menu-info">
<h4 class="control-sidebar-subheading">Frodo Updated His Profile</h4>
<p>New phone +1(800)555-1234</p>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<i class="menu-icon fa fa-envelope-o bg-light-blue"></i>
<div class="menu-info">
<h4 class="control-sidebar-subheading">Nora Joined Mailing List</h4>
<p>nora@example.com</p>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<i class="menu-icon fa fa-file-code-o bg-green"></i>
<div class="menu-info">
<h4 class="control-sidebar-subheading">Cron Job 254 Executed</h4>
<p>Execution time 5 seconds</p>
</div>
</a>
</li>
</ul>
<!-- /.control-sidebar-menu -->
<h3 class="control-sidebar-heading">Tasks Progress</h3>
<ul class='control-sidebar-menu'>
<li>
<a href='javascript::;'>
<h4 class="control-sidebar-subheading">
Custom Template Design
<span class="label label-danger pull-right">70%</span>
</h4>
<div class="progress progress-xxs">
<div class="progress-bar progress-bar-danger" style="width: 70%"></div>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<h4 class="control-sidebar-subheading">
Update Resume
<span class="label label-success pull-right">95%</span>
</h4>
<div class="progress progress-xxs">
<div class="progress-bar progress-bar-success" style="width: 95%"></div>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<h4 class="control-sidebar-subheading">
Laravel Integration
<span class="label label-waring pull-right">50%</span>
</h4>
<div class="progress progress-xxs">
<div class="progress-bar progress-bar-warning" style="width: 50%"></div>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<h4 class="control-sidebar-subheading">
Back End Framework
<span class="label label-primary pull-right">68%</span>
</h4>
<div class="progress progress-xxs">
<div class="progress-bar progress-bar-primary" style="width: 68%"></div>
</div>
</a>
</li>
</ul>
<!-- /.control-sidebar-menu -->
</div>
<!-- /.tab-pane -->
<!-- Settings tab content -->
<div class="tab-pane" id="control-sidebar-settings-tab">
<form method="post">
<h3 class="control-sidebar-heading">General Settings</h3>
<div class="form-group">
<label class="control-sidebar-subheading">
Report panel usage
<input type="checkbox" class="pull-right" checked/>
</label>
<p>
Some information about this general settings option
</p>
</div>
<!-- /.form-group -->
<div class="form-group">
<label class="control-sidebar-subheading">
Allow mail redirect
<input type="checkbox" class="pull-right" checked/>
</label>
<p>
Other sets of options are available
</p>
</div>
<!-- /.form-group -->
<div class="form-group">
<label class="control-sidebar-subheading">
Expose author name in posts
<input type="checkbox" class="pull-right" checked/>
</label>
<p>
Allow the user to show his name in blog posts
</p>
</div>
<!-- /.form-group -->
<h3 class="control-sidebar-heading">Chat Settings</h3>
<div class="form-group">
<label class="control-sidebar-subheading">
Show me as online
<input type="checkbox" class="pull-right" checked/>
</label>
</div>
<!-- /.form-group -->
<div class="form-group">
<label class="control-sidebar-subheading">
Turn off notifications
<input type="checkbox" class="pull-right"/>
</label>
</div>
<!-- /.form-group -->
<div class="form-group">
<label class="control-sidebar-subheading">
Delete chat history
<a href="javascript::;" class="text-red pull-right"><i class="fa fa-trash-o"></i></a>
</label>
</div>
<!-- /.form-group -->
</form>
</div>
<!-- /.tab-pane -->
</div>
</aside><!-- /.control-sidebar -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class='control-sidebar-bg'></div>

289
backend/views/layouts/content.php

@ -1,235 +1,64 @@
<?php
use yii\widgets\Breadcrumbs;
use dmstr\widgets\Alert;
?>
<div class="content-wrapper">
<section class="content-header">
<?php if (isset($this->blocks['content-header'])) { ?>
<h1><?= $this->blocks['content-header'] ?></h1>
<?php } else { ?>
<h1>
<?php
if ($this->title !== null) {
echo \yii\helpers\Html::encode($this->title);
} else {
echo \yii\helpers\Inflector::camel2words(
\yii\helpers\Inflector::id2camel($this->context->module->id)
);
echo ($this->context->module->id !== \Yii::$app->id) ? '<small>Module</small>' : '';
} ?>
</h1>
<?php } ?>
use core\components\adminlte3\widgets\Breadcrumbs;
use core\components\adminlte3\widgets\ToastrNotification;
use yii\web\View;
use yii\helpers\Html;
use yii\helpers\Inflector;
<?=
Breadcrumbs::widget(
[
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]
) ?>
</section>
/**
* @var $this View
* @var $content string
*/
<section class="content">
<?= Alert::widget() ?>
<?= $content ?>
</section>
?>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<?php if (isset($this->blocks['content-header'])) : ?>
<h4 class="m-0 text-dark"><?= $this->blocks['content-header'] ?></h4>
<?php else: ?>
<h4 class="m-0 text-dark">
<?php
if ($this->title !== null) {
echo Html::encode($this->title);
} else {
echo Inflector::camel2words(
Inflector::id2camel($this->context->module->id)
);
echo ($this->context->module->id !== \Yii::$app->id) ? '<small>Module</small>' : '';
} ?>
</h4>
<?php endif; ?>
</div><!-- /.col -->
<div class="col-sm-6">
<?=
Breadcrumbs::widget([
'links' => $this->params['breadcrumbs'] ?? [],
]) ?>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->
<!-- Main content -->
<div class="content">
<div class="container-fluid">
<section class="content">
<?= ToastrNotification::widget() ?>
<?= $content ?>
</section>
</div>
<!-- /.container-fluid -->
</div>
<!-- /.content -->
</div>
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b>Version</b> 2.0
</div>
<strong>Copyright &copy; 2017 - <?= date('Y') ?> <a href="http://zertex.ru">Zertex</a>, Dashboard by <a href="http://almsaeedstudio.com">Almsaeed Studio</a>.</strong> All rights
reserved.
</footer>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Create the tabs -->
<ul class="nav nav-tabs nav-justified control-sidebar-tabs">
<li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
<li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<!-- Home tab content -->
<div class="tab-pane" id="control-sidebar-home-tab">
<h3 class="control-sidebar-heading">Recent Activity</h3>
<ul class='control-sidebar-menu'>
<li>
<a href='javascript::;'>
<i class="menu-icon fa fa-birthday-cake bg-red"></i>
<div class="menu-info">
<h4 class="control-sidebar-subheading">Langdon's Birthday</h4>
<p>Will be 23 on April 24th</p>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<i class="menu-icon fa fa-user bg-yellow"></i>
<div class="menu-info">
<h4 class="control-sidebar-subheading">Frodo Updated His Profile</h4>
<p>New phone +1(800)555-1234</p>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<i class="menu-icon fa fa-envelope-o bg-light-blue"></i>
<div class="menu-info">
<h4 class="control-sidebar-subheading">Nora Joined Mailing List</h4>
<p>nora@example.com</p>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<i class="menu-icon fa fa-file-code-o bg-green"></i>
<div class="menu-info">
<h4 class="control-sidebar-subheading">Cron Job 254 Executed</h4>
<p>Execution time 5 seconds</p>
</div>
</a>
</li>
</ul>
<!-- /.control-sidebar-menu -->
<h3 class="control-sidebar-heading">Tasks Progress</h3>
<ul class='control-sidebar-menu'>
<li>
<a href='javascript::;'>
<h4 class="control-sidebar-subheading">
Custom Template Design
<span class="label label-danger pull-right">70%</span>
</h4>
<div class="progress progress-xxs">
<div class="progress-bar progress-bar-danger" style="width: 70%"></div>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<h4 class="control-sidebar-subheading">
Update Resume
<span class="label label-success pull-right">95%</span>
</h4>
<div class="progress progress-xxs">
<div class="progress-bar progress-bar-success" style="width: 95%"></div>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<h4 class="control-sidebar-subheading">
Laravel Integration
<span class="label label-waring pull-right">50%</span>
</h4>
<div class="progress progress-xxs">
<div class="progress-bar progress-bar-warning" style="width: 50%"></div>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<h4 class="control-sidebar-subheading">
Back End Framework
<span class="label label-primary pull-right">68%</span>
</h4>
<div class="progress progress-xxs">
<div class="progress-bar progress-bar-primary" style="width: 68%"></div>
</div>
</a>
</li>
</ul>
<!-- /.control-sidebar-menu -->
</div>
<!-- /.tab-pane -->
<!-- Settings tab content -->
<div class="tab-pane" id="control-sidebar-settings-tab">
<form method="post">
<h3 class="control-sidebar-heading">General Settings</h3>
<div class="form-group">
<label class="control-sidebar-subheading">
Report panel usage
<input type="checkbox" class="pull-right" checked/>
</label>
<p>
Some information about this general settings option
</p>
</div>
<!-- /.form-group -->
<div class="form-group">
<label class="control-sidebar-subheading">
Allow mail redirect
<input type="checkbox" class="pull-right" checked/>
</label>
<p>
Other sets of options are available
</p>
</div>
<!-- /.form-group -->
<div class="form-group">
<label class="control-sidebar-subheading">
Expose author name in posts
<input type="checkbox" class="pull-right" checked/>
</label>
<p>
Allow the user to show his name in blog posts
</p>
</div>
<!-- /.form-group -->
<h3 class="control-sidebar-heading">Chat Settings</h3>
<div class="form-group">
<label class="control-sidebar-subheading">
Show me as online
<input type="checkbox" class="pull-right" checked/>
</label>
</div>
<!-- /.form-group -->
<div class="form-group">
<label class="control-sidebar-subheading">
Turn off notifications
<input type="checkbox" class="pull-right"/>
</label>
</div>
<!-- /.form-group -->
<div class="form-group">
<label class="control-sidebar-subheading">
Delete chat history
<a href="javascript::;" class="text-red pull-right"><i class="fa fa-trash-o"></i></a>
</label>
</div>
<!-- /.form-group -->
</form>
</div>
<!-- /.tab-pane -->
</div>
</aside><!-- /.control-sidebar -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class='control-sidebar-bg'></div>

33
backend/views/layouts/error-origin.php

@ -0,0 +1,33 @@
<?php
use backend\assets\AdminLteSkinAsset;
use backend\assets\AppAsset;
use yii\helpers\Html;
use yii\web\View;
/* @var $this View */
/* @var $content string */
dmstr\web\AdminLteAsset::register($this);
AdminLteSkinAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset ?>"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<?= $content ?>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>

11
backend/views/layouts/error.php

@ -1,12 +1,17 @@
<?php
use core\components\adminlte3\AdminLteAsset;
use core\components\adminlte3\AdminLteFontsAsset;
use backend\assets\AppAsset;
use yii\helpers\Html;
use yii\web\View;
/* @var $this \yii\web\View */
/* @var $this View */
/* @var $content string */
dmstr\web\AdminLteAsset::register($this);
\backend\assets\AdminLteSkinAsset::register($this);
AppAsset::register($this);
AdminLteAsset::register($this);
AdminLteFontsAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>

265
backend/views/layouts/header-origin.php

@ -0,0 +1,265 @@
<?php
use backend\widgets\NotificationCountWidget;
use core\helpers\LanguageHelper;
use yii\helpers\Html;
use yii\web\View;
/* @var $this View */
/* @var $content string */
?>
<header class="main-header">
<?= Html::a('<span class="logo-mini">' . (Yii::$app->params['settings']['site']['short_name'] ?? 'APP') . '</span><span class="logo-lg">' . (isset(Yii::$app->params['settings']['site']['name']) ? Yii::$app->params['settings']['site']['name'] : Yii::$app->name) . '</span>',
Yii::$app->homeUrl, ['class' => 'logo']) ?>
<nav class="navbar navbar-static-top" role="navigation">
<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<!-- Messages: style can be found in dropdown.less-->
<!--
<li class="dropdown messages-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope-o"></i>
<span class="label label-success">4</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 4 messages</li>
<li>
<ul class="menu">
<li>
<a href="#">
<div class="pull-left">
<img src="< ?= $directoryAsset ?>/img/user2-160x160.jpg" class="img-circle"
alt="User Image"/>
</div>
<h4>
Support Team
<small><i class="fa fa-clock-o"></i> 5 mins</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="< ?= $directoryAsset ?>/img/user3-128x128.jpg" class="img-circle"
alt="user image"/>
</div>
<h4>
AdminLTE Design Team
<small><i class="fa fa-clock-o"></i> 2 hours</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="< ?= $directoryAsset ?>/img/user4-128x128.jpg" class="img-circle"
alt="user image"/>
</div>
<h4>
Developers
<small><i class="fa fa-clock-o"></i> Today</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="< ?= $directoryAsset ?>/img/user3-128x128.jpg" class="img-circle"
alt="user image"/>
</div>
<h4>
Sales Department
<small><i class="fa fa-clock-o"></i> Yesterday</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="< ?= $directoryAsset ?>/img/user4-128x128.jpg" class="img-circle"
alt="user image"/>
</div>
<h4>
Reviewers
<small><i class="fa fa-clock-o"></i> 2 days</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
</ul>
</li>
<li class="footer"><a href="#">See All Messages</a></li>
</ul>
</li>
-->
<?= NotificationCountWidget::widget() ?>
<!-- Tasks: style can be found in dropdown.less -->
<!--
<li class="dropdown tasks-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-flag-o"></i>
<span class="label label-danger">9</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 9 tasks</li>
<li>
<ul class="menu">
<li>
<a href="#">
<h3>
Design some buttons
<small class="pull-right">20%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-aqua" style="width: 20%"
role="progressbar" aria-valuenow="20" aria-valuemin="0"
aria-valuemax="100">
<span class="sr-only">20% Complete</span>
</div>
</div>
</a>
</li>
<li>
<a href="#">
<h3>
Create a nice theme
<small class="pull-right">40%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-green" style="width: 40%"
role="progressbar" aria-valuenow="20" aria-valuemin="0"
aria-valuemax="100">
<span class="sr-only">40% Complete</span>
</div>
</div>
</a>
</li>
<li>
<a href="#">
<h3>
Some task I need to do
<small class="pull-right">60%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-red" style="width: 60%"
role="progressbar" aria-valuenow="20" aria-valuemin="0"
aria-valuemax="100">
<span class="sr-only">60% Complete</span>
</div>
</div>
</a>
</li>
<li>
<a href="#">
<h3>
Make beautiful transitions
<small class="pull-right">80%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-yellow" style="width: 80%"
role="progressbar" aria-valuenow="20" aria-valuemin="0"
aria-valuemax="100">
<span class="sr-only">80% Complete</span>
</div>
</div>
</a>
</li>
</ul>
</li>
<li class="footer">
<a href="#">View all tasks</a>
</li>
</ul>
</li>
-->
<!-- Language Drop Down -->
<li class="dropdown messages-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<!-- <i class="fa fa-language"></i> -->
<span><?= LanguageHelper::getBackendName(Yii::$app->user->identity->user->backend_language) ?>
<i class="caret"></i></span>
</a>
<ul class="dropdown-menu">
<li class="header"><?= Yii::t('main', 'Interface Language') ?></li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<?php foreach (Yii::$app->params['backendTranslatedLanguages'] as $language => $language_name): ?>
<li>
<?= Html::a($language_name, ['/site/language', 'language' => $language], [
'data-method' => 'post'
]) ?>
</li>
<?php endforeach; ?>
</ul>
</li>
</ul>
</li>
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="<?= Yii::$app->avatar->show(Yii::$app->user->identity->user->username) ?>"
class="user-image" alt="<?= Yii::$app->user->identity->user->username ?>"/>
<span class="hidden-xs"><?= Yii::$app->user->identity->user->username ?></span>
</a>
<ul class="dropdown-menu">
<!-- User image -->
<li class="user-header">
<img src="<?= Yii::$app->avatar->show(Yii::$app->user->identity->user->username) ?>"
class="img-circle"
alt="<?= Yii::$app->user->identity->user->username ?>"/>
<p>
<?= Yii::$app->user->identity->user->username ?>
<small><?= Yii::t('user', 'Registered: {date}', [
'date' => date('d.m.Y', Yii::$app->user->identity->user->created_at)
]) ?></small>
</p>
</li>
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
<?= Html::a(
Yii::t('user', 'Profile'),
['/user/profile'],
['class' => 'btn btn-default btn-flat']
)
?>
</div>
<div class="pull-right">
<?= Html::a(
Yii::t('main', 'Sign out'),
['/auth/logout'],
['data-method' => 'post', 'class' => 'btn btn-default btn-flat']
) ?>
</div>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</header>

306
backend/views/layouts/header.php

@ -1,264 +1,56 @@
<?php
use yii\helpers\Html;
use yii\helpers\Url;
use yii\web\JsExpression;
use yii\web\View;
use kartik\select2\Select2;
/* @var $this \yii\web\View */
/* @var $this View */
/* @var $content string */
//$avatar = new AvatarGenerator();
?>
<header class="main-header">
<?= Html::a('<span class="logo-mini">' . (isset(Yii::$app->params['settings']['site']['short_name']) ? Yii::$app->params['settings']['site']['short_name'] : 'APP') . '</span><span class="logo-lg">' . (isset(Yii::$app->params['settings']['site']['name']) ? Yii::$app->params['settings']['site']['name'] : Yii::$app->name) . '</span>',
Yii::$app->homeUrl, ['class' => 'logo']) ?>
<nav class="navbar navbar-static-top" role="navigation">
<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<!-- Messages: style can be found in dropdown.less-->
<!--
<li class="dropdown messages-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope-o"></i>
<span class="label label-success">4</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 4 messages</li>
<li>
<ul class="menu">
<li>
<a href="#">
<div class="pull-left">
<img src="< ?= $directoryAsset ?>/img/user2-160x160.jpg" class="img-circle"
alt="User Image"/>
</div>
<h4>
Support Team
<small><i class="fa fa-clock-o"></i> 5 mins</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="< ?= $directoryAsset ?>/img/user3-128x128.jpg" class="img-circle"
alt="user image"/>
</div>
<h4>
AdminLTE Design Team
<small><i class="fa fa-clock-o"></i> 2 hours</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="< ?= $directoryAsset ?>/img/user4-128x128.jpg" class="img-circle"
alt="user image"/>
</div>
<h4>
Developers
<small><i class="fa fa-clock-o"></i> Today</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="< ?= $directoryAsset ?>/img/user3-128x128.jpg" class="img-circle"
alt="user image"/>
</div>
<h4>
Sales Department
<small><i class="fa fa-clock-o"></i> Yesterday</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="< ?= $directoryAsset ?>/img/user4-128x128.jpg" class="img-circle"
alt="user image"/>
</div>
<h4>
Reviewers
<small><i class="fa fa-clock-o"></i> 2 days</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
</ul>
</li>
<li class="footer"><a href="#">See All Messages</a></li>
</ul>
</li>
-->
<?= \backend\widgets\NotificationCountWidget::widget() ?>
<!-- Tasks: style can be found in dropdown.less -->
<!--
<li class="dropdown tasks-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-flag-o"></i>
<span class="label label-danger">9</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 9 tasks</li>
<li>
<ul class="menu">
<li>
<a href="#">
<h3>
Design some buttons
<small class="pull-right">20%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-aqua" style="width: 20%"
role="progressbar" aria-valuenow="20" aria-valuemin="0"
aria-valuemax="100">
<span class="sr-only">20% Complete</span>
</div>
</div>
</a>
</li>
<li>
<a href="#">
<h3>
Create a nice theme
<small class="pull-right">40%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-green" style="width: 40%"
role="progressbar" aria-valuenow="20" aria-valuemin="0"
aria-valuemax="100">
<span class="sr-only">40% Complete</span>
</div>
</div>
</a>
</li>
<li>
<a href="#">
<h3>
Some task I need to do
<small class="pull-right">60%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-red" style="width: 60%"
role="progressbar" aria-valuenow="20" aria-valuemin="0"
aria-valuemax="100">
<span class="sr-only">60% Complete</span>
</div>
</div>
</a>
</li>
<li>
<a href="#">
<h3>
Make beautiful transitions
<small class="pull-right">80%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-yellow" style="width: 80%"
role="progressbar" aria-valuenow="20" aria-valuemin="0"
aria-valuemax="100">
<span class="sr-only">80% Complete</span>
</div>
</div>
</a>
</li>
</ul>
</li>
<li class="footer">
<a href="#">View all tasks</a>
</li>
</ul>
</li>
-->
<!-- Language Drop Down -->
<li class="dropdown messages-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<!-- <i class="fa fa-language"></i> -->
<span><?= \core\helpers\LanguageHelper::getBackendName(Yii::$app->user->identity->user->backend_language) ?>
<i class="caret"></i></span>
</a>
<ul class="dropdown-menu">
<li class="header"><?= Yii::t('main', 'Interface Language') ?></li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<?php foreach (Yii::$app->params['backendTranslatedLanguages'] as $language => $language_name): ?>
<li>
<?= Html::a($language_name, ['/site/language', 'language' => $language], [
'data-method' => 'post'
]) ?>
</li>
<?php endforeach; ?>
</ul>
</li>
</ul>
</li>
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="<?= Yii::$app->avatar->show(Yii::$app->user->identity->user->username) ?>"
class="user-image" alt="<?= Yii::$app->user->identity->user->username ?>"/>
<span class="hidden-xs"><?= Yii::$app->user->identity->user->username ?></span>
</a>
<ul class="dropdown-menu">
<!-- User image -->
<li class="user-header">
<img src="<?= Yii::$app->avatar->show(Yii::$app->user->identity->user->username) ?>"
class="img-circle"
alt="<?= Yii::$app->user->identity->user->username ?>"/>
<p>
<?= Yii::$app->user->identity->user->username ?>
<small><?= Yii::t('user', 'Registered: {date}', [
'date' => date('d.m.Y', Yii::$app->user->identity->user->created_at)
]) ?></small>
</p>
</li>
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
<?= Html::a(
Yii::t('user', 'Profile'),
['/user/profile'],
['class' => 'btn btn-default btn-flat']
)
?>
</div>
<div class="pull-right">
<?= Html::a(
Yii::t('main', 'Sign out'),
['/auth/logout'],
['data-method' => 'post', 'class' => 'btn btn-default btn-flat']
) ?>
</div>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</header>
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
<!-- Left navbar links -->
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" data-widget="pushmenu" href="#"><i class="fas fa-bars"></i></a>
</li>
<!-- <li class="nav-item d-none d-sm-inline-block">
<?= Html::a(Yii::t('links', 'Plans'), ['/links/link/plans'], [
'class' => 'nav-link',
]) ?>
</li> -->
</ul>
<!-- Right navbar links -->
<ul class="navbar-nav ml-auto">
<!-- < ?= NotifyContactWidget::widget() ?>
< ?= NotifyOrderWidget::widget() ?>
< ?= NotifyReviewWidget::widget() ?> -->
<!-- User Menu -->
<li class="nav-item dropdown">
<a class="nav-link" data-toggle="dropdown" href="#">
<i class="far fa-user"></i>
</a>
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
<?= Html::a(
'<i class="fas fa-user fa-fw"></i> ' . Yii::t('user', 'Profile'),
['/user/profile'],
['class' => 'dropdown-item']
) ?>
<div class="dropdown-divider"></div>
<?= Html::a(
'<i class="fas fa-sign-out-alt fa-fw"></i> ' . Yii::t('user', 'Sign out'),
['/auth/auth/logout'],
['data-method' => 'post', 'class' => 'dropdown-item']
) ?>
</div>
</li>
</ul>
</nav>

211
backend/views/layouts/left-origin.php

@ -0,0 +1,211 @@
<?php
use core\entities\post\PostType;
use kartik\form\ActiveForm;
use core\forms\SearchForm;
use yii\helpers\Html;
use yii\helpers\Url;
$model = new SearchForm();
?>
<aside class="main-sidebar">
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img src="<?= Yii::$app->avatar->show(Yii::$app->user->identity->user->username) ?>" class="img-circle"
alt="<?= Yii::$app->user->identity->user->username ?>"/>
</div>
<div class="pull-left info">
<p><?= Yii::$app->user->identity->user->username ?></p>
<a href="#"><i class="fa fa-circle text-success"></i> <?= Yii::t('main', 'Online') ?></a>
</div>
</div>
<!-- search form -->
<?php $form = ActiveForm::begin([
'action' => Url::to(['/site/search']),
'options' => [
'class' => 'sidebar-form'
],
'enableClientValidation' => false,
'fieldConfig' => [
'options' => [
'tag' => false,
],
],
]); ?>
<?= $form->field($model, 'query', [
'addon' => [
'append' => [
'content' => Html::button('<i class="fa fa-search"></i>', ['class' => 'btn btn-flat', 'id' => 'search-btn']),
'asButton' => true
]
],
'template' => "{input}",
])->textInput(['placeholder' => Yii::t('main', 'Search...')])->label(false)->hint(false); ?>
<?php ActiveForm::end(); ?>
<!-- /.search form -->
<?= dmstr\widgets\Menu::widget(
[
'options' => ['class' => 'sidebar-menu tree', 'data-widget' => 'tree'],
'items' => \yii\helpers\ArrayHelper::merge([
['label' => Yii::t('main', 'Menu'), 'options' => ['class' => 'header']],
[
'label' => Yii::t('dashboard', 'Dashboard'),
'icon' => 'dashboard',
'url' => ['/site/index'],
'active' => $this->context->id == '/site/index'
],
[
'label' => Yii::t('user', 'Users'),
'icon' => 'user',
'url' => ['/user/index'],
'active' => $this->context->id == 'user',
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('UserManagement'),
],
[
'label' => Yii::t('user', 'Access Rules'),
'icon' => 'lock',
'items' => [
[
'label' => Yii::t('user', 'Roles'),
'icon' => 'caret-right',
'url' => ['/role/index'],
'active' => \Yii::$app->controller->getUniqueId() == 'role'
],
[
'label' => Yii::t('user', 'Permissions'),
'icon' => 'caret-right',
'url' => ['/permission/index'],
'active' => \Yii::$app->controller->getUniqueId() == 'permission'
],
],
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('UserManagement')
],
[
'label' => Yii::t('menu', 'Menu'),
'icon' => 'bars',
'url' => ['/menu/index'],
'active' => $this->context->id == 'menu',
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('MenuManagement'),
],
[
'label' => Yii::t('main', 'Modules'),
'icon' => 'cubes',
'items' => [
[
'label' => Yii::t('main', 'Modules'),
'icon' => 'caret-right',
'url' => ['/module/list'],
'active' => \Yii::$app->controller->action->getUniqueId() == 'module/list'
],
[
'label' => Yii::t('main', 'Find modules'),
'icon' => 'caret-right',
'url' => ['/module/search'],
'active' => \Yii::$app->controller->action->getUniqueId() == 'module/search'
],
],
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('ModuleManagement')
],
/*[
'label' => Yii::t('pages', 'Pages'),
'icon' => 'file-o', 'url' => ['/page/index'],
'active' => $this->context->id == 'page',
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('PagesManagement'),
],*/
[
'label' => Yii::t('post', 'Posts'),
'icon' => 'newspaper-o',
'items' => array_merge(
array_map(function (PostType $type) {
return [
'label' => $type->plural,
'icon' => 'caret-right',
'items' => [
[
'label' => Yii::t('post', 'Categories'),
'icon' => 'caret-right',
'url' => ['/post/category', 'tid' => $type->id],
'active' => \Yii::$app->controller->getUniqueId() == 'post/category' && \Yii::$app->request->get('tid') == $type->id
],
[
'label' => $type->plural,
'icon' => 'caret-right',
'url' => ['/post/post', 'tid' => $type->id],
'active' => \Yii::$app->controller->getUniqueId() == 'post/post' && \Yii::$app->request->get('tid') == $type->id
],
[
'label' => Yii::t('post', 'Tags'),
'icon' => 'caret-right',
'url' => ['/post/tag', 'tid' => $type->id],
'active' => \Yii::$app->controller->getUniqueId() == 'post/tag' && \Yii::$app->request->get('tid') == $type->id
],
]
];
}, PostType::find()->all()),
[
[
'label' => Yii::t('post', 'Comments'),
'icon' => 'caret-right',
'url' => ['/post/comment'],
'active' => \Yii::$app->controller->getUniqueId() == 'post/comment'
]
],
[
[
'label' => Yii::t('post', 'Types'),
'icon' => 'caret-right',
'url' => ['/post/type'],
'active' => \Yii::$app->controller->getUniqueId() == 'post/type'
]
]
),
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('PostManagement')
],
[
'label' => Yii::t('slider', 'Slider'),
'icon' => 'retweet',
'url' => ['/slider/index'],
'active' => $this->context->id == 'slider',
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('SliderManagement'),
],
[
'label' => Yii::t('main', 'Settings'),
'icon' => 'cog',
'items' => [
[
'label' => Yii::t('main', 'Settings List'),
'icon' => 'caret-right',
'url' => ['/settings/list/index'],
'active' => \Yii::$app->controller->getUniqueId() == 'settings/list'
],
//['label' => Yii::t('main', 'Find modules'), 'icon' => 'caret-right', 'url' => ['/module/search'], 'active' => \Yii::$app->controller->action->getUniqueId() == 'module/search'],
],
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('SettingsManagement')
],
], (isset(Yii::$app->params['adminMenu']) && is_array(Yii::$app->params['adminMenu']) ? Yii::$app->params['adminMenu'] : [])),
]
) ?>
</section>
</aside>

371
backend/views/layouts/left.php

@ -1,210 +1,291 @@
<?php
//use yii\widgets\ActiveForm;
use kartik\form\ActiveForm;
use core\forms\SearchForm;
use yii\helpers\Html;
use core\components\adminlte3\widgets\Menu;
use yii\helpers\ArrayHelper;
use yii\web\View;
$model = new SearchForm();
//use app\modules\customers\entities\CustomerBase;
/**
* @var $this View
*/
//$image = Yii::$app->imager;
$css = <<<CSS
.brand-link .brand-image {
float: none !important;
}
.sidebar-dark-primary .nav-sidebar.nav-legacy > .nav-item > .nav-link.active, .sidebar-light-primary .nav-sidebar.nav-legacy > .nav-item > .nav-link.active {
border-color: #9ed6db;
}
CSS;
$this->registerCss($css);
?>
<aside class="main-sidebar sidebar-dark-primary elevation-4">
<!-- Brand Logo -->
<a href="<?= Yii::$app->homeUrl ?>" class="brand-link">
<img src="<?= Yii::$app->params['staticHostInfo'] ?>/images/ego_white.svg" class="brand-image " style="opacity: .8">
</a>
<!-- Sidebar -->
<div class="sidebar">
<!-- Sidebar user panel (optional) -->
<div class="user-panel mt-3 pb-3 mb-3 d-flex">
<div class="image">
<!-- <img src="< ?= $image->avatar(Yii::$app->user->id) ?>" class="img-circle elevation-2" alt="User Image"> -->
<img src="<?= Yii::$app->avatar->show(Yii::$app->user->identity->user->username . '_' . Yii::$app->user->id, null, null, Yii::$app->user->identity->user->user_pic) ?>?<?= rand(10, 5000) ?>" class="img-circle elevation-2" alt="<?= Yii::$app->user->identity->user->username ?>">
</div>
<div class="info">
<a href="#" class="d-block"><?= Yii::$app->user->identity->user->username ?></a>
</div>
</div>
<aside class="main-sidebar">
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img src="<?= Yii::$app->avatar->show(Yii::$app->user->identity->user->username) ?>" class="img-circle"
alt="<?= Yii::$app->user->identity->user->username ?>"/>
</div>
<div class="pull-left info">
<p><?= Yii::$app->user->identity->user->username ?></p>
<a href="#"><i class="fa fa-circle text-success"></i> <?= Yii::t('main', 'Online') ?></a>
</div>
</div>
<!-- search form -->
<?php $form = ActiveForm::begin([
'action' => \yii\helpers\Url::to(['/site/search']),
'options' => [
'class' => 'sidebar-form'
],
'enableClientValidation' => false,
'fieldConfig' => [
'options' => [
'tag' => false,
],
],
]); ?>
<?= $form->field($model, 'query', [
'addon' => [
'append' => [
'content' => Html::button('<i class="fa fa-search"></i>', ['class' => 'btn btn-flat', 'id' => 'search-btn']),
'asButton' => true
]
],
'template' => "{input}",
])->textInput(['placeholder' => Yii::t('main', 'Search...')])->label(false)->hint(false); ?>
<?php ActiveForm::end(); ?>
<!-- /.search form -->
<?= dmstr\widgets\Menu::widget(
[
'options' => ['class' => 'sidebar-menu tree', 'data-widget' => 'tree'],
'items' => \yii\helpers\ArrayHelper::merge([
['label' => Yii::t('main', 'Menu'), 'options' => ['class' => 'header']],
<!-- Sidebar Menu -->
<nav class="mt-2">
<?php
/*$basesMenu = [
'label' => Yii::t('main', 'Customers'),
'icon' => 'fas fa-star',
'url' => ['/customers/customer/index'],
'active' => Yii::$app->controller->getUniqueId() == 'customers/customer',
'visible' => Yii::$app->user->can('admin') ||
Yii::$app->user->can('CustomerManagement')
];
$bases = CustomerBase::find()->all();
if (count($bases) > 1) {
$baseItems = array_map(function ($base) {
return [
'label' => $base->name,
'icon' => 'fas fa-caret-right',
'url' => ['/customers/customer/index', 'base_id' => $base->id],
'active' => Yii::$app->controller->getUniqueId() == 'customers/customer' &&
Yii::$app->getRequest()->get('base_id') == $base->id
];
}, $bases);
$basesMenu = [
'label' => Yii::t('main', 'Customers'),
'icon' => 'fas fa-star',
'items' => $baseItems,
'visible' => Yii::$app->user->can('admin') ||
Yii::$app->user->can('CustomerManagement')
];
}*/
?>
<?= Menu::widget([
'items' => ArrayHelper::merge([
//['label' => Yii::t('main', 'Menu'), 'options' => ['class' => 'header']],
[
'label' => Yii::t('dashboard', 'Dashboard'),
'icon' => 'dashboard',
'icon' => 'fas fa-tachometer-alt',
'url' => ['/site/index'],
'active' => $this->context->id == '/site/index'
],
[
'label' => Yii::t('user', 'Users'),
'icon' => 'user',
'icon' => 'fas fa-user',
'url' => ['/user/index'],
'active' => $this->context->id == 'user',
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('UserManagement'),
'visible' => Yii::$app->user->can('admin') || Yii::$app->user->can('UserManagement'),
],
[
'label' => Yii::t('user', 'Access Rules'),
'icon' => 'lock',
'icon' => 'fas fa-lock',
'items' => [
[
'label' => Yii::t('user', 'Roles'),
'icon' => 'caret-right',
'icon' => 'fas fa-caret-right',
'url' => ['/role/index'],
'active' => \Yii::$app->controller->getUniqueId() == 'role'
'active' => Yii::$app->controller->getUniqueId() == 'role'
],
[
'label' => Yii::t('user', 'Permissions'),
'icon' => 'caret-right',
'icon' => 'fas fa-caret-right',
'url' => ['/permission/index'],
'active' => \Yii::$app->controller->getUniqueId() == 'permission'
'active' => Yii::$app->controller->getUniqueId() == 'permission'
],
],
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('UserManagement')
'visible' => Yii::$app->user->can('admin') || Yii::$app->user->can('UserManagement')
],
[
'label' => Yii::t('menu', 'Menu'),
'icon' => 'bars',
'icon' => 'fas fa-bars',
'url' => ['/menu/index'],
'active' => $this->context->id == 'menu',
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('MenuManagement'),
'visible' => Yii::$app->user->can('admin') || Yii::$app->user->can('MenuManagement'),
],
[
'label' => Yii::t('main', 'Modules'),
'icon' => 'cubes',
'icon' => 'fas fa-cubes',
'items' => [
[
'label' => Yii::t('main', 'Modules'),
'icon' => 'caret-right',
'icon' => 'fas fa-caret-right',
'url' => ['/module/list'],
'active' => \Yii::$app->controller->action->getUniqueId() == 'module/list'
'active' => Yii::$app->controller->action->getUniqueId() == 'module/list'
],
[
'label' => Yii::t('main', 'Find modules'),
'icon' => 'caret-right',
'icon' => 'fas fa-caret-right',
'url' => ['/module/search'],
'active' => \Yii::$app->controller->action->getUniqueId() == 'module/search'
'active' => Yii::$app->controller->action->getUniqueId() == 'module/search'
],
],
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('ModuleManagement')
],
/*[
'label' => Yii::t('pages', 'Pages'),
'icon' => 'file-o', 'url' => ['/page/index'],
'active' => $this->context->id == 'page',
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('PagesManagement'),
],*/
[
'label' => Yii::t('post', 'Posts'),
'icon' => 'newspaper-o',
'items' => array_merge(
array_map(function (\core\entities\post\PostType $type) {
return [
'label' => $type->plural,
'icon' => 'caret-right',
'items' => [
[
'label' => Yii::t('post', 'Categories'),
'icon' => 'caret-right',
'url' => ['/post/category', 'tid' => $type->id],
'active' => \Yii::$app->controller->getUniqueId() == 'post/category' && \Yii::$app->request->get('tid') == $type->id
],
[
'label' => $type->plural,
'icon' => 'caret-right',
'url' => ['/post/post', 'tid' => $type->id],
'active' => \Yii::$app->controller->getUniqueId() == 'post/post' && \Yii::$app->request->get('tid') == $type->id
],
[
'label' => Yii::t('post', 'Tags'),
'icon' => 'caret-right',
'url' => ['/post/tag', 'tid' => $type->id],
'active' => \Yii::$app->controller->getUniqueId() == 'post/tag' && \Yii::$app->request->get('tid') == $type->id
],
]
];
}, \core\entities\post\PostType::find()->all()),
[
[
'label' => Yii::t('post', 'Comments'),
'icon' => 'caret-right',
'url' => ['/post/comment'],
'active' => \Yii::$app->controller->getUniqueId() == 'post/comment'
]
],
[
[
'label' => Yii::t('post', 'Types'),
'icon' => 'caret-right',
'url' => ['/post/type'],
'active' => \Yii::$app->controller->getUniqueId() == 'post/type'
]
]
),
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('PostManagement')
'visible' => Yii::$app->user->can('admin') || Yii::$app->user->can('ModuleManagement')
],
[
'label' => Yii::t('slider', 'Slider'),
'icon' => 'retweet',
'icon' => 'fa fa-exchange-alt',
'url' => ['/slider/index'],
'active' => $this->context->id == 'slider',
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('SliderManagement'),
'visible' => Yii::$app->user->can('admin') || Yii::$app->user->can('SliderManagement'),
],
[
'label' => Yii::t('main', 'Settings'),
'icon' => 'cog',
'icon' => 'fas fa-cog',
'items' => [
[
'label' => Yii::t('main', 'Settings List'),
'icon' => 'caret-right',
'icon' => 'fas fa-caret-right',
'url' => ['/settings/list/index'],
'active' => \Yii::$app->controller->getUniqueId() == 'settings/list'
'active' => Yii::$app->controller->getUniqueId() == 'settings/list'
],
//['label' => Yii::t('main', 'Find modules'), 'icon' => 'caret-right', 'url' => ['/module/search'], 'active' => \Yii::$app->controller->action->getUniqueId() == 'module/search'],
],
'visible' => \Yii::$app->user->can('admin') || \Yii::$app->user->can('SettingsManagement')
'visible' => Yii::$app->user->can('admin') || Yii::$app->user->can('SettingsManagement')
],
], (isset(Yii::$app->params['adminMenu']) && is_array(Yii::$app->params['adminMenu']) ? Yii::$app->params['adminMenu'] : [])),
]
) ?>
</section>
</aside>
//[
// 'label' => Yii::t('builder', 'Databases'),
// 'icon' => 'fas fa-database',
// 'items' => \app\modules\base_builder\helpers\BuilderHelper::getBasesMenu()
//],
//$basesMenu,
/*[
'label' => Yii::t('customers', 'Customer bases'),
'icon' => 'fas fa-users',
'url' => ['/customers/customer-base/index'],
'active' => Yii::$app->controller->getUniqueId() == 'customers/customer-base',
'visible' => Yii::$app->user->can('admin') ||
Yii::$app->user->can('CustomerManagement')
],*/
/*[
'label' => Yii::t('deals', 'Deals'),
'icon' => 'fas fa-plug',
'url' => ['/deals/deal/index'],
'active' => Yii::$app->controller->getUniqueId() == 'deals/deal',
'visible' => Yii::$app->user->can('admin') ||
Yii::$app->user->can('DealManagement')
],*/
/*[
'label' => Yii::t('calendar', 'Calendar'),
'icon' => 'fas fa-calendar-alt',
'url' => ['/calendar/events'],
'active' => Yii::$app->controller->getUniqueId() == 'calendar/events',
'visible' => Yii::$app->user->can('admin') ||
Yii::$app->user->can('CalendarManagement')
],*/
/*[
'label' => Yii::t('board', 'ToDo'),
'icon' => 'fas fa-check-square',
'url' => ['/board/cards'],
'active' => Yii::$app->controller->getUniqueId() == 'board/cards',
'visible' => Yii::$app->user->can('admin') ||
Yii::$app->user->can('BoardManagement')
],*/
/*[
'label' => Yii::t('subs', 'Mail Subs'),
'icon' => 'fas fa-envelope',
'items' => [
[
'label' => Yii::t('subs', 'Subs'),
'icon' => 'fas fa-caret-right',
'url' => ['/sub/index'],
'active' => Yii::$app->controller->getUniqueId() == 'sub',
'visible' => Yii::$app->user->can('admin') ||
Yii::$app->user->can('SubManagement')
],
[
'label' => Yii::t('mail-template', 'Mail Templates'),
'icon' => 'fas fa-caret-right',
'url' => ['/mail-template/index'],
'active' => Yii::$app->controller->getUniqueId() == 'mail-template',
'visible' => Yii::$app->user->can('admin') ||
Yii::$app->user->can('MailTemplateManagement')
],
[
'label' => Yii::t('subs', 'Signs'),
'icon' => 'fas fa-caret-right',
'url' => ['/sign/index'],
'active' => Yii::$app->controller->getUniqueId() == 'sign',
'visible' => Yii::$app->user->can('admin') ||
Yii::$app->user->can('SignManagement')
],
[
'label' => Yii::t('subs', 'DKIM'),
'icon' => 'fas fa-caret-right',
'url' => ['/dkim/index'],
'active' => Yii::$app->controller->getUniqueId() == 'dkim',
'visible' => Yii::$app->user->can('admin') ||
Yii::$app->user->can('DkimManagement')
],
]
],*/
/*[
'label' => Yii::t('sms', 'SMS Subs'),
'icon' => 'fas fa-mobile',
'url' => ['/sms/sms/index'],
'active' => Yii::$app->controller->getUniqueId() == 'sms/sms',
'visible' => Yii::$app->user->can('admin') ||
Yii::$app->user->can('SmsManagement')
],*/
/*[
'label' => Yii::t('stat', 'Statistics'),
'icon' => 'fas fa-chart-bar',
'items' => [
[
'label' => Yii::t('stat', 'Deals'),
'icon' => 'fas fa-caret-right',
'url' => ['/stat/stat/deals'],
'active' => Yii::$app->controller->action->getUniqueId() == 'stat/stat/deals',
'visible' => Yii::$app->user->can('admin') ||
Yii::$app->user->can('StatDealsStatistics')
],
[
'label' => Yii::t('stat', 'My Deals'),
'icon' => 'fas fa-caret-right',
'url' => ['/stat/stat/my-deals'],
'active' => Yii::$app->controller->action->getUniqueId() == 'stat/stat/my-deals',
'visible' => Yii::$app->user->can('admin') ||
Yii::$app->user->can('StatMyDealsStatistics')
],
]
],*/
/*[
'label' => 'API',
'icon' => 'fas fa-cogs',
'url' => ['/site/api'],
'active' => Yii::$app->controller->action->getUniqueId() == 'site/api',
'visible' => Yii::$app->user->can('admin') || Yii::$app->user->can('Franchise')
],*/
], (isset(Yii::$app->params['adminMenu']) && is_array(Yii::$app->params['adminMenu']) ? Yii::$app->params['adminMenu'] : [])),
]) ?>
</nav>
<!-- /.sidebar-menu -->
</div>
<!-- /.sidebar -->
</aside>

31
backend/views/layouts/main-login-origin.php

@ -0,0 +1,31 @@
<?php
use yii\helpers\Html;
/* @var $this \yii\web\View */
/* @var $content string */
dmstr\web\AdminLteAsset::register($this);
\backend\assets\AdminLteSkinAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset ?>"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title>
<?= \core\widgets\FaviconWidget::widget() ?>
<?php $this->head() ?>
</head>
<body class="login-page">
<?php $this->beginBody() ?>
<?= $content ?>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>

29
backend/views/layouts/main-login.php

@ -1,12 +1,27 @@
<?php
use core\components\adminlte3\AdminLteAsset;
use core\components\adminlte3\AdminLteICheckAsset;
use core\components\adminlte3\widgets\ToastrNotification;
use cp\assets\AdminLteDarkAsset;
use cp\assets\AdminLteLightAsset;
use cp\assets\AppAsset;
use yii\helpers\Html;
use yii\web\View;
/* @var $this \yii\web\View */
/* @var $this View */
/* @var $content string */
dmstr\web\AdminLteAsset::register($this);
\backend\assets\AdminLteSkinAsset::register($this);
AppAsset::register($this);
AdminLteAsset::register($this);
//if (Yii::$app->params['theme'] == \app\forms\SettingsForm::THEME_BLACK) {
//AdminLteDarkAsset::register($this);
//}
//else {
AdminLteLightAsset::register($this);
//}
//AdminLteICheckAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
@ -16,13 +31,17 @@ dmstr\web\AdminLteAsset::register($this);
<meta name="viewport" content="width=device-width, initial-scale=1">
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title>
<?= \core\widgets\FaviconWidget::widget() ?>
<?php $this->head() ?>
</head>
<body class="login-page">
<body>
<?php $this->beginBody() ?>
<?= ToastrNotification::widget() ?>
<div class="text-center mt-4">
<img style="height: 70px;" src="<?= Yii::$app->params['staticHostInfo'] ?>/images/ego_black.png">
<!-- <h4 style="color: #888;">International franchise program</h4> -->
</div>
<?= $content ?>
<?php $this->endBody() ?>

66
backend/views/layouts/main-origin.php

@ -0,0 +1,66 @@
<?php
use yii\helpers\Html;
/* @var $this \yii\web\View */
/* @var $content string */
if (Yii::$app->controller->action->id === 'login') {
/**
* Do not use this code in your template. Remove it.
* Instead, use the code $this->layout = '//main-login'; in your controller.
*/
echo $this->render(
'main-login',
['content' => $content]
);
} else {
if (class_exists('backend\assets\AppAsset')) {
backend\assets\AppAsset::register($this);
} else {
app\assets\AppAsset::register($this);
}
dmstr\web\AdminLteAsset::register($this);
\backend\assets\AdminLteSkinAsset::register($this);
$directoryAsset = Yii::$app->assetManager->getPublishedUrl('@vendor/almasaeed2010/adminlte/dist');
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset ?>"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title>
<?= \core\widgets\FaviconWidget::widget() ?>
<?php $this->head() ?>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<?php $this->beginBody() ?>
<div class="wrapper">
<?= $this->render(
'header.php',
['directoryAsset' => $directoryAsset]
) ?>
<?= $this->render(
'left.php',
['directoryAsset' => $directoryAsset]
)
?>
<?= $this->render(
'content.php',
['content' => $content, 'directoryAsset' => $directoryAsset]
) ?>
</div>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
<?php } ?>

140
backend/views/layouts/main.php

@ -1,30 +1,89 @@
<?php
use core\widgets\FaviconWidget;
use core\components\adminlte3\themes\AdminLteLightAsset;
use backend\assets\AppAsset;
use yii\helpers\Html;
use yii\web\View;
use core\components\adminlte3\AdminLteAsset;
use core\components\adminlte3\AdminLteFontsAsset;
/* @var $this \yii\web\View */
/* @var $this View */
/* @var $content string */
if (Yii::$app->controller->action->id === 'login') {
/**
* Do not use this code in your template. Remove it.
* Instead, use the code $this->layout = '//main-login'; in your controller.
*/
if (Yii::$app->controller->id == 'auth/auth' && in_array(Yii::$app->controller->action->id, ['login', 'request', 'confirm', 'login-hub', 'login-token', 'reset'])) {
echo $this->render(
'main-login',
['content' => $content]
);
} else {
if (class_exists('backend\assets\AppAsset')) {
backend\assets\AppAsset::register($this);
} else {
app\assets\AppAsset::register($this);
AppAsset::register($this);
AdminLteAsset::register($this);
AdminLteFontsAsset::register($this);
//if (Yii::$app->params['theme'] == \app\forms\SettingsForm::THEME_BLACK) {
//AdminLteDarkAsset::register($this);
//}
//else {
AdminLteLightAsset::register($this);
//}
$css = <<<CSS
.sidebar .nav .nav-link {
font-weight: 500 !important;
font-family: "Segoe UI", "Source Sans Pro", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"
}
.content-wrapper {
font-size: 0.9rem !important;
font-weight: 400 !important;
font-family: "Segoe UI", "Source Sans Pro", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"
}
.kv-grid-table.table thead th,
.kv-grid-table.table-bordered thead th,
.kv-grid-table.table-bordered thead td {
border-bottom: 0 !important;
}
label:not(.form-check-label):not(.custom-file-label) {
font-weight: 600;
}
.kv-grid-bs4 a.desc:after {
content: '\\f160';
margin-left: 3px;
}
.kv-grid-bs4 a.asc:after {
content: '\\f884';
margin-left: 3px;
}
/*.kv-grid-bs4 a:before {
@extend .fas;
margin-right: 5px;
}
.kv-grid-bs4 a.desc {
@extend .fa-sort-amount-down;
}
.kv-grid-bs4 a.asc {
@extend .fa-sort-amount-down-alt;
}*/
dmstr\web\AdminLteAsset::register($this);
\backend\assets\AdminLteSkinAsset::register($this);
$directoryAsset = Yii::$app->assetManager->getPublishedUrl('@vendor/almasaeed2010/adminlte/dist');
.breadcrumb {
font-size: 12px !important;
}
.sp-preview {
margin-right: 0 !important;
}
.sp-dd {
display: none;
}
CSS;
$this->registerCss($css);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
@ -32,35 +91,62 @@ if (Yii::$app->controller->action->id === 'login') {
<head>
<meta charset="<?= Yii::$app->charset ?>"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<?= FaviconWidget::widget() ?>
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title>
<?= \core\widgets\FaviconWidget::widget() ?>
<!-- Font Awesome Icons
<link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css"> -->
<!-- IonIcons -->
<link rel="stylesheet" href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- Google Font: Source Sans Pro -->
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=swap&subset=cyrillic" rel="stylesheet">
<?php $this->head() ?>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<body class="hold-transition sidebar-mini">
<?php $this->beginBody() ?>
<div class="wrapper">
<!-- Navbar -->
<?= $this->render('header.php') ?>
<!-- /.navbar -->
<?= $this->render(
'header.php',
['directoryAsset' => $directoryAsset]
) ?>
<?= $this->render(
'left.php',
['directoryAsset' => $directoryAsset]
)
?>
<!-- Main Sidebar Container -->
<?= $this->render('left.php') ?>
<!-- Content Wrapper. Contains page content -->
<?= $this->render(
'content.php',
['content' => $content, 'directoryAsset' => $directoryAsset]
['content' => $content]
) ?>
<!-- /.content-wrapper -->
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
</aside>
<!-- /.control-sidebar -->
<!-- Main Footer -->
<footer class="main-footer">
<strong>ZxCMS &copy; <?= date('Y') ?>
<!--<div class="float-right d-none d-sm-inline-block">
<b><?= Yii::t('main', 'Version') ?></b> 3.0
</div> -->
</footer>
</div>
<!-- ./wrapper -->
<!-- OPTIONAL SCRIPTS -->
<!-- <script src="plugins/chart.js/Chart.min.js"></script> -->
<!-- <script src="dist/js/demo.js"></script>
<script src="dist/js/pages/dashboard3.js"></script> -->
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
<?php } ?>

18
backend/views/menu/_form.php

@ -1,10 +1,13 @@
<?php
use core\components\bootstrap4\widgets\Tab4;
use core\forms\menu\MenuForm;
use yii\bootstrap\Tabs;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model \core\forms\menu\MenuForm */
/* @var $model MenuForm */
/* @var $form yii\widgets\ActiveForm */
?>
@ -12,8 +15,8 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?>
<div class="box box-default">
<div class="box-body">
<div class="card">
<div class="card-body">
<?php
$items = [];
@ -30,16 +33,15 @@ use yii\widgets\ActiveForm;
?>
<div class="nav-tabs-custom">
<?= \yii\bootstrap\Tabs::widget([
<?= Tab4::widget([
'items' => $items
]) ?>
</div>
</div>
</div>
<div class="form-group">
<?= Html::submitButton(Yii::t('buttons', 'Save'), ['class' => 'btn btn-success']) ?>
<div class="card-footer text-right">
<?= Html::submitButton(Yii::t('buttons', 'Save'), ['class' => 'btn btn-success']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>

11
backend/views/menu/_form_tab.php

@ -4,14 +4,19 @@
* Date: 24.08.2018
*/
use core\forms\menu\MenuForm;
use yii\web\View;
use yii\widgets\ActiveForm;
/**
* @var $this \yii\web\View
* @var $form \yii\widgets\ActiveForm
* @var $model \core\forms\menu\MenuForm
* @var $this View
* @var $form ActiveForm
* @var $model MenuForm
* @var $language string
*/
$postfix = $language == Yii::$app->params['defaultLanguage'] ? '' : '_' . $language;
?>
<div class="mt-2"></div>
<?= $form->field($model, 'name' . $postfix)->textInput(['maxlength' => true]) ?>

4
backend/views/menu/create.php

@ -1,7 +1,9 @@
<?php
/* @var $this yii\web\View */
/* @var $model \core\forms\menu\MenuForm */
/* @var $model MenuForm */
use core\forms\menu\MenuForm;
$this->title = Yii::t('menu', 'Create Menu');
$this->params['breadcrumbs'][] = ['label' => Yii::t('menu', 'Menu'), 'url' => ['index']];

74
backend/views/menu/menu.php

@ -4,14 +4,18 @@
* Date: 10.07.2018
*/
use backend\components\menu\widgets\MenuEditorWidget;
use core\entities\menu\Menu;
use core\forms\menu\MenuSelectForm;
use kartik\form\ActiveForm;
use yii\helpers\Html;
use yii\web\View;
/**
* @var $this \yii\web\View
* @var $model \core\forms\menu\MenuSelectForm
* @var $menus \core\entities\menu\Menu[]
* @var $menu \core\entities\menu\Menu
* @var $this View
* @var $model MenuSelectForm
* @var $menus Menu[]
* @var $menu Menu
* @var $creator array
*/
@ -41,11 +45,11 @@ $this->registerJs($js, $this::POS_HEAD);
?>
<div class="menu">
<div class="box box-default">
<div class="box-header with-border"><?= Yii::t('menu', 'Current Menu') ?></div>
<div class="box-body">
<div class="card">
<div class="card-header"><?= Yii::t('menu', 'Current Menu') ?></div>
<div class="card-body">
<div class="row">
<div class="row menu-selector">
<div class="col-md-6">
<?php $form = ActiveForm::begin([
'enableClientValidation' => false,
@ -54,6 +58,7 @@ $this->registerJs($js, $this::POS_HEAD);
]); ?>
<?= $form->field($model, 'id')->dropDownList($menus, [
'class' => 'form-control mb-1',
//'prompt' => Yii::t('menu', 'Select menu...'),
'value' => $menu->id,
'onchange' => 'this.form.submit()',
@ -63,15 +68,15 @@ $this->registerJs($js, $this::POS_HEAD);
</div>
<div class="col-md-6">
<?= Html::a(Yii::t('menu', 'Create Menu'), ['menu/create'], [
'class' => 'btn btn-success',
'class' => 'btn btn-success d-block d-md-inline-block mb-1',
]) ?>
<?= Html::a(Yii::t('menu', 'Update Menu'), ['menu/update', 'id' => $menu->id], [
'class' => 'btn btn-primary',
'class' => 'btn btn-primary d-block d-md-inline-block mb-1',
]) ?>
<?= Html::a(Yii::t('menu', 'Delete Menu'), ['menu/delete', 'id' => $menu->id], [
'class' => 'btn btn-danger',
'class' => 'btn btn-danger d-block d-md-inline-block mb-1',
'data' => [
'confirm' => Yii::t('buttons', 'Are you sure you want to delete this item?'),
'method' => 'post',
@ -85,24 +90,25 @@ $this->registerJs($js, $this::POS_HEAD);
<div class="row">
<div class="col-md-3">
<div class="box box-default">
<div class="box-header with-border"><?= Yii::t('menu', 'Available Blocks') ?></div>
<div class="box-body">
<div class="card">
<div class="card-header"><?= Yii::t('menu', 'Available Blocks') ?></div>
<div class="card-body">
<div class="panel-group" id="accordion">
<div id="accordion">
<?php foreach ($creator as $item) : ?>
<div class="panel panel-default">
<div class="panel-heading" style="padding-left: 0">
<h4 class="panel-title">
<div class="card">
<div class="card-header" style="padding-left: 0; border: 0 !important;">
<h4 class="card-title">
<a data-toggle="collapse" data-parent="#accordion"
href="#collapse<?= $item['id'] ?>"><?= $item['title'] ?>
<i class="fa fa-angle-down pull-right" aria-hidden="true"></i></a>
<i class="fa fa-angle-down" style="position: absolute; right: 10px; top 10px;" aria-hidden="true"></i>
</a>
</h4>
</div>
<div id="collapse<?= $item['id'] ?>" class="panel-collapse collapse">
<div class="panel-body">
<div class="card-body">
<?= $item['content'] ?>
</div>
</div>
@ -116,11 +122,11 @@ $this->registerJs($js, $this::POS_HEAD);
</div>
</div>
<div class="col-md-6">
<div class="box box-default">
<div class="box-header with-border"><?= Yii::t('menu', 'Menu Items') ?></div>
<div class="box-body">
<div class="card">
<div class="card-header"><?= Yii::t('menu', 'Menu Items') ?></div>
<div class="card-body">
<?= \backend\components\menu\widgets\MenuEditorWidget::widget([
<?= MenuEditorWidget::widget([
'menu_id' => $menu->id
]) ?>
@ -129,35 +135,37 @@ $this->registerJs($js, $this::POS_HEAD);
</div>
<div class="col-md-3">
<div class="box box-default">
<div class="box-header with-border"><?= Yii::t('menu', 'Insert Code') ?></div>
<div class="box-body">
<div class="card">
<div class="card-header"><?= Yii::t('menu', 'Insert Code') ?></div>
<div class="card-body">
<?php
$code = "<?= \core\widgets\menu\MenuWidget::widget(['menu_id' => " . $menu->id . ']) ?>';
?>
<p><?= Yii::t('menu', 'For template') ?></p>
<label for="code_template"><?= Yii::t('menu', 'For template') ?></label>
<div class="input-group">
<?= Html::input('text', 'code_template', $code, [
'class' => 'form-control',
'class' => 'form-control form-control-sm',
'id' => 'code_template',
]) ?>
<span class="input-group-btn">
<button id="copyTemplateCodeButton" type="button" class="btn btn-primary btn-flat"><i class="fa fa-files-o" aria-hidden="true"></i></button>
<button id="copyTemplateCodeButton" type="button" class="btn btn-default btn-flat btn-sm"><i class="fas fa-copy" aria-hidden="true"></i></button>
</span>
</div>
<?php
$code = "[?= \core\widgets\menu\MenuWidget::widget(['menu_id' => " . $menu->id . ']) ?]';
?>
<p><?= Yii::t('menu', 'For editor') ?></p>
<label for="code_template" class="mt-2"><?= Yii::t('menu', 'For editor') ?></label>
<div class="input-group">
<?= Html::input('text', 'code_editor', $code, [
'class' => 'form-control',
'class' => 'form-control form-control-sm',
'id' => 'code_editor',
]) ?>
<span class="input-group-btn">
<button id="copyEditorCodeButton" type="button" class="btn btn-primary btn-flat"><i class="fa fa-files-o" aria-hidden="true"></i></button>
<button id="copyEditorCodeButton" type="button" class="btn btn-default btn-flat btn-sm"><i class="fas fa-copy" aria-hidden="true"></i></button>
</span>
</div>

10
backend/views/menu/select_menu.php

@ -4,14 +4,16 @@
* Date: 10.07.2018
*/
use core\entities\menu\Menu;
use core\forms\menu\MenuSelectForm;
use kartik\form\ActiveForm;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\web\View;
/**
* @var $this \yii\web\View
* @var $model \core\forms\menu\MenuSelectForm
* @var $menus \core\entities\menu\Menu[]
* @var $this View
* @var $model MenuSelectForm
* @var $menus Menu[]
*/
$this->title = Yii::t('menu', 'Menu');

7
backend/views/menu/update.php

@ -1,8 +1,11 @@
<?php
/* @var $this yii\web\View */
/* @var $menu \core\entities\menu\Menu */
/* @var $model \core\forms\menu\MenuForm */
/* @var $menu Menu */
/* @var $model MenuForm */
use core\entities\menu\Menu;
use core\forms\menu\MenuForm;
$this->title = Yii::t('menu', 'Update Menu: {name}', ['name' => isset($menu->translation) ? $menu->translation->name : Yii::t('menu', 'Not set')]);
$this->params['breadcrumbs'][] = ['label' => Yii::t('menu', 'Menu'), 'url' => ['index']];

14
backend/views/module/list.php

@ -4,13 +4,15 @@
* Date: 17.08.2018
*/
use core\entities\ModuleRecord;
use yii\helpers\Html;
use core\helpers\ModuleHelper;
use kartik\dialog\Dialog;
use yii\web\View;
/**
* @var $this \yii\web\View
* @var $modules \core\entities\ModuleRecord[]
* @var $this View
* @var $modules ModuleRecord[]
*/
$this->title = Yii::t('main', 'Modules');
@ -47,15 +49,15 @@ $this->registerJs($js, $this::POS_READY);
<div class="col-md-4">
<div class="box">
<div class="box-header with-border">
<div class="card">
<div class="card-header">
<h3 class="box-title"><i class="fa fa-power-off" aria-hidden="true"
style="color: <?= $color ?>"></i> <?= $module_name ?></h3>
</div>
<div class="box-body">
<div class="card-body">
<?= $module_description ?>
</div>
<div class="box-footer" style="text-align: right">
<div class="card-footer" style="text-align: right">
<?php if (!$module->isSystem()) : ?>
<?php if ($module->isEnabled()) : ?>
<?= Html::a(Yii::t('main', 'Disable'), ['module/disable', 'id' => $module->id], [

3
backend/views/module/remote-list.php

@ -6,9 +6,10 @@
use yii\helpers\Html;
use kartik\dialog\Dialog;
use yii\web\View;
/**
* @var $this \yii\web\View
* @var $this View
* @var $modules array
* @var $message string
*/

14
backend/views/permission/create.php

@ -1,8 +1,9 @@
<?php
/* @var $this yii\web\View */
/* @var $model \backend\forms\rbac\RbacCreatePermissionForm */
/* @var $model RbacCreatePermissionForm */
use backend\forms\rbac\RbacCreatePermissionForm;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
@ -15,17 +16,16 @@ $this->params['breadcrumbs'][] = $this->title;
<?php $form = ActiveForm::begin(); ?>
<div class="box box-default">
<div class="box-body">
<div class="card">
<div class="card-body">
<?= $form->field($model, 'name')->textInput(['maxLength' => true]) ?>
<?= $form->field($model, 'description')->textarea() ?>
<?= $form->field($model, 'rule_name')->textInput(['maxLength' => true]) ?>
<?= $form->field($model, 'data')->textarea() ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton(Yii::t('buttons', 'Save'), ['class' => 'btn btn-primary']) ?>
<card class="card-footer text-right">
<?= Html::submitButton(Yii::t('buttons', 'Save'), ['class' => 'btn btn-success']) ?>
</card>
</div>
<?php ActiveForm::end(); ?>

12
backend/views/permission/index.php

@ -11,13 +11,11 @@ $this->title = Yii::t('user', 'Permissions');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="users-rbac-permission-index">
<p>
<?= Html::a(Yii::t('user', 'Create Permission'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<div class="box box-default">
<div class="box-body">
<div class="card">
<div class="card-header">
<?= Html::a(Yii::t('user', 'Create Permission'), ['create'], ['class' => 'btn btn-success btn-sm']) ?>
</div>
<div class="card-body">
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [

18
backend/views/permission/update.php

@ -1,11 +1,12 @@
<?php
/* @var $this yii\web\View */
/* @var $model \backend\forms\rbac\RbacEditPermissionForm */
use backend\forms\rbac\RbacEditPermissionForm;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model RbacEditPermissionForm */
$this->title = Yii::t('user', 'Update Permission: {permission}', ['permission' => $model->name]);
$this->params['breadcrumbs'][] = ['label' => Yii::t('user', 'Permissions'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->name]];
@ -15,17 +16,16 @@ $this->params['breadcrumbs'][] = Yii::t('user', 'Editing');
<?php $form = ActiveForm::begin(); ?>
<div class="box box-default">
<div class="box-body">
<div class="card">
<div class="card-body">
<?= $form->field($model, 'name')->textInput(['maxLength' => true]) ?>
<?= $form->field($model, 'description')->textarea() ?>
<?= $form->field($model, 'rule_name')->textInput(['maxLength' => true]) ?>
<?= $form->field($model, 'data')->textarea() ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton(Yii::t('buttons', 'Save'), ['class' => 'btn btn-primary']) ?>
<card class="card-footer text-right">
<?= Html::submitButton(Yii::t('buttons', 'Save'), ['class' => 'btn btn-success']) ?>
</card>
</div>
<?php ActiveForm::end(); ?>

14
backend/views/permission/view.php

@ -1,11 +1,11 @@
<?php
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\rbac\Role;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model \yii\rbac\Role */
/* @var $model Role */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('user', 'Permissions'), 'url' => ['index']];
@ -14,10 +14,10 @@ $this->params['breadcrumbs'][] = $this->title;
<div class="users-rbac-permission-view">
<p>
<?= Html::a(Yii::t('user', 'Permissions'), ['index'], ['class' => 'btn btn-default']) ?>
<?= Html::a(Yii::t('buttons', 'Edit'), ['update', 'id' => $model->name], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('user', 'Permissions'), ['index'], ['class' => 'btn btn-outline-primary btn-sm']) ?>
<?= Html::a(Yii::t('buttons', 'Edit'), ['update', 'id' => $model->name], ['class' => 'btn btn-primary btn-sm']) ?>
<?= Html::a(Yii::t('buttons', 'Delete'), ['delete', 'id' => $model->name], [
'class' => 'btn btn-danger',
'class' => 'btn btn-danger btn-sm',
'data' => [
'confirm' => Yii::t('buttons', 'Are you sure you want to delete this item?'),
'method' => 'post',
@ -25,8 +25,8 @@ $this->params['breadcrumbs'][] = $this->title;
]) ?>
</p>
<div class="box box-default">
<div class="box-body">
<div class="card">
<div class="card-body">
<?= DetailView::widget([
'model' => $model,
'attributes' => [

18
backend/views/post/articles/_form.php

@ -1,19 +1,25 @@
<?php
use core\forms\post\PostForm;
use kartik\file\FileInput;
use kartik\widgets\DateTimePicker;
use kartik\widgets\Select2;
use mihaildev\ckeditor\CKEditor;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\Json;
use yii\helpers\Url;
use yii\web\JsExpression;
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostForm */
/* @var $model PostForm */
/* @var $form yii\widgets\ActiveForm */
$fetchUrl = \yii\helpers\Url::to( [ 'tag-search' ] );
$fetchUrl = Url::to( [ 'tag-search' ] );
if (isset($model->_post)) {
$tagsJson = \yii\helpers\Json::encode( \yii\helpers\Json::encode( \yii\helpers\ArrayHelper::map( $model->_post->tags, 'id', 'name' ) ) );
$tagsJson = Json::encode( Json::encode( ArrayHelper::map( $model->_post->tags, 'id', 'name' ) ) );
$js = <<<JS
var arr = {$tagsJson};
@ -38,7 +44,7 @@ JS;
<div class="box-header with-border"><?= Yii::t('post', 'Common') ?></div>
<div class="box-body">
<?= $form->field($model, 'category_id')->dropDownList($model->categoriesList($model->type_id), ['prompt' => '']) ?>
<?= $form->field($model, 'published_at')->widget(\kartik\widgets\DateTimePicker::classname(), [
<?= $form->field($model, 'published_at')->widget(DateTimePicker::class, [
'options' => [],
'pluginOptions' => [
'autoclose' => true,
@ -52,7 +58,7 @@ JS;
<div class="box box-default">
<div class="box-header with-border"><?= Yii::t('post', 'Tags') ?></div>
<div class="box-body">
<?= $form->field($model->tags, 'new_tags')->widget(\kartik\widgets\Select2::classname(), [
<?= $form->field($model->tags, 'new_tags')->widget(Select2::class, [
'options' => [
'placeholder' => Yii::t('post','Set tags...'),
'multiple' => true,
@ -81,7 +87,7 @@ JS;
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'description')->textarea(['rows' => 5]) ?>
<?= $form->field($model, 'content')->widget(CKEditor::className()) ?>
<?= $form->field($model, 'content')->widget(CKEditor::class) ?>
</div>
</div>

7
backend/views/post/articles/create.php

@ -1,8 +1,11 @@
<?php
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostForm */
/* @var $type \core\entities\post\PostType */
/* @var $model PostForm */
/* @var $type PostType */
use core\entities\post\PostType;
use core\forms\post\PostForm;
$title = Yii::t('post', 'Create Post');
$this->title = $type->plural . ' > ' . $title;

12
backend/views/post/articles/index.php

@ -1,14 +1,18 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostType;
use core\forms\post\search\PostSearch;
use core\helpers\PostHelper;
use yii\grid\ActionColumn;
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel \core\forms\post\search\PostSearch */
/* @var $searchModel PostSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $type \core\entities\post\PostType */
/* @var $type PostType */
$title = Yii::t('post', 'All Posts');
$this->title = $type->plural .' > '. $title;
@ -67,11 +71,11 @@ $this->params['breadcrumbs'][] = $title;
'contentOptions' => ['class' => 'text-center'],
],
[
'class' => \yii\grid\ActionColumn::class,
'class' => ActionColumn::class,
'urlCreator' => function($action, Post $model, $key, $index, $column) {
$params = is_array($key) ? $key : ['id' => (string) $key, 'tid' => $model->type_id];
$params[0] = $column->controller ? $column->controller . '/' . $action : $action;
return \yii\helpers\Url::toRoute($params);
return Url::toRoute($params);
},
'options' => ['style' => 'width: 100px;'],
'contentOptions' => ['class' => 'text-center'],

13
backend/views/post/articles/update.php

@ -1,11 +1,16 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostType;
use core\forms\post\PostForm;
use yii\helpers\StringHelper;
/* @var $this yii\web\View */
/* @var $post \core\entities\post\Post */
/* @var $model \core\forms\post\PostForm */
/* @var $type \core\entities\post\PostType */
/* @var $post Post */
/* @var $model PostForm */
/* @var $type PostType */
$title = Yii::t('post', 'Update Post: {name}', ['name' => \yii\helpers\StringHelper::truncateWords($post->title, 6, '...')]);
$title = Yii::t('post', 'Update Post: {name}', ['name' => StringHelper::truncateWords($post->title, 6, '...')]);
$this->title = $type->plural . ' > ' . $title;
$this->params['breadcrumbs'][] = ['label' => Yii::t('post', $type->plural), 'url' => ['index', 'tid' => $type->id]];
$this->params['breadcrumbs'][] = ['label' => $type->singular, 'url' => ['view', 'id' => $post->id]];

6
backend/views/post/articles/view.php

@ -1,14 +1,16 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostType;
use core\helpers\PostHelper;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $post \core\entities\post\Post */
/* @var $post Post */
/* @var $modificationsProvider yii\data\ActiveDataProvider */
/* @var $type \core\entities\post\PostType */
/* @var $type PostType */
$title = $post->title;
$this->title = $type->plural . ' > ' . $title;

18
backend/views/post/blog/_form.php

@ -1,19 +1,25 @@
<?php
use core\forms\post\PostForm;
use kartik\file\FileInput;
use kartik\widgets\DateTimePicker;
use kartik\widgets\Select2;
use mihaildev\ckeditor\CKEditor;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\Json;
use yii\helpers\Url;
use yii\web\JsExpression;
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostForm */
/* @var $model PostForm */
/* @var $form yii\widgets\ActiveForm */
$fetchUrl = \yii\helpers\Url::to( [ 'tag-search' ] );
$fetchUrl = Url::to( [ 'tag-search' ] );
if (isset($model->_post)) {
$tagsJson = \yii\helpers\Json::encode( \yii\helpers\Json::encode( \yii\helpers\ArrayHelper::map( $model->_post->tags, 'id', 'name' ) ) );
$tagsJson = Json::encode( Json::encode( ArrayHelper::map( $model->_post->tags, 'id', 'name' ) ) );
$js = <<<JS
var arr = {$tagsJson};
@ -38,7 +44,7 @@ JS;
<div class="box-header with-border"><?= Yii::t('post', 'Common') ?></div>
<div class="box-body">
<?= $form->field($model, 'category_id')->dropDownList($model->categoriesList($model->type_id), ['prompt' => '']) ?>
<?= $form->field($model, 'published_at')->widget(\kartik\widgets\DateTimePicker::classname(), [
<?= $form->field($model, 'published_at')->widget(DateTimePicker::class, [
'options' => [],
'pluginOptions' => [
'autoclose' => true,
@ -52,7 +58,7 @@ JS;
<div class="box box-default">
<div class="box-header with-border"><?= Yii::t('post', 'Tags') ?></div>
<div class="box-body">
<?= $form->field($model->tags, 'new_tags')->widget(\kartik\widgets\Select2::classname(), [
<?= $form->field($model->tags, 'new_tags')->widget(Select2::class, [
'options' => [
'placeholder' => Yii::t('post','Set tags...'),
'multiple' => true,
@ -81,7 +87,7 @@ JS;
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'description')->textarea(['rows' => 5]) ?>
<?= $form->field($model, 'content')->widget(CKEditor::className()) ?>
<?= $form->field($model, 'content')->widget(CKEditor::class) ?>
</div>
</div>

7
backend/views/post/blog/create.php

@ -1,8 +1,11 @@
<?php
use core\entities\post\PostType;
use core\forms\post\PostForm;
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostForm */
/* @var $type \core\entities\post\PostType */
/* @var $model PostForm */
/* @var $type PostType */
$title = Yii::t('post', 'Create Post');
$this->title = $type->plural . ' > ' . $title;

9
backend/views/post/blog/index.php

@ -1,14 +1,17 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostType;
use core\forms\post\search\PostSearch;
use core\helpers\PostHelper;
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel \core\forms\post\search\PostSearch */
/* @var $searchModel PostSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $type \core\entities\post\PostType */
/* @var $type PostType */
$title = Yii::t('post', 'All Posts');
$this->title = $type->plural .' > '. $title;
@ -71,7 +74,7 @@ $this->params['breadcrumbs'][] = $title;
'urlCreator' => function($action, Post $model, $key, $index, $column) {
$params = is_array($key) ? $key : ['id' => (string) $key, 'tid' => $model->type_id];
$params[0] = $column->controller ? $column->controller . '/' . $action : $action;
return \yii\helpers\Url::toRoute($params);
return Url::toRoute($params);
},
'options' => ['style' => 'width: 100px;'],
'contentOptions' => ['class' => 'text-center'],

13
backend/views/post/blog/update.php

@ -1,11 +1,16 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostType;
use core\forms\post\PostForm;
use yii\helpers\StringHelper;
/* @var $this yii\web\View */
/* @var $post \core\entities\post\Post */
/* @var $model \core\forms\post\PostForm */
/* @var $type \core\entities\post\PostType */
/* @var $post Post */
/* @var $model PostForm */
/* @var $type PostType */
$title = Yii::t('post', 'Update Post: {name}', ['name' => \yii\helpers\StringHelper::truncateWords($post->title, 6, '...')]);
$title = Yii::t('post', 'Update Post: {name}', ['name' => StringHelper::truncateWords($post->title, 6, '...')]);
$this->title = $type->plural . ' > ' . $title;
$this->params['breadcrumbs'][] = ['label' => Yii::t('post', $type->plural), 'url' => ['index', 'tid' => $type->id]];
$this->params['breadcrumbs'][] = ['label' => $type->singular, 'url' => ['view', 'id' => $post->id]];

6
backend/views/post/blog/view.php

@ -1,14 +1,16 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostType;
use core\helpers\PostHelper;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $post \core\entities\post\Post */
/* @var $post Post */
/* @var $modificationsProvider yii\data\ActiveDataProvider */
/* @var $type \core\entities\post\PostType */
/* @var $type PostType */
$title = $post->title;
$this->title = $type->plural . ' > ' . $title;

5
backend/views/post/category/_form.php

@ -1,11 +1,12 @@
<?php
use core\forms\post\PostCategoryForm;
use mihaildev\ckeditor\CKEditor;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostCategoryForm */
/* @var $model PostCategoryForm */
/* @var $form yii\widgets\ActiveForm */
?>
@ -31,7 +32,7 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'description')->widget(CKEditor::className()) ?>
<?= $form->field($model, 'description')->widget(CKEditor::class) ?>
</div>
</div>

7
backend/views/post/category/create.php

@ -1,8 +1,11 @@
<?php
use core\entities\post\PostType;
use core\forms\post\PostCategoryForm;
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostCategoryForm */
/* @var $type \core\entities\post\PostType */
/* @var $model PostCategoryForm */
/* @var $type PostType */
$title = Yii::t('post', 'Create Category');
$this->title = $type->plural . ' > ' . $title;

6
backend/views/post/category/index.php

@ -1,14 +1,16 @@
<?php
use core\entities\post\PostCategory;
use core\entities\post\PostType;
use core\forms\post\search\PostCategorySearch;
use yii\grid\ActionColumn;
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel \core\forms\post\search\PostCategorySearch */
/* @var $searchModel PostCategorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $type \core\entities\post\PostType */
/* @var $type PostType */
$title = Yii::t('post', 'Categories');
$this->title = $type->plural .' > '. $title;

10
backend/views/post/category/update.php

@ -1,9 +1,13 @@
<?php
use core\entities\post\PostCategory;
use core\entities\post\PostType;
use core\forms\post\PostCategoryForm;
/* @var $this yii\web\View */
/* @var $category \core\entities\post\PostCategory */
/* @var $model \core\forms\post\PostCategoryForm */
/* @var $type \core\entities\post\PostType */
/* @var $category PostCategory */
/* @var $model PostCategoryForm */
/* @var $type PostType */
$title = Yii::t('post', 'Update: {name}', ['name' => $category->name]);
$this->title = $type->plural . ' > ' . $title;

6
backend/views/post/category/view.php

@ -1,11 +1,13 @@
<?php
use core\entities\post\PostCategory;
use core\entities\post\PostType;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $category \core\entities\post\PostCategory */
/* @var $type \core\entities\post\PostType */
/* @var $category PostCategory */
/* @var $type PostType */
$title = $category->name;
$this->title = $type->plural . ' > ' . $title;

3
backend/views/post/comment/index.php

@ -1,12 +1,13 @@
<?php
use core\entities\post\PostComment;
use core\forms\post\search\PostCommentSearch;
use yii\grid\ActionColumn;
use yii\grid\GridView;
use yii\helpers\StringHelper;
/* @var $this yii\web\View */
/* @var $searchModel \core\forms\post\search\PostCommentSearch */
/* @var $searchModel PostCommentSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('post', 'Comments');

6
backend/views/post/comment/update.php

@ -1,11 +1,13 @@
<?php
use core\entities\post\Post;
use core\forms\post\PostCommentEditForm;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
/* @var $this yii\web\View */
/* @var $post \core\entities\post\Post */
/* @var $model \core\forms\post\PostCommentEditForm */
/* @var $post Post */
/* @var $model PostCommentEditForm */
$this->title = Yii::t('post', 'Update Post Comment: {name}', ['name' => $post->title]);
$this->params['breadcrumbs'][] = ['label' => Yii::t('post', 'Comment'), 'url' => ['index']];

8
backend/views/post/comment/view.php

@ -1,12 +1,14 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostComment;
use yii\helpers\Html;
use yii\widgets\DetailView;
use core\entities\user\User;
/* @var $this yii\web\View */
/* @var $post \core\entities\post\Post */
/* @var $comment \core\entities\post\PostComment */
/* @var $post Post */
/* @var $comment PostComment */
/* @var $modificationsProvider yii\data\ActiveDataProvider */
$this->title = $post->title;
@ -47,7 +49,7 @@ $this->params['breadcrumbs'][] = $this->title;
'active:boolean',
[
'attribute' => 'user_id',
'value' => function(\core\entities\post\PostComment $comment) {
'value' => function(PostComment $comment) {
return User::findOne($comment->user_id)->username;
},
],

16
backend/views/post/gallery/_form.php

@ -1,18 +1,24 @@
<?php
use core\forms\post\PostForm;
use kartik\file\FileInput;
use kartik\widgets\DateTimePicker;
use kartik\widgets\Select2;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\Json;
use yii\helpers\Url;
use yii\web\JsExpression;
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostForm */
/* @var $model PostForm */
/* @var $form yii\widgets\ActiveForm */
$fetchUrl = \yii\helpers\Url::to( [ 'tag-search' ] );
$fetchUrl = Url::to( [ 'tag-search' ] );
if (isset($model->_post)) {
$tagsJson = \yii\helpers\Json::encode( \yii\helpers\Json::encode( \yii\helpers\ArrayHelper::map( $model->_post->tags, 'id', 'name' ) ) );
$tagsJson = Json::encode( Json::encode( ArrayHelper::map( $model->_post->tags, 'id', 'name' ) ) );
$js = <<<JS
var arr = {$tagsJson};
@ -37,7 +43,7 @@ JS;
<div class="box-header with-border"><?= Yii::t('post', 'Common') ?></div>
<div class="box-body">
<?= $form->field($model, 'category_id')->dropDownList($model->categoriesList($model->type_id), ['prompt' => '']) ?>
<?= $form->field($model, 'published_at')->widget(\kartik\widgets\DateTimePicker::classname(), [
<?= $form->field($model, 'published_at')->widget(DateTimePicker::class, [
'options' => [],
'pluginOptions' => [
'autoclose' => true,
@ -51,7 +57,7 @@ JS;
<div class="box box-default">
<div class="box-header with-border"><?= Yii::t('post', 'Tags') ?></div>
<div class="box-body">
<?= $form->field($model->tags, 'new_tags')->widget(\kartik\widgets\Select2::classname(), [
<?= $form->field($model->tags, 'new_tags')->widget(Select2::class, [
'options' => [
'placeholder' => Yii::t('post','Set tags...'),
'multiple' => true,

7
backend/views/post/gallery/create.php

@ -1,8 +1,11 @@
<?php
use core\entities\post\PostType;
use core\forms\post\PostForm;
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostForm */
/* @var $type \core\entities\post\PostType */
/* @var $model PostForm */
/* @var $type PostType */
$title = Yii::t('post', 'Add Image');
$this->title = $type->plural . ' > ' . $title;

9
backend/views/post/gallery/index.php

@ -1,14 +1,17 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostType;
use core\forms\post\search\PostSearch;
use core\helpers\PostHelper;
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel \core\forms\post\search\PostSearch */
/* @var $searchModel PostSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $type \core\entities\post\PostType */
/* @var $type PostType */
$title = Yii::t('post', 'All Posts');
$this->title = $type->plural .' > '. $title;
@ -71,7 +74,7 @@ $this->params['breadcrumbs'][] = $title;
'urlCreator' => function($action, Post $model, $key, $index, $column) {
$params = is_array($key) ? $key : ['id' => (string) $key, 'tid' => $model->type_id];
$params[0] = $column->controller ? $column->controller . '/' . $action : $action;
return \yii\helpers\Url::toRoute($params);
return Url::toRoute($params);
},
'options' => ['style' => 'width: 100px;'],
'contentOptions' => ['class' => 'text-center'],

10
backend/views/post/gallery/update.php

@ -1,9 +1,13 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostType;
use core\forms\post\PostForm;
/* @var $this yii\web\View */
/* @var $post \core\entities\post\Post */
/* @var $model \core\forms\post\PostForm */
/* @var $type \core\entities\post\PostType */
/* @var $post Post */
/* @var $model PostForm */
/* @var $type PostType */
$title = Yii::t('post', 'Update Post: {name}', ['name' => \yii\helpers\StringHelper::truncateWords($post->title, 6, '...')]);
$this->title = $type->plural . ' > ' . $title;

6
backend/views/post/gallery/view.php

@ -1,14 +1,16 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostType;
use core\helpers\PostHelper;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $post \core\entities\post\Post */
/* @var $post Post */
/* @var $modificationsProvider yii\data\ActiveDataProvider */
/* @var $type \core\entities\post\PostType */
/* @var $type PostType */
$title = $post->title;
$this->title = $type->plural . ' > ' . $title;

18
backend/views/post/news/_form.php

@ -1,20 +1,26 @@
<?php
use core\forms\post\PostForm;
use kartik\file\FileInput;
use kartik\widgets\DateTimePicker;
use kartik\widgets\Select2;
use mihaildev\ckeditor\CKEditor;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\Json;
use yii\helpers\Url;
use yii\web\JsExpression;
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostForm */
/* @var $model PostForm */
/* @var $form yii\widgets\ActiveForm */
$fetchUrl = \yii\helpers\Url::to( [ 'tag-search' ] );
$fetchUrl = Url::to( [ 'tag-search' ] );
if (isset($model->_post)) {
$tagsJson = \yii\helpers\Json::encode( \yii\helpers\Json::encode( \yii\helpers\ArrayHelper::map( $model->_post->tags, 'id', 'name' ) ) );
$tagsJson = Json::encode( Json::encode( ArrayHelper::map( $model->_post->tags, 'id', 'name' ) ) );
$js = <<<JS
var arr = {$tagsJson};
@ -39,7 +45,7 @@ JS;
<div class="box-header with-border"><?= Yii::t('post', 'Common') ?></div>
<div class="box-body">
<?= $form->field($model, 'category_id')->dropDownList($model->categoriesList($model->type_id), ['prompt' => '']) ?>
<?= $form->field($model, 'published_at')->widget(\kartik\widgets\DateTimePicker::classname(), [
<?= $form->field($model, 'published_at')->widget(DateTimePicker::class, [
'options' => [],
'pluginOptions' => [
'autoclose' => true,
@ -53,7 +59,7 @@ JS;
<div class="box box-default">
<div class="box-header with-border"><?= Yii::t('post', 'Tags') ?></div>
<div class="box-body">
<?= $form->field($model->tags, 'new_tags')->widget(\kartik\widgets\Select2::classname(), [
<?= $form->field($model->tags, 'new_tags')->widget(Select2::class, [
'options' => [
'placeholder' => Yii::t('post','Set tags...'),
'multiple' => true,
@ -82,7 +88,7 @@ JS;
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'description')->textarea(['rows' => 5]) ?>
<?= $form->field($model, 'content')->widget(CKEditor::className()) ?>
<?= $form->field($model, 'content')->widget(CKEditor::class) ?>
</div>
</div>

7
backend/views/post/news/create.php

@ -1,8 +1,11 @@
<?php
use core\entities\post\PostType;
use core\forms\post\PostForm;
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostForm */
/* @var $type \core\entities\post\PostType */
/* @var $model PostForm */
/* @var $type PostType */
$title = Yii::t('post', 'Create Post');
$this->title = $type->plural . ' > ' . $title;

12
backend/views/post/news/index.php

@ -1,14 +1,18 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostType;
use core\forms\post\search\PostSearch;
use core\helpers\PostHelper;
use yii\grid\ActionColumn;
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel \core\forms\post\search\PostSearch */
/* @var $searchModel PostSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $type \core\entities\post\PostType */
/* @var $type PostType */
$title = Yii::t('post', 'All Posts');
$this->title = $type->plural .' > '. $title;
@ -67,11 +71,11 @@ $this->params['breadcrumbs'][] = $title;
'contentOptions' => ['class' => 'text-center'],
],
[
'class' => \yii\grid\ActionColumn::class,
'class' => ActionColumn::class,
'urlCreator' => function($action, Post $model, $key, $index, $column) {
$params = is_array($key) ? $key : ['id' => (string) $key, 'tid' => $model->type_id];
$params[0] = $column->controller ? $column->controller . '/' . $action : $action;
return \yii\helpers\Url::toRoute($params);
return Url::toRoute($params);
},
'options' => ['style' => 'width: 100px;'],
'contentOptions' => ['class' => 'text-center'],

13
backend/views/post/news/update.php

@ -1,11 +1,16 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostType;
use core\forms\post\PostForm;
use yii\helpers\StringHelper;
/* @var $this yii\web\View */
/* @var $post \core\entities\post\Post */
/* @var $model \core\forms\post\PostForm */
/* @var $type \core\entities\post\PostType */
/* @var $post Post */
/* @var $model PostForm */
/* @var $type PostType */
$title = Yii::t('post', 'Update Post: {name}', ['name' => \yii\helpers\StringHelper::truncateWords($post->title, 6, '...')]);
$title = Yii::t('post', 'Update Post: {name}', ['name' => StringHelper::truncateWords($post->title, 6, '...')]);
$this->title = $type->plural . ' > ' . $title;
$this->params['breadcrumbs'][] = ['label' => Yii::t('post', $type->plural), 'url' => ['index', 'tid' => $type->id]];
$this->params['breadcrumbs'][] = ['label' => $type->singular, 'url' => ['view', 'id' => $post->id]];

6
backend/views/post/news/view.php

@ -1,14 +1,16 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostType;
use core\helpers\PostHelper;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $post \core\entities\post\Post */
/* @var $post Post */
/* @var $modificationsProvider yii\data\ActiveDataProvider */
/* @var $type \core\entities\post\PostType */
/* @var $type PostType */
$title = $post->title;
$this->title = $type->plural . ' > ' . $title;

18
backend/views/post/post/_form.php

@ -1,19 +1,25 @@
<?php
use core\forms\post\PostForm;
use kartik\file\FileInput;
use kartik\widgets\DateTimePicker;
use kartik\widgets\Select2;
use mihaildev\ckeditor\CKEditor;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\Json;
use yii\helpers\Url;
use yii\web\JsExpression;
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostForm */
/* @var $model PostForm */
/* @var $form yii\widgets\ActiveForm */
$fetchUrl = \yii\helpers\Url::to( [ 'tag-search' ] );
$fetchUrl = Url::to( [ 'tag-search' ] );
if (isset($model->_post)) {
$tagsJson = \yii\helpers\Json::encode( \yii\helpers\Json::encode( \yii\helpers\ArrayHelper::map( $model->_post->tags, 'id', 'name' ) ) );
$tagsJson = Json::encode( Json::encode( ArrayHelper::map( $model->_post->tags, 'id', 'name' ) ) );
$js = <<<JS
var arr = {$tagsJson};
@ -38,7 +44,7 @@ JS;
<div class="box-header with-border"><?= Yii::t('post', 'Common') ?></div>
<div class="box-body">
<?= $form->field($model, 'category_id')->dropDownList($model->categoriesList($model->type_id), ['prompt' => '']) ?>
<?= $form->field($model, 'published_at')->widget(\kartik\widgets\DateTimePicker::classname(), [
<?= $form->field($model, 'published_at')->widget(DateTimePicker::class, [
'options' => [],
'pluginOptions' => [
'autoclose' => true,
@ -52,7 +58,7 @@ JS;
<div class="box box-default">
<div class="box-header with-border"><?= Yii::t('post', 'Tags') ?></div>
<div class="box-body">
<?= $form->field($model->tags, 'new_tags')->widget(\kartik\widgets\Select2::classname(), [
<?= $form->field($model->tags, 'new_tags')->widget(Select2::class, [
'options' => [
'placeholder' => Yii::t('post','Set tags...'),
'multiple' => true,
@ -81,7 +87,7 @@ JS;
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'description')->textarea(['rows' => 5]) ?>
<?= $form->field($model, 'content')->widget(CKEditor::className()) ?>
<?= $form->field($model, 'content')->widget(CKEditor::class) ?>
</div>
</div>

7
backend/views/post/post/create.php

@ -1,8 +1,11 @@
<?php
use core\entities\post\PostType;
use core\forms\post\PostForm;
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostForm */
/* @var $type \core\entities\post\PostType */
/* @var $model PostForm */
/* @var $type PostType */
$title = Yii::t('post', 'Create Post');
$this->title = $type->plural . ' > ' . $title;

12
backend/views/post/post/index.php

@ -1,14 +1,18 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostType;
use core\forms\post\search\PostSearch;
use core\helpers\PostHelper;
use yii\grid\ActionColumn;
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel \core\forms\post\search\PostSearch */
/* @var $searchModel PostSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $type \core\entities\post\PostType */
/* @var $type PostType */
$title = Yii::t('post', 'All Posts');
$this->title = $type->plural .' > '. $title;
@ -67,11 +71,11 @@ $this->params['breadcrumbs'][] = $title;
'contentOptions' => ['class' => 'text-center'],
],
[
'class' => \yii\grid\ActionColumn::class,
'class' => ActionColumn::class,
'urlCreator' => function($action, Post $model, $key, $index, $column) {
$params = is_array($key) ? $key : ['id' => (string) $key, 'tid' => $model->type_id];
$params[0] = $column->controller ? $column->controller . '/' . $action : $action;
return \yii\helpers\Url::toRoute($params);
return Url::toRoute($params);
},
'options' => ['style' => 'width: 100px;'],
'contentOptions' => ['class' => 'text-center'],

13
backend/views/post/post/update.php

@ -1,11 +1,16 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostType;
use core\forms\post\PostForm;
use yii\helpers\StringHelper;
/* @var $this yii\web\View */
/* @var $post \core\entities\post\Post */
/* @var $model \core\forms\post\PostForm */
/* @var $type \core\entities\post\PostType */
/* @var $post Post */
/* @var $model PostForm */
/* @var $type PostType */
$title = Yii::t('post', 'Update Post: {name}', ['name' => \yii\helpers\StringHelper::truncateWords($post->title, 6, '...')]);
$title = Yii::t('post', 'Update Post: {name}', ['name' => StringHelper::truncateWords($post->title, 6, '...')]);
$this->title = $type->plural . ' > ' . $title;
$this->params['breadcrumbs'][] = ['label' => Yii::t('post', $type->plural), 'url' => ['index', 'tid' => $type->id]];
$this->params['breadcrumbs'][] = ['label' => $type->singular, 'url' => ['view', 'id' => $post->id]];

6
backend/views/post/post/view.php

@ -1,14 +1,16 @@
<?php
use core\entities\post\Post;
use core\entities\post\PostType;
use core\helpers\PostHelper;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $post \core\entities\post\Post */
/* @var $post Post */
/* @var $modificationsProvider yii\data\ActiveDataProvider */
/* @var $type \core\entities\post\PostType */
/* @var $type PostType */
$title = $post->title;
$this->title = $type->plural . ' > ' . $title;

3
backend/views/post/tag/_form.php

@ -1,10 +1,11 @@
<?php
use core\forms\post\PostTagSingleForm;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostTagSingleForm */
/* @var $model PostTagSingleForm */
/* @var $form yii\widgets\ActiveForm */
?>

7
backend/views/post/tag/create.php

@ -1,8 +1,11 @@
<?php
use core\entities\post\PostType;
use core\forms\post\PostTagSingleForm;
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostTagSingleForm */
/* @var $type \core\entities\post\PostType */
/* @var $model PostTagSingleForm */
/* @var $type PostType */
$title = Yii::t('post', 'Create Tag');
$this->title = $type->plural . ' > ' . $title;

6
backend/views/post/tag/index.php

@ -1,14 +1,16 @@
<?php
use core\entities\post\PostTag;
use core\entities\post\PostType;
use core\forms\post\search\PostTagSearch;
use yii\grid\ActionColumn;
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel \core\forms\post\search\PostTagSearch */
/* @var $searchModel PostTagSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $type \core\entities\post\PostType */
/* @var $type PostType */
$title = Yii::t('post', 'Tags');
$this->title = $type->plural . ' > ' . $title;

10
backend/views/post/tag/update.php

@ -1,9 +1,13 @@
<?php
use core\entities\post\PostTag;
use core\entities\post\PostType;
use core\forms\post\PostTagSingleForm;
/* @var $this yii\web\View */
/* @var $tag \core\entities\post\PostTag */
/* @var $model \core\forms\post\PostTagSingleForm */
/* @var $type \core\entities\post\PostType */
/* @var $tag PostTag */
/* @var $model PostTagSingleForm */
/* @var $type PostType */
$title = Yii::t('post', 'Update Tag: {name}', ['name' => $tag->name]);
$this->title = $type->plural . ' > ' . $title;

6
backend/views/post/tag/view.php

@ -1,11 +1,13 @@
<?php
use core\entities\post\PostTag;
use core\entities\post\PostType;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $tag \core\entities\post\PostTag */
/* @var $type \core\entities\post\PostType */
/* @var $tag PostTag */
/* @var $type PostType */
$title = $tag->name;
$this->title = $type->plural . ' > ' . $title;

3
backend/views/post/type/_form.php

@ -1,10 +1,11 @@
<?php
use core\forms\post\PostTypeForm;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostTypeForm */
/* @var $model PostTypeForm */
/* @var $form yii\widgets\ActiveForm */
?>

4
backend/views/post/type/create.php

@ -1,7 +1,9 @@
<?php
use core\forms\post\PostTypeForm;
/* @var $this yii\web\View */
/* @var $model \core\forms\post\PostTypeForm */
/* @var $model PostTypeForm */
$this->title = Yii::t('post', 'Create Type');
$this->params['breadcrumbs'][] = ['label' => Yii::t('post', 'Types'), 'url' => ['index']];

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save