예제 #1
0
use pendalf89\blog\Module;
use pendalf89\blog\helpers\Helper;
/* @var $this yii\web\View */
/* @var $model pendalf89\blog\models\Type */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'Blog'), 'url' => ['default/index']];
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'Post types'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="type-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('<span class="glyphicon glyphicon-pencil"></span> ' . Module::t('main', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('<span class="glyphicon glyphicon-trash"></span> ' . Module::t('main', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'title', 'alias', ['attribute' => 'show_category', 'value' => Helper::booleanChoiceArray()[$model->show_category]]]]);
?>

</div>
예제 #2
0
use kartik\alert\Alert;
/* @var $this yii\web\View */
/* @var $model pendalf89\blog\models\Post */
$this->title = Module::t('main', 'Update post “{title}”', ['title' => $model->title]);
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'Blog'), 'url' => ['default/index']];
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'Posts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Module::t('main', 'Update post');
?>
<div class="post-update">

    <?php 
if (Yii::$app->session->getFlash('postSaved')) {
    ?>
        <?php 
    echo Alert::widget(['type' => Alert::TYPE_SUCCESS, 'title' => Module::t('main', 'Post “{title}” has been saved successfully!', ['title' => $model->title]), 'icon' => 'glyphicon glyphicon-ok-sign', 'body' => Module::t('main', 'You can watch this post {on the site}, or go to see {all posts}.', ['on the site' => Html::a(Helper::strtolower(Module::t('main', 'On the site')), $this->context->getViewPostUrl($model), ['target' => '_blank']), 'all posts' => Html::a(Helper::strtolower(Module::t('main', 'All posts')), ['post/index'])]), 'showSeparator' => true]);
    ?>
    <?php 
} else {
    ?>
        <h1><?php 
    echo Html::encode($this->title);
    ?>
</h1>
    <?php 
}
?>

    <?php 
echo $this->render('_form', ['model' => $model]);
?>
예제 #3
0
use pendalf89\blog\helpers\Helper;
/* @var $this yii\web\View */
/* @var $model pendalf89\blog\models\Post */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'Blog'), 'url' => ['default/index']];
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'Posts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="post-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('<span class="glyphicon glyphicon-eye-open"></span> ' . Module::t('main', 'View post on the site'), $viewPostUrl, ['target' => '_blank', 'class' => 'btn btn-info']);
?>
        <?php 
