/** * @return \vova07\blogs\Module|null Module instance */ public function getModule() { if ($this->_module === null) { $this->_module = Module::getInstance(); } return $this->_module; }
<?php /** * Blog update view. * * @var yii\base\View $this View * @var vova07\blogs\models\backend\Blog $model Model * @var \vova07\themes\admin\widgets\Box $box Box widget instance * @var array $statusArray Statuses array */ use vova07\themes\admin\widgets\Box; use vova07\blogs\Module; $this->title = Module::t('blogs', 'BACKEND_UPDATE_TITLE'); $this->params['subtitle'] = Module::t('blogs', 'BACKEND_UPDATE_SUBTITLE'); $this->params['breadcrumbs'] = [['label' => $this->title, 'url' => ['index']], $this->params['subtitle']]; $boxButtons = ['{cancel}']; if (Yii::$app->user->can('BCreateBlogs')) { $boxButtons[] = '{create}'; } if (Yii::$app->user->can('BDeleteBlogs')) { $boxButtons[] = '{delete}'; } $boxButtons = !empty($boxButtons) ? implode(' ', $boxButtons) : null; ?> <div class="row"> <div class="col-sm-12"> <?php $box = Box::begin(['title' => $this->params['subtitle'], 'renderBody' => false, 'options' => ['class' => 'box-success'], 'bodyOptions' => ['class' => 'table-responsive'], 'buttonsTemplate' => $boxButtons]); echo $this->render('_form', ['model' => $model, 'statusArray' => $statusArray, 'box' => $box]); Box::end(); ?>
if ($model->preview_url) { ?> <?php echo Html::a(Html::img($model->urlAttribute('preview_url'), ['class' => 'img-responsive img-blog', 'width' => '100%', 'alt' => $model->title]), ['view', 'id' => $model->id, 'alias' => $model->alias]); } ?> <div class="blog-content"> <h3> <?php echo Html::a($model->title, ['view', 'id' => $model->id, 'alias' => $model->alias]); ?> </h3> <div class="entry-meta"> <span><i class="icon-calendar"></i> <?php echo $model->created; ?> </span> <span><i class="icon-eye-open"></i> <?php echo $model->views; ?> </span> </div> <?php echo $model->snippet; ?> <?php echo Html::a(Module::t('blogs', 'FRONTEND_INDEX_READ_MORE_BTN') . ' <i class="icon-angle-right"></i>', ['view', 'id' => $model->id, 'alias' => $model->alias], ['class' => 'btn btn-default']); ?> </div>
<?php /** * Roles list view. * * @var \yii\base\View $this View * @var \yii\data\ArrayDataProvider $provider Data provider */ use vova07\themes\admin\widgets\Box; use vova07\themes\admin\widgets\GridView; use vova07\blogs\Module; use yii\grid\ActionColumn; use yii\grid\CheckboxColumn; $this->title = Module::t('rbac', 'BACKEND_ROLES_INDEX_TITLE'); $this->params['subtitle'] = Module::t('rbac', 'BACKEND_ROLES_INDEX_SUBTITLE'); $this->params['breadcrumbs'] = [$this->title]; $gridId = 'roles-grid'; $gridConfig = ['id' => $gridId, 'dataProvider' => $provider, 'columns' => [['class' => CheckboxColumn::classname()], 'name', 'description', 'ruleName', 'data', 'createdAt:date', 'updatedAt:date']]; $boxButtons = $actions = []; $showActions = false; if (Yii::$app->user->can('BCreateRoles')) { $boxButtons[] = '{create}'; } if (Yii::$app->user->can('BUpdateRoles')) { $actions[] = '{update}'; $showActions = $showActions || true; } if (Yii::$app->user->can('BDeleteRoles')) { $boxButtons[] = '{batch-delete}'; $actions[] = '{delete}'; $showActions = $showActions || true;
<div class="col-sm-6"> <?php echo $form->field($model, 'ruleName')->widget(Widget::className(), ['options' => ['prompt' => Module::t('rbac', 'BACKEND_PERMISSIONS_RULE_NAME_PROMPT')], 'settings' => ['width' => '100%'], 'items' => $ruleArray]); ?> </div> </div> <div class="row"> <div class="col-sm-6"> <?php echo $form->field($model, 'description')->textarea()->label(Module::t('rbac', 'BACKEND_PERMISSIONS_ATTR_DESCRIPTION')); ?> </div> <div class="col-sm-6"> <?php echo $form->field($model, 'data')->textarea()->label(Module::t('rbac', 'BACKEND_PERMISSIONS_ATTR_DATA')); ?> </div> </div> <div class="row"> <div class="col-sm-12"> <?php echo $form->field($model, 'children')->widget(Widget::className(), ['options' => ['multiple' => true, 'placeholder' => Module::t('rbac', 'BACKEND_PERMISSIONS_CHILDREN_PROMPT')], 'settings' => ['width' => '100%'], 'items' => $permissionArray])->label(Module::t('rbac', 'BACKEND_PERMISSIONS_ATTR_CHILDREN')); ?> </div> </div> <?php $box->endBody(); $box->beginFooter(); echo Html::submitButton(!isset($update) ? Module::t('rbac', 'BACKEND_PERMISSIONS_CREATE_SUBMIT') : Module::t('rbac', 'BACKEND_PERMISSIONS_UPDATE_SUBMIT'), ['class' => !isset($update) ? 'btn btn-primary btn-large' : 'btn btn-success btn-large']); $box->endFooter(); ActiveForm::end();
<?php /** * Blog page view. * * @var \yii\web\View $this View * @var \vova07\blogs\models\frontend\Blog $model Model */ use vova07\base\helpers\System; use vova07\blogs\Module; use yii\helpers\Html; $this->title = $model['title']; $this->params['breadcrumbs'] = [['label' => Module::t('blogs', 'BACKEND_INDEX_TITLE'), 'url' => ['index']], $this->title]; ?> <div class="row"> <aside class="col-sm-4 col-sm-push-8"> <div class="widget ads"> <div class="row"> <div class="col-xs-6"> <img class="img-responsive img-rounded" src="<?php echo $this->assetManager->publish('@vova07/themes/site/images/ads/ad1.png')[1]; ?> " alt="Ads" /> </div> <div class="col-xs-6"> <img class="img-responsive img-rounded" src="<?php echo $this->assetManager->publish('@vova07/themes/site/images/ads/ad2.png')[1]; ?> " alt="Ads" /> </div>
<?php /** * Blog list page view. * * @var \yii\web\View $this View * @var \yii\data\ActiveDataProvider $dataProvider DataProvider */ use vova07\blogs\Module; use yii\widgets\ListView; $this->title = Module::t('blogs', 'FRONTEND_INDEX_TITLE'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="row"> <aside class="col-sm-4 col-sm-push-8"> <div class="widget ads"> <div class="row"> <div class="col-xs-6"> <img class="img-responsive img-rounded" src="<?php echo $this->assetManager->publish('@vova07/themes/site/images/ads/ad1.png')[1]; ?> " alt="Ads" /> </div> <div class="col-xs-6"> <img class="img-responsive img-rounded" src="<?php echo $this->assetManager->publish('@vova07/themes/site/images/ads/ad2.png')[1]; ?> " alt="Ads" /> </div>
<?php /** * Permission update view. * * @var \yii\base\View $this View * @var \yii\base\DynamicModel $model Model * @var \vova07\themes\admin\widgets\Box $box Box widget instance * @var array $permissionArray Permissions array * @var array $ruleArray Rules array */ use vova07\themes\admin\widgets\Box; use vova07\blogs\Module; $this->title = Module::t('rbac', 'BACKEND_PERMISSIONS_UPDATE_TITLE'); $this->params['subtitle'] = Module::t('rbac', 'BACKEND_PERMISSIONS_UPDATE_SUBTITLE'); $this->params['breadcrumbs'] = [['label' => $this->title, 'url' => ['index']], $this->params['subtitle']]; ?> <div class="row"> <div class="col-sm-12"> <?php $box = Box::begin(['title' => $this->params['subtitle'], 'renderBody' => false, 'options' => ['class' => 'box-success'], 'bodyOptions' => ['class' => 'table-responsive'], 'deleteParam' => 'name', 'buttonsTemplate' => '{create} {cancel} {delete}']); echo $this->render('_form', ['model' => $model, 'permissionArray' => $permissionArray, 'ruleArray' => $ruleArray, 'box' => $box, 'update' => true]); Box::end(); ?> </div> </div>
/** * @inheritdoc */ public function attributeLabels() { return ['id' => Module::t('blogs', 'ATTR_ID'), 'title' => Module::t('blogs', 'ATTR_TITLE'), 'alias' => Module::t('blogs', 'ATTR_ALIAS'), 'snippet' => Module::t('blogs', 'ATTR_SNIPPET'), 'content' => Module::t('blogs', 'ATTR_CONTENT'), 'views' => Module::t('blogs', 'ATTR_VIEWS'), 'status_id' => Module::t('blogs', 'ATTR_STATUS'), 'created_at' => Module::t('blogs', 'ATTR_CREATED'), 'updated_at' => Module::t('blogs', 'ATTR_UPDATED'), 'preview_url' => Module::t('blogs', 'ATTR_PREVIEW_URL'), 'image_url' => Module::t('blogs', 'ATTR_IMAGE_URL')]; }
<div class="col-sm-6"> <?php echo $form->field($model, 'preview_url')->widget(FileAPI::className(), ['settings' => ['url' => ['/blogs/default/fileapi-upload']]]); ?> </div> <div class="col-sm-6"> <?php echo $form->field($model, 'image_url')->widget(FileAPI::className(), ['settings' => ['url' => ['/blogs/default/fileapi-upload']]]); ?> </div> </div> <div class="row"> <div class="col-sm-12"> <?php echo $form->field($model, 'snippet')->widget(Imperavi::className(), ['settings' => ['minHeight' => 200, 'imageGetJson' => Url::to(['/blogs/default/imperavi-get']), 'imageUpload' => Url::to(['/blogs/default/imperavi-image-upload']), 'fileUpload' => Url::to(['/blogs/default/imperavi-file-upload'])]]); ?> </div> </div> <div class="row"> <div class="col-sm-12"> <?php echo $form->field($model, 'content')->widget(Imperavi::className(), ['settings' => ['minHeight' => 300, 'imageGetJson' => Url::to(['/blogs/default/imperavi-get']), 'imageUpload' => Url::to(['/blogs/default/imperavi-image-upload']), 'fileUpload' => Url::to(['/blogs/default/imperavi-file-upload'])]]); ?> </div> </div> <?php $box->endBody(); $box->beginFooter(); echo Html::submitButton($model->isNewRecord ? Module::t('blogs', 'BACKEND_CREATE_SUBMIT') : Module::t('blogs', 'BACKEND_UPDATE_SUBMIT'), ['class' => $model->isNewRecord ? 'btn btn-primary btn-large' : 'btn btn-success btn-large']); $box->endFooter(); ActiveForm::end();
<?php /** * Rule form view. * * @var \yii\base\View $this View * @var \yii\widgets\ActiveForm $form Form * @var \yii\base\Model $model Model * @var \vova07\themes\admin\widgets\Box $box Box widget instance */ use vova07\blogs\Module; use yii\helpers\Html; use yii\widgets\ActiveForm; $form = ActiveForm::begin(); $box->beginBody(); ?> <div class="row"> <div class="col-sm-12"> <?php echo $form->field($model, 'namespace'); ?> </div> </div> <?php $box->endBody(); $box->beginFooter(); echo Html::submitButton(Module::t('rbac', 'BACKEND_RULES_CREATE_SUBMIT'), ['class' => 'btn btn-primary btn-large']); $box->endFooter(); ActiveForm::end();
/** * @inheritdoc */ public function attributeLabels() { $attributeLabels = parent::attributeLabels(); $attributeLabels['createdAtJui'] = Module::t('blogs', 'ATTR_CREATED'); $attributeLabels['updatedAtJui'] = Module::t('blogs', 'ATTR_UPDATED'); return $attributeLabels; }
<?php /** * Rule create view. * * @var \yii\base\View $this View * @var \yii\base\Model $model Model * @var \vova07\themes\admin\widgets\Box $box Box widget instance */ use vova07\themes\admin\widgets\Box; use vova07\blogs\Module; $this->title = Module::t('rbac', 'BACKEND_RULES_CREATE_TITLE'); $this->params['subtitle'] = Module::t('rbac', 'BACKEND_RULES_CREATE_SUBTITLE'); $this->params['breadcrumbs'] = [['label' => $this->title, 'url' => ['index']], $this->params['subtitle']]; ?> <div class="row"> <div class="col-sm-12"> <?php $box = Box::begin(['title' => $this->params['subtitle'], 'renderBody' => false, 'options' => ['class' => 'box-primary'], 'bodyOptions' => ['class' => 'table-responsive'], 'buttonsTemplate' => '{cancel}']); echo $this->render('_form', ['model' => $model, 'box' => $box]); Box::end(); ?> </div> </div>
use vova07\themes\admin\widgets\GridView; use vova07\blogs\Module; use yii\grid\ActionColumn; use yii\grid\CheckboxColumn; use yii\helpers\Html; use yii\jui\DatePicker; $this->title = Module::t('blogs', 'BACKEND_INDEX_TITLE'); $this->params['subtitle'] = Module::t('blogs', 'BACKEND_INDEX_SUBTITLE'); $this->params['breadcrumbs'] = [$this->title]; $gridId = 'blogs-grid'; $gridConfig = ['id' => $gridId, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::classname()], 'id', ['attribute' => 'title', 'format' => 'html', 'value' => function ($model) { return Html::a($model['title'], ['update', 'id' => $model['id']]); }], 'views', ['attribute' => 'status_id', 'format' => 'html', 'value' => function ($model) { $class = $model->status_id === $model::STATUS_PUBLISHED ? 'label-success' : 'label-danger'; return '<span class="label ' . $class . '">' . $model->status . '</span>'; }, 'filter' => Html::activeDropDownList($searchModel, 'status_id', $statusArray, ['class' => 'form-control', 'prompt' => Module::t('blogs', 'BACKEND_PROMPT_STATUS')])], ['attribute' => 'created_at', 'format' => 'date', 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'created_at', 'options' => ['class' => 'form-control'], 'clientOptions' => ['dateFormat' => 'dd.mm.yy']])], ['attribute' => 'updated_at', 'format' => 'date', 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'updated_at', 'options' => ['class' => 'form-control'], 'clientOptions' => ['dateFormat' => 'dd.mm.yy']])]]]; $boxButtons = $actions = []; $showActions = false; if (Yii::$app->user->can('BCreateBlogs')) { $boxButtons[] = '{create}'; } if (Yii::$app->user->can('BUpdateBlogs')) { $actions[] = '{update}'; $showActions = $showActions || true; } if (Yii::$app->user->can('BDeleteBlogs')) { $boxButtons[] = '{batch-delete}'; $actions[] = '{delete}'; $showActions = $showActions || true; } if ($showActions === true) {