public function actionDate() { $date = \yii::$app->request->post('date'); list($from, $to) = explode(',', $date); $redirectUrl = \yii::$app->request->post('redirectUrl'); Module::setCommonSession(DEFAULT_ID_SITE, $from, $to); $this->redirect($redirectUrl); }
/** * Creates a new Avatar model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Avatar(); if ($model->load(Yii::$app->request->post())) { $model->img = UploadedFile::getInstance($model, 'img'); if ($model->validate()) { if ($model->img) { $imgSrc = $this->module->avatarLoadDirectory . date('Ymdhis') . rand(1000, 9999) . '.' . $model->img->extension; $model->img->saveAs(Yii::getAlias('@app/web') . $imgSrc); $model->img = $imgSrc; } $model->save(); Yii::$app->session->setFlash('success', Module::t('app', 'AVATAR_FLASH_ADD_TRUE')); return $this->redirect(['view', 'id' => $model->id]); } else { Yii::$app->session->setFlash('error', Module::t('app', 'AVATAR_FLASH_ADD_FALSE')); return $this->render('create', ['model' => $model]); } } else { return $this->render('create', ['model' => $model]); } }
<?php use yii\helpers\Html; use yii\widgets\DetailView; use app\modules\admin\Module; use yii\bootstrap\Tabs; use yii\helpers\StringHelper; use app\modules\admin\components\widgets\AdminBoxWidget; /* @var $this yii\web\View */ /* @var $model app\modules\main\models\Article */ $this->title = StringHelper::truncate($model->title, 50); $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'ADMIN'), 'url' => ['default/index']]; $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'ADMIN_ARTICLE'), 'url' => ['index']]; $this->params['breadcrumbs'][] = StringHelper::truncate($model->title, 20); ?> <div class="article-view"> <?php AdminBoxWidget::begin(['type' => AdminBoxWidget::TYPE_PRIMARY, 'title' => Html::a('<i class="fa fa-pencil-square-o"></i>' . ' ' . Module::t('app', 'BUTTON_UPDATE'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary btn-xs']) . ' ' . Html::a('<i class="fa fa-trash-o"></i>' . ' ' . Module::t('app', 'BUTTON_DELETE'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger btn-xs', 'data' => ['confirm' => Module::t('app', 'CONFIRM_DELETE'), 'method' => 'post']]), 'left_tools' => 'Количество просмотров статьи: <strong>' . $model->click . '</strong>', 'footer' => '<strong>Статья созана:</strong> ' . Yii::$app->formatter->asDatetime($model->created_at) . '<br/>' . '<strong>Статья обновлена:</strong> ' . Yii::$app->formatter->asDatetime($model->updated_at) . '<br/>' . '<i class="fa fa-link"></i> <code>' . Yii::$app->urlManager->createAbsoluteUrl(['main/default/view', 'alt_title' => $model->alt_title]) . '</code>']); ?> <?php echo Tabs::widget(['items' => [['label' => 'Основная информация', 'content' => DetailView::widget(['model' => $model, 'attributes' => [['attribute' => 'category_id', 'format' => 'html', 'value' => Html::a($model->category->title, ['category/view', 'id' => $model->category->id], ['target' => 'blank'])], 'title', ['attribute' => 'alt_title', 'format' => 'html', 'value' => Html::decode('<strong>' . $model->alt_title . '</strong>') . '<br/>' . $model->getArticleUrl()], ['attribute' => 'author_id', 'format' => 'html', 'value' => Html::a($model->author->username, ['user/view', 'id' => $model->author->id], ['target' => 'blank'])], ['attribute' => 'status', 'format' => 'html', 'value' => $model->getArticleStatusSwitch()], 'tags', ['attribute' => 'anons_img', 'format' => 'html', 'value' => Html::img(Yii::$app->request->baseUrl . $model->anons_img, ['class' => 'img-responsive'])], 'anons:ntext', 'post:ntext']]), 'active' => true], ['label' => 'Рендер статьи', 'content' => $this->render('_article', ['model' => $model])]]]); ?> <?php AdminBoxWidget::end(); ?> </div>
<?php use yii\helpers\Html; use app\modules\admin\Module; /* @var $this yii\web\View */ /* @var $model app\modules\admin\models\User */ $this->title = $model->username; $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN'), 'url' => ['default/index']]; $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN_USERS'), 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->username, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = Module::t('module', 'TITLE_UPDATE'); ?> <div class="user-update"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_form', ['model' => $model]); ?> </div>
<?php use yii\helpers\Html; use app\modules\admin\Module; /* @var $this yii\web\View */ /* @var $model app\modules\admin\models\Activity */ $this->title = $model->name; $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'ADMIN'), 'url' => ['default/index']]; $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'ADMIN_ACTIVITY'), 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = Module::t('app', 'ACTIVITY_TITLE_UPDATE'); ?> <div class="activity-update"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_form', ['model' => $model]); ?> </div>
/** * Updates an existing Article model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $category = Category::find()->all(); $oldAnonsImg = $model->anons_img; if ($model->load(Yii::$app->request->post())) { $model->anons_img = UploadedFile::getInstance($model, 'anons_img'); if ($model->validate()) { if ($model->anons_img) { $anonsImgName = $this->module->articleAnonsImgForbes . date('Ymdhis') . rand(1000, 9999) . '.' . $model->anons_img->extension; $model->anons_img->saveAs(Yii::getAlias('@app/web') . $anonsImgName); $model->anons_img = $anonsImgName; } else { $model->anons_img = $oldAnonsImg; } $model->author_id = Yii::$app->user->identity->getId(); $model->save(); Yii::$app->session->setFlash('success', Module::t('app', 'ARTICLE_FLASH_UPDATE_TRUE')); return $this->redirect(['view', 'id' => $model->id]); } else { Yii::$app->session->setFlash('error', Module::t('app', 'ARTICLE_FLASH_UPDATE_FALSE')); return $this->render('update', ['model' => $model, 'category' => $category]); } } else { return $this->render('update', ['model' => $model, 'category' => $category]); } /* * if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { } */ }
<strong>Внимание!</strong> Переде добавлением туда нового материала - обязательно связатся со мной для уточнений) </li> <li><span class="label label-success">Новый функционал</span> В статьи добавилась возможность редактирования URL-адреса (да, теперь можно менять его самому) - правила там указанны!</li> <li><span class="label label-warning">Найден баг</span> Решена проблема невозможности создания статей (как на z34lot.ru, так и на localhost)</li> <li><span class="label label-default">В реализации</span> В процессе переделки: /admin/user - управление пользователями(просмотр, активация, бан, разбан)</li> </ul> </div> </div> </div> <div class="col-md-6"> <div class="panel panel-default"> <div class="panel-heading"><strong><?php echo Module::t('app', 'ADMIN_USER_LOG'); ?> </strong></div> <div class="panel-body"> <?php echo GridView::widget(['dataProvider' => $model, 'summary' => false, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'user_id', 'format' => 'html', 'value' => function ($data) { return Html::a($data->user->username, ['/admin/user/view', 'id' => $data->user->id]); }], 'action', 'date:datetime']]); ?> </div> </div> </div>
public function createMenuItem($item) { return ['label' => Module::t($this->category, Html::encode($item['title'])), 'url' => isset($item['route']) ? $item['route'] : false, 'icon' => isset($item['icon']) ? $item['icon'] : false]; }
echo $form->field($model, 'username')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'email')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'newPassword')->passwordInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'newPasswordRepeat')->passwordInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'status')->dropDownList(User::getStatusesArray()); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Module::t('module', 'BUTTON_CREATE') : Module::t('module', 'BUTTON_SAVE'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary', 'name' => 'submit-button']); ?> </div> <?php ActiveForm::end(); ?> </div>
<?php use app\modules\admin\Module; use app\themes\admin\Theme; use app\themes\admin\widgets\Box; use yii\helpers\Url; use yii\web\View; /** * @var View $this * @var $modules array */ $this->title = Theme::t('title', 'Admin'); $this->params['subtitle'] = Theme::t('title', 'Site Preview'); $this->params['breadcrumbs'] = [$this->title]; $site = Module::siteUrl(); $js = <<<JS jQuery(function(\$) { var iframe = \$('iframe#sitepreview'); iframe.load(function () { var ifcontent = iframe.contents(); console.log('ifheight', iframe[0].contentWindow); iframe.height(ifcontent.height()); }); }); JS; $this->registerJs($js); ?> <div class="row"><div class="col-xs-12"> <?php Box::begin(['title' => $this->params['subtitle'], 'bodyOptions' => ['class' => 'no-padding']]);
<?php use yii\helpers\Html; use yii\grid\GridView; use app\modules\admin\Module; use app\modules\admin\components\widgets\AdminBoxWidget; use app\modules\admin\components\grid\LinkColumn; /* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Module::t('app', 'ADMIN_CATEGORY_MAIN'); $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'ADMIN'), 'url' => ['/admin/default/index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="admin-category-index"> <?php AdminBoxWidget::begin(['type' => AdminBoxWidget::TYPE_INFO, 'solid' => false, 'title' => Html::a('<i class="fa fa-plus-circle"></i>' . ' ' . Module::t('app', 'ADMIN_CATEGORY_ADD'), ['create'], ['class' => 'btn btn-success btn-xs', 'title' => Module::t('app', 'ADMIN_CATEGORY_ADD')])]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'summary' => false, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['class' => LinkColumn::className(), 'attribute' => 'title'], 'created_at:datetime']]); ?> <?php AdminBoxWidget::end(); ?> </div>
?> </title> <?php $this->head(); ?> </head> <body> <?php $this->beginBody(); ?> <div class="wrap"> <?php NavBar::begin(['brandLabel' => Yii::$app->name, 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]); Admin::getCountMessages() ? $menuItems[] = ['label' => '<i class="glyphicon glyphicon-envelope"></i> ' . Module::t('module', 'ADMIN_NAV_MENU_MESSAGES_{msg}', ['msg' => Admin::getCountMessages()]), 'url' => ['/admin/blog/comment/index']] : false; Admin::getCountCommentPending() ? $menuItems[] = ['label' => '<i class="glyphicon glyphicon-comment"></i> ' . Module::t('module', 'ADMIN_NAV_MENU_COMMENTARIES_{comment}', ['comment' => Admin::getCountCommentPending()]), 'url' => ['/admin/blog/comment/index']] : false; Yii::$app->user->can(User::ROLE_USER) ? $menuItems[] = ['label' => Yii::t('app', 'HELLO{username}', ['username' => Yii::$app->user->identity->profile->name ? Yii::$app->user->identity->profile->name . ' ' . Yii::$app->user->identity->profile->surname : Yii::$app->user->identity->username]), 'items' => [['label' => '<i class="glyphicon glyphicon-dashboard"></i> ' . Yii::t('app', 'MENU_ADMIN'), 'url' => ['/admin/default/index'], 'visible' => Yii::$app->user->can(User::ROLE_MODER)], ['label' => '<i class="glyphicon glyphicon-user"></i> ' . Yii::t('app', 'MENU_PROFILE'), 'url' => ['/user/profile/index']], '<li class="divider"></li>', ['label' => '<i class="glyphicon glyphicon-log-out"></i> ' . Yii::t('app', 'MENU_LOGOUT'), 'url' => ['/user/default/logout'], 'linkOptions' => ['data-method' => 'post']]]] : false; echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'encodeLabels' => false, 'items' => array_filter($menuItems)]); NavBar::end(); ?> <div class="container"> <?php echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]); ?> <?php echo Alert::widget(); ?> <?php echo $content; ?>
/** * @inheritdoc */ public function attributeLabels() { return ['id' => 'ID', 'user_id' => Module::t('app', 'ADMIN_USERLOG_L_USERID'), 'action' => Module::t('app', 'ADMIN_USERLOG_L_ACTION'), 'date' => Module::t('app', 'ADMIN_USERLOG_L_DATE')]; }
<?php use yii\helpers\Html; use app\modules\admin\models\User; use app\modules\admin\Module; /* @var $this yii\web\View */ /* @var $model \app\modules\admin\modules\user\models\User */ $this->title = Module::t('module', 'ADMIN'); ?> <div class="admin-default-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Yii::$app->user->can(User::ROLE_ADMIN) ? Html::a(Module::t('module', 'ADMIN_USERS'), ['users/default/index'], ['class' => 'btn btn-primary']) : ''; ?> </p> </div>
<?php use yii\helpers\Html; use yii\grid\GridView; use app\modules\admin\components\grid\SetColumn; use app\modules\admin\components\grid\LinkColumn; use app\modules\admin\Module; use app\modules\user\models\User; /* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Module::t('app', 'ADMIN_USER'); $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'ADMIN'), 'url' => ['default/index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="user-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['id', ['class' => LinkColumn::className(), 'attribute' => 'username'], 'email:email', ['attribute' => 'status', 'class' => SetColumn::className(), 'name' => 'UserStatusName', 'cssCLasses' => [User::STATUS_ACTIVE => 'success', User::STATUS_BLOCKED => 'danger', User::STATUS_WAIT => 'warning']], 'created_at:datetime']]); ?> </div>
<?php /** * Backend main page view. * * @var yii\base\View $this View */ use app\modules\admin\Module; $this->title = Module::t('admin', 'Admin Panel'); $this->params['subtitle'] = Module::t('admin', 'Dashboard');
<?php use yii\helpers\Html; use app\modules\admin\Module; /* @var $this yii\web\View */ /* @var $model \app\modules\admin\models\User */ $this->title = Module::t('module', 'ADMIN'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="admin-default-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Module::t('module', 'ADMIN_USERS'), ['users/index'], ['class' => 'btn btn-primary']); ?> </p> </div>
/* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Module::t('app', 'ADMIN_ACTIVITY'); $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'ADMIN'), 'url' => ['default/index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="activity-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <p class="alert alert-info"> <?php echo Module::t('app', 'ACTIVITY_HELP'); ?> </p> <p> <?php echo Html::a(Module::t('app', 'ADMIN_ACTIVITY_ADD'), ['create'], ['class' => 'btn btn-success btn-xs']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['id', ['class' => LinkColumn::className(), 'attribute' => 'name'], 'module', 'created_at:datetime']]); ?> </div>
<?php use app\modules\admin\Module; use app\modules\user\Module as UserModule; use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model \app\modules\user\models\backend\User */ $this->title = Module::t('module', 'ADMIN'); ?> <div class="admin-default-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(UserModule::t('module', 'ADMIN_USERS'), ['user/default/index'], ['class' => 'btn btn-primary']); ?> </p> </div>
<?php /* @var $this \yii\web\View */ /* @var $model app\modules\user\models\Profile */ use app\modules\admin\Module; use app\modules\admin\components\widgets\AdminMenu; $menu = []; $menu = [['label' => Module::t('app', 'NAV_ADMIN_CATEGORY'), 'icon' => 'fa fa-book', 'url' => ['/admin/category/index']], ['label' => Module::t('app', 'NAV_ADMIN_ARTICLES'), 'icon' => 'fa fa-file-text-o', 'url' => ['/admin/article/index']], ['label' => Module::t('app', 'NAV_ADMIN_AVATAR') . ' <span class="label label-info">rebuild</span>', 'icon' => 'fa fa-camera', 'url' => ['/admin/avatar/index']], ['label' => Module::t('app', 'NAV_ADMIN_ACTIVITY') . ' <span class="label label-info">rebuild</span>', 'url' => ['/admin/activity/index']], ['label' => Module::t('app', 'NAV_ADMIN_USER'), 'icon' => 'fa fa-users', 'url' => ['/admin/user/index']], ['label' => Module::t('app', 'NAV_ADMIN_COMMENT') . ' <span class="label label-info">rebuild</span>', 'url' => ['/admin/comment/index']], ['label' => 'ADMIN WIDGETS', 'icon' => 'fa fa-file-code-o', 'url' => ['/admin/default/test']]]; ?> <aside class="main-sidebar"> <section class="sidebar"> <div class="user-panel"> <div class="pull-left image"><?php echo $model->getAvatarImg(); ?> </div> <div class="pull-left info"> <p><?php echo $model->name; ?> </p> </div> </div> <?php echo AdminMenu::widget(['options' => ['class' => 'sidebar-menu'], 'encodeLabels' => false, 'items' => $menu]); ?> </section>
use yii\helpers\Html; use yii\widgets\ActiveForm; use app\modules\admin\Module; /* @var $this yii\web\View */ /* @var $model app\modules\main\models\Category */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="category-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => true]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Module::t('app', 'BUTTON_CREATE') : Module::t('app', 'BUTTON_UPDATE'), ['class' => $model->isNewRecord ? 'btn btn-success btn-flat' : 'btn btn-primary btn-flat']); ?> </div> <?php ActiveForm::end(); ?> </div>
<?php use app\models\ModuleDefinition; use app\modules\admin\Module; return ['id' => 'admin', 'class' => Module::className(), 'config' => [], 'name' => Module::t('info', 'Administration'), 'description' => Module::t('info', 'Administration Panel Module'), 'package' => ModuleDefinition::PACKAGE_CORE, 'category' => Module::TRANSLATE_CATEGORY, 'required' => true, 'version' => '1.0', 'configure' => ['/admin/system/settings'], 'menu' => ['admin.index' => ['title' => Module::t('info', 'Administration'), 'weight' => 10, 'icon' => 'fa-cog'], 'admin.dashboard' => ['title' => Module::t('info', 'Dashboard'), 'route' => ['/admin/default/index'], 'parent' => 'admin.index'], 'admin.modules' => ['title' => Module::t('info', 'Modules'), 'route' => ['/admin/modules/index'], 'parent' => 'admin.index'], 'admin.preview' => ['title' => Module::t('info', 'Preview'), 'route' => ['/admin/default/preview'], 'parent' => 'admin.index']]];
<?php use yii\helpers\Html; use yii\widgets\DetailView; use app\modules\admin\Module; use app\modules\admin\components\widgets\AdminBoxWidget; use app\modules\admin\components\widgets\AdminInfoBox; /* @var $this yii\web\View */ /* @var $model app\modules\main\models\Category */ $this->title = Module::t('app', 'ADMIN_CATEGORY_VIEW') . ': ' . $model->title; $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'ADMIN'), 'url' => ['default/index']]; $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'ADMIN_CATEGORY_MAIN'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $model->title; ?> <div class="admin-category-view"> <?php AdminBoxWidget::begin(['type' => AdminBoxWidget::TYPE_PRIMARY, 'title' => Html::a('<i class="fa fa-pencil-square-o"></i>' . ' ' . Module::t('app', 'BUTTON_UPDATE'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary btn-xs']), 'footer' => Html::a('<i class="fa fa-trash-o"></i>' . ' ' . Module::t('app', 'BUTTON_DELETE'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger btn-xs', 'data' => ['confirm' => Module::t('app', 'CONFIRM_DELETE'), 'method' => 'post']]), 'left_tools' => Module::t('app', 'ADMIN_CATEGORY_ARTICLES_COUNT') . ' <strong>' . $model->getArticlesCount() . '</strong>']); ?> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'title', 'created_at:datetime', 'updated_at:datetime']]); ?> <?php AdminBoxWidget::end(); ?> </div>
use app\components\widgets\Alert; use app\modules\admin\Module; use yii\helpers\ArrayHelper; use yii\bootstrap\Nav; use yii\bootstrap\NavBar; use yii\widgets\Breadcrumbs; /* @var $this \yii\web\View */ /* @var $content string */ /** @var \yii\web\Controller $context */ $context = $this->context; if (isset($this->params['breadcrumbs'])) { $panelBreadcrumbs = [['label' => Module::t('module', 'ADMIN'), 'url' => ['/admin/default/index']]]; $breadcrumbs = $this->params['breadcrumbs']; } else { $panelBreadcrumbs = [Module::t('module', 'ADMIN')]; $breadcrumbs = []; } $this->beginContent('@app/views/layouts/layout.php'); ?> <?php NavBar::begin(['brandLabel' => Yii::$app->name, 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]); echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'activateParents' => true, 'items' => array_filter([['label' => Yii::t('app', 'NAV_ADMIN'), 'url' => ['/admin/default/index']], ['label' => Yii::t('app', 'NAV_ADMIN_USERS'), 'url' => ['/admin/users/default/index'], 'active' => $context->module->id == 'users'], ['label' => Yii::t('app', 'NAV_LOGOUT'), 'url' => ['/user/default/logout'], 'linkOptions' => ['data-method' => 'post']]])]); NavBar::end(); ?> <div class="container"> <?php echo Breadcrumbs::widget(['links' => ArrayHelper::merge($panelBreadcrumbs, $breadcrumbs)]); ?>
use app\modules\admin\Module; use app\components\grid\SetColumn; use kartik\date\DatePicker; use yii\helpers\Html; use yii\grid\GridView; /* @var $this yii\web\View */ /* @var $searchModel \app\modules\admin\models\search\UserSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Module::t('module', 'ADMIN_USERS'); $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN'), 'url' => ['default/index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="users-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Module::t('module', 'ADMIN_USERS_ADD'), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', ['filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'date_from', 'attribute2' => 'date_to', 'type' => DatePicker::TYPE_RANGE, 'separator' => '-', 'pluginOptions' => ['format' => 'yyyy-mm-dd']]), 'attribute' => 'created_at', 'format' => 'datetime', 'filterOptions' => ['style' => 'max-width: 180px']], ['class' => LinkColumn::className(), 'attribute' => 'username'], 'email:email', ['class' => SetColumn::className(), 'filter' => User::getStatusesArray(), 'attribute' => 'status', 'name' => 'statusName', 'cssCLasses' => [User::STATUS_ACTIVE => 'success', User::STATUS_WAIT => 'warning', User::STATUS_BLOCKED => 'default']], ['class' => ActionColumn::className()]]]); ?> </div>
use yii\widgets\DetailView; use app\modules\admin\Module; /* @var $this yii\web\View */ /* @var $model app\modules\admin\models\User */ $this->title = $model->username; $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN'), 'url' => ['default/index']]; $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN_USERS'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="user-view"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Module::t('module', 'BUTTON_UPDATE'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Module::t('module', 'BUTTON_DELETE'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Module::t('module', 'CONFIRM_DELETE'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'username', 'email:email', 'created_at:datetime', 'updated_at:datetime', ['attribute' => 'status', 'value' => $model->getStatusName()]]]); ?> </div>
public function attributeLabels() { return ['id' => 'ID', 'created_at' => UserModule::t('module', 'USER_CREATED'), 'updated_at' => UserModule::t('module', 'USER_UPDATED'), 'username' => UserModule::t('module', 'USER_USERNAME'), 'email' => UserModule::t('module', 'USER_EMAIL'), 'status' => UserModule::t('module', 'USER_STATUS'), 'role' => UserModule::t('module', 'USER_ROLE'), 'date_from' => Module::t('module', 'USER_DATE_FROM'), 'date_to' => Module::t('module', 'USER_DATE_TO')]; }
<?php use app\modules\admin\Module; $managePermissions = ['viewAdminPanel' => Module::t('rules', 'View Admin Panel')]; foreach (Yii::$app->modules as $id => $module) { $managePermissions['admin' . ucfirst($id) . 'Module'] = Module::t('rules', 'Manage ' . ucfirst($id) . ' Module'); } return ['permissions' => $managePermissions, 'roles' => ['adminManager' => Module::t('rules', 'Admin Manager')], 'assignments' => ['adminManager' => array_keys($managePermissions)]];
<?php use yii\helpers\Html; use app\modules\admin\Module; use app\modules\admin\components\widgets\AdminBoxWidget; /* @var $this yii\web\View */ /* @var $model app\modules\main\models\Category */ $this->title = Module::t('app', 'CATEGORY_CREATE_TITLE'); $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'ADMIN'), 'url' => ['default/index']]; $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'ADMIN_CATEGORY_MAIN'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="category-create"> <?php AdminBoxWidget::begin(['type' => AdminBoxWidget::TYPE_DEFAULT]); ?> <?php echo $this->render('_form', ['model' => $model]); ?> <?php AdminBoxWidget::end(); ?> </div>
?> <?php AdminBoxWidget::end(); ?> <p> <?php if ($model->status == User::STATUS_BLOCKED) { ?> <strong><?php echo Module::t('app', 'BAN_REASON_MESSAGE'); ?> :</strong> <?php echo Html::encode($model->ban_reason); ?> <br/> <strong><?php echo Module::t('app', 'BAN_TO_TIME'); ?> :</strong> <?php echo Yii::$app->formatter->asDatetime($model->ban_time); ?> <?php } ?> </p> </div>