echo Html::a('<span class="glyphicon glyphicon-pencil"></span> ' . Module::t('main', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('<span class="glyphicon glyphicon-trash"></span> ' . Module::t('main', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', ['attribute' => 'category_id', 'value' => !empty($model->category) ? $model->category->title : null], ['attribute' => 'type_id', 'value' => $model->type->title], 'title', 'title_seo', 'alias', ['attribute' => 'content', 'value' => Helper::cutStr($model->content)], ['attribute' => 'preview', 'value' => Helper::cutStr($model->preview)], ['attribute' => 'meta_description', 'value' => !empty($model->meta_description) ? $model->meta_description : null], 'views', ['attribute' => 'publish_status', 'value' => $model->getStatus()], ['attribute' => 'created_at', 'value' => Yii::$app->formatter->asDatetime($model->created_at)], ['attribute' => 'updated_at', 'value' => !empty($model->updated_at) ? Yii::$app->formatter->asDatetime($model->updated_at) : null]]]);
?>
</div>
예제 #4
0
/* @var $this yii\web\View */
/* @var $searchModel pendalf89\blog\models\TypeSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Module::t('main', 'Blog');
$this->params['breadcrumbs'][] = $this->title;
$assetPath = BlogAsset::register($this)->baseUrl;
?>

<div class="blog-default-index">
    <h1><?php 
echo Module::t('main', 'Blog module');
?>
</h1>

    <?php 
if (Helper::isJustInstalled()) {
    ?>
        <?php 
    echo Alert::widget(['type' => Alert::TYPE_SUCCESS, 'title' => Module::t('main', 'Welcome to the module “Blog”!'), 'icon' => 'glyphicon glyphicon-ok-sign', 'body' => Module::t('main', 'You have successfully installed the module “Blog” is now to create a record, you need to create your first post type and category'), 'showSeparator' => true]);
    ?>
    <?php 
}
?>

    <div class="row">
        <div class="col-md-4">

            <div class="text-center">
                <h2>
                    <?php 
echo Html::a(Module::t('main', 'Posts'), ['post/index']);
예제 #5
0
use yii\grid\GridView;
use pendalf89\blog\Module;
use pendalf89\blog\helpers\Helper;
/* @var $this yii\web\View */
/* @var $searchModel pendalf89\blog\models\TypeSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Module::t('main', 'Post types');
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'Blog'), 'url' => ['default/index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="type-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('<span class="glyphicon glyphicon-plus"></span> ' . Module::t('main', 'New post type'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['title', 'alias', ['attribute' => 'show_category', 'format' => 'html', 'value' => function ($model) {
    return Helper::booleanIconChoiceArray()[$model->show_category];
}, 'filter' => Helper::booleanChoiceArray()], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
예제 #6
0
            <div class="col-md-4">
                <?php 
    echo $this->render('_search', ['model' => $searchModel, 'titles' => $titles]);
    ?>
            </div>
        <?php 
}
?>
    </div>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'title', 'format' => 'html', 'value' => function ($model) {
    return Html::a($model->title, ['post/update', 'id' => $model->id]);
}], ['attribute' => 'category_id', 'value' => function ($model) {
    return !empty($model->category) ? $model->category->title : null;
}, 'filter' => Category::getList()], ['attribute' => 'type_id', 'value' => function ($model) {
    return $model->type->title;
}, 'filter' => Type::getList()], ['attribute' => 'meta_description', 'format' => 'html', 'value' => function ($model) {
    $metaDescriptionStatus = !empty($model->meta_description) ? 1 : 0;
    return Helper::booleanIconChoiceArray()[$metaDescriptionStatus];
}, 'filter' => ['yes' => Yii::t('yii', 'Yes'), 'no' => Yii::t('yii', 'No')], 'headerOptions' => ['class' => 'text-center'], 'contentOptions' => ['class' => 'text-center']], ['attribute' => 'views', 'headerOptions' => ['class' => 'text-center'], 'contentOptions' => ['class' => 'text-center']], ['attribute' => 'publish_status', 'value' => function ($model) {
    return $model->getStatus();
}, 'filter' => Post::getStatuses()], ['header' => Module::t('main', 'Last changes'), 'value' => function ($model) {
    return Yii::$app->formatter->asDatetime($model->getLastChangesTimestamp());
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {delete}', 'buttons' => ['view' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $this->context->getViewPostUrl($model), ['target' => '_blank', 'title' => Module::t('main', 'View post on the site')]);
}]]]]);
?>

</div>
예제 #7
0
<?php

use yii\helpers\Html;
use pendalf89\blog\Module;
use pendalf89\blog\helpers\Helper;
use pendalf89\blog\assets\TranslitAsset;
use pendalf89\blog\assets\DuplicateAsset;
/* @var $this yii\web\View */
/* @var $model pendalf89\blog\models\Post */
$this->title = Module::t('main', 'New {type}', ['type' => Helper::strtolower($model->type->title)]);
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'Blog'), 'url' => ['default/index']];
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'Posts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
if ($this->context->module->autoTranslit) {
    TranslitAsset::register($this);
}
DuplicateAsset::register($this);
?>
<div class="post-create">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
echo $this->render('_form', ['model' => $model]);
?>

</div>
예제 #8
0
<div class="type-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'alias')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'show_category')->dropDownList(Helper::booleanChoiceArray());
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Module::t('main', 'Create') : Module::t('main', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>