/** * @param $id * @return string * @throws NotFoundHttpException */ public function actionDisallowed($id) { $model = $this->findModel($id); $model->moder = PostComment::COMMENT_MODER_DISALLOWED; $success = Module::t('module', 'COMMENT_DISALLOWED_SUCCESS_{id}', ['id' => $id]); $error = Module::t('module', 'COMMENT_DISALLOWED_ERROR'); if (Yii::$app->request->isAjax && $model->save()) { return $this->render('_success', ['success' => $success]); } return $this->render('index', ['model' => self::getComments(), 'error' => $error]); }
<?php use yii\helpers\Html; use app\modules\admin\modules\blog\Module; /* @var $this yii\web\View */ /* @var $model app\modules\admin\modules\blog\models\Post */ $this->title = Module::t('module', 'TITLE_CREATE'); $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN'), 'url' => ['/admin/default/index']]; $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN_BLOG'), 'url' => ['/admin/blog/default/index']]; $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN_POSTS'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="admin-blog-post-create"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_form', ['model' => $model, 'category' => $category, 'authors' => $authors, 'tags' => $tags]); ?> </div>
</p> <p class="pull-right"> <?php echo Html::a('<i class="glyphicon glyphicon-th-large"></i> ' . Module::t('module', 'BUTTON_CATEGORIES'), ['category/index'], ['class' => 'btn btn-primary']); ?> <?php echo Html::a('<i class="glyphicon glyphicon-tags"></i> ' . Module::t('module', 'BUTTON_TAGS'), ['tags/index'], ['class' => 'btn btn-primary']); ?> <?php echo Html::a('<i class="glyphicon glyphicon-comment"></i> ' . Module::t('module', 'BUTTON_COMMENTS') . ' <span class="badge">' . $countPending . '</span>', ['comment/index'], ['class' => 'btn btn-primary']); ?> </p> </div> </div> <?php $gridColumn = [['class' => 'yii\\grid\\SerialColumn'], ['class' => LinkColumn::className(), 'attribute' => 'title'], ['attribute' => 'author_id', 'label' => Module::t('module', 'LABEL_AUTHOR'), 'format' => 'text', 'content' => function ($data) { return $data->getAuthorName(); }, 'filter' => Post::getAuthorList()], ['filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'date_from', 'attribute2' => 'date_to', 'type' => DatePicker::TYPE_RANGE, 'separator' => '-', 'pluginOptions' => ['format' => 'yyyy-mm-dd', 'todayHighlight' => true]]), 'attribute' => 'created_at', 'format' => ['date', 'php:d M Y г., H:i:s']], ['filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'dateUpd_from', 'attribute2' => 'dateUpd_to', 'type' => DatePicker::TYPE_RANGE, 'separator' => '-', 'pluginOptions' => ['format' => 'yyyy-mm-dd', 'todayHighlight' => true]]), 'attribute' => 'updated_at', 'format' => ['date', 'php:d M Y г., H:i:s']], ['class' => SetColumn::className(), 'attribute' => 'publish_status', 'filter' => Post::getStatusesArray(), 'name' => function ($model) { return Post::getStatusTitle($model->publish_status); }, 'cssCLasses' => [Post::STATUS_PUBLISH => 'success', Post::STATUS_DRAFT => 'default', Post::STATUS_ARCHIVE => 'info']], ['attribute' => 'category_id', 'label' => Module::t('module', 'LABEL_CATEGORY'), 'format' => 'text', 'content' => function ($data) { return $data->getCategoryTitle(); }, 'filter' => Post::getCategoryList()], ['class' => ActionColumn::className()]]; ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => $gridColumn, 'responsive' => true, 'hover' => true, 'pjax' => false, 'resizableColumns' => true, 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['class' => 'btn btn-default', 'title' => Module::t('module', 'RESET_GRID')])], '{toggleData}'], 'panel' => ['heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-th-list"></i> ' . Html::encode($this->title) . '</h3>', 'type' => 'primary', 'before' => Html::a('<i class="glyphicon glyphicon-plus"></i> ' . Module::t('module', 'BUTTON_CREATE'), ['create'], ['class' => 'btn btn-success', 'data-pjax' => 0])]]); ?> </div>
/** * @return array */ public static function getStatusesArray() { return [self::STATUS_PUBLISH => Module::t('module', 'STATUS_PUBLISH'), self::STATUS_DRAFT => Module::t('module', 'STATUS_DRAFT'), self::STATUS_ARCHIVE => Module::t('module', 'STATUS_ARCHIVE')]; }
echo MarkdownEditorFull::widget(['model' => $model, 'attribute' => 'content', 'showExport' => false]); ?> <?php echo Html::error($model, 'content', ['class' => 'text-danger']); ?> </div> <?php echo $form->field($model, 'tags')->listBox(ArrayHelper::map($tags, 'id', 'title'), ['multiple' => true]); ?> <?php echo $form->field($model, 'category_id')->dropDownList(ArrayHelper::map($category, 'id', 'title')); ?> <?php echo $form->field($model, 'publish_status')->dropDownList([Post::STATUS_DRAFT => Module::t('module', 'STATUS_DRAFT'), Post::STATUS_PUBLISH => Module::t('module', 'STATUS_PUBLISH'), Post::STATUS_ARCHIVE => Module::t('module', 'STATUS_ARCHIVE')]); ?> <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']); ?> </div> <?php ActiveForm::end(); ?> </div>
<?php use yii\helpers\Html; use app\modules\admin\modules\blog\Module; /* @var $this yii\web\View */ /* @var $model app\modules\admin\modules\blog\models\Category */ $this->title = $model->title; $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN'), 'url' => ['/admin/default/index']]; $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN_BLOG'), 'url' => ['/admin/blog/default/index']]; $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN_CATEGORIES'), 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = Module::t('module', 'TITLE_UPDATE'); ?> <div class="admin-blog-category-update"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_form', ['model' => $model]); ?> </div>
<div class="pull-right"> ID:<?php echo $item->id; ?> </div> </div> <div class="panel-body"> <?php echo $item->text; ?> </div> <div class="panel-footer clearfix"> <div class="pull-left"> <p class="text-danger"><?php echo $error; ?> </p> </div> <div class="pull-right"> <?php echo Html::a('<span class="glyphicon glyphicon-ok"></span>', ['/admin/blog/comment/allowed', 'id' => $item->id], ['title' => Module::t('module', 'BUTTON_ALLOWED')]) . ' '; echo Html::a('<span class="glyphicon glyphicon-ban-circle"></span>', ['/admin/blog/comment/disallowed', 'id' => $item->id], ['title' => Module::t('module', 'BUTTON_DISALLOWED')]) . ' '; ?> </div> </div> </div> <?php Pjax::end(); ?>
/** * @inheritdoc */ public function attributeLabels() { return ['id' => 'ID', 'title' => Module::t('module', 'LABEL_TITLE')]; }
?> <div class="admin-blog-tags-search"> <?php $form = ActiveForm::begin(['action' => ['index'], 'method' => 'get']); ?> <?php echo $form->field($model, 'id'); ?> <?php echo $form->field($model, 'title'); ?> <div class="form-group"> <?php echo Html::submitButton(Module::t('module', 'BUTTON_SEARCH'), ['class' => 'btn btn-primary']); ?> <?php echo Html::resetButton(Module::t('module', 'BUTTON_RESET'), ['class' => 'btn btn-default']); ?> </div> <?php ActiveForm::end(); ?> </div>
/* @var $this yii\web\View */ /* @var $model app\modules\admin\modules\blog\models\Post */ /* @var $author app\modules\user\models\User */ $this->title = $model->title; $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN'), 'url' => ['/admin/default/index']]; $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN_BLOG'), 'url' => ['/admin/blog/default/index']]; $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN_POSTS'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="admin-blog-post-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', 'WANT_YOU_DELETE_ELEMENT'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'title', ['attribute' => 'anons', 'format' => 'raw', 'value' => Markdown::convert($model->anons)], ['attribute' => 'content', 'format' => 'raw', 'value' => Markdown::convert($model->content)], ['attribute' => Module::t('module', 'LABEL_CATEGORY'), 'format' => 'raw', 'value' => $model->category->title], ['attribute' => Module::t('module', 'LABEL_AUTHOR'), 'format' => 'raw', 'value' => $model->author->username], ['attribute' => 'publish_status', 'format' => 'raw', 'value' => Post::getDetailStatusTitle($model->publish_status)], ['attribute' => 'created_at', 'format' => ['date', 'php:d M Y г., H:i:s']], ['attribute' => 'updated_at', 'format' => ['date', 'php:d M Y г., H:i:s']]]]); ?> </div>
/** * @inheritdoc */ public function attributeLabels() { return ['id' => 'ID', 'title' => Module::t('module', 'LABEL_TITLE'), 'frequency' => Module::t('module', 'LABEL_FREQUENCY')]; }
</h1> <div class="row"> <div class="col-md-12"> <p class="pull-left"> </p> <p class="pull-right"> <?php echo Html::a('<i class="glyphicon glyphicon-th-large"></i> ' . Module::t('module', 'BUTTON_CATEGORIES'), ['category/index'], ['class' => 'btn btn-primary']); ?> <?php echo Html::a('<i class="glyphicon glyphicon-tags"></i> ' . Module::t('module', 'BUTTON_TAGS'), ['tags/index'], ['class' => 'btn btn-primary']); ?> <?php echo Html::a('<i class="glyphicon glyphicon-list"></i> ' . Module::t('module', 'BUTTON_POSTS'), ['post/index'], ['class' => 'btn btn-primary']); ?> </p> </div> <div class="col-md-8"> <?php if ($model) { foreach ($model as $items) { echo $this->render('_list', ['item' => $items, 'error' => $error]); } } else { echo $this->render('_no-list', ['info' => Module::t('module', 'COMMENT_PENDING_NO')]); } ?> </div> </div> </div>
use app\modules\admin\modules\blog\Module; /* @var $this yii\web\View */ /* @var $model app\modules\admin\modules\blog\models\Category */ $this->title = $model->title; $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN'), 'url' => ['/admin/default/index']]; $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN_BLOG'), 'url' => ['/admin/blog/default/index']]; $this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN_CATEGORIES'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="admin-blog-category-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', 'WANT_YOU_DELETE_ELEMENT'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'title']]); ?> </div>