示例#1
0
?>
<!---->
<!--            --><?php 
//= Html::submitButton('<span class="glyphicon glyphicon-plus"></span> '
//                . Module::t('main', 'Add'),
//                ['class' => 'btn btn-success'])
?>
<!---->
<!--        --><?php 
//= Html::endForm()
?>

        <?php 
$form = ActiveForm::begin(['action' => ['post/create'], 'method' => 'get', 'layout' => 'inline']);
?>

        <?php 
echo $form->field($model, 'type_id', ['inputTemplate' => '<div class="input-group"><span class="input-group-addon">' . Module::t('main', 'Post type') . '</span>{input}</div>'])->dropDownList(Type::getList());
?>

        <div class="form-group">
            <?php 
echo Html::submitButton('<span class="glyphicon glyphicon-plus"></span> ' . Module::t('main', 'Add'), ['class' => 'btn btn-success']);
?>
        </div>

        <?php 
ActiveForm::end();
?>
    </div>
</div>
示例#2
0
<?php

use yii\helpers\Html;
use pendalf89\blog\Module;
/* @var $this yii\web\View */
/* @var $model pendalf89\blog\models\Category */
$this->title = Module::t('main', 'Update category “{title}”', ['title' => $model->title]);
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'Blog'), 'url' => ['default/index']];
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'Categories'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Module::t('main', 'Update category');
?>
<div class="category-update">

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

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

</div>
示例#3
0
/* @var $searchModel pendalf89\blog\models\CategorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Module::t('main', 'Categories');
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'Blog'), 'url' => ['default/index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="category-index">

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

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

        <?php 
echo Html::a('<span class="glyphicon glyphicon-tree-deciduous"></span> ' . Module::t('main', 'Category tree'), ['tree'], ['class' => 'btn btn-primary']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'parent_id', 'value' => function ($model) {
    return $model->getParentTitle();
}, 'filter' => Category::getList()], 'title', 'alias', 'position', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
示例#4
0
<?php

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

    <h1><?php 
echo $this->title;
?>
</h1>

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

</div>
示例#5
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>
示例#6
0
                                <?php 
    echo Html::a(Module::t('main', 'View on the site'), $this->context->getViewPostUrl($model), ['class' => 'btn btn-warning btn-sm', 'target' => '_blank']);
    ?>
                            </div>
                        </p>

                        <?php 
    echo Html::a('<span class="glyphicon glyphicon-info-sign"></span> ' . Module::t('main', 'Detail info'), ['post/view', 'id' => $model->id], ['class' => 'btn btn-default btn-sm']);
    ?>

                    <?php 
} else {
    ?>

                        <?php 
    echo Html::submitButton(Module::t('main', 'Save'), ['class' => 'btn btn-success btn-sm']);
    ?>

                    <?php 
}
?>

                </div>
                <?php 
if (!$model->isNewRecord) {
    ?>

                    <table class="table table-bordered">
                        <tbody>
                        <tr>
                            <td>
示例#7
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]);
?>
示例#8
0
                    <?php 
echo Html::a(Module::t('main', 'Categories'), ['category/index']);
?>
                </h2>
                <?php 
echo Html::a(Html::img($assetPath . '/images/categories.png', ['alt' => 'Categories']), ['category/index']);
?>
            </div>
        </div>

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

            <div class="text-center">
                <h2>
                    <?php 
echo Html::a(Module::t('main', 'Post types'), ['type/index']);
?>
                </h2>
                <?php 
echo Html::a(Html::img($assetPath . '/images/post-types.png', ['alt' => 'Nightstand']), ['type/index']);
?>
            </div>
        </div>

<!--        <div class="col-md-3">-->
<!---->
<!--            <div class="text-center">-->
<!--                <h2>-->
<!--                    --><?php 
//= Html::a(Module::t('main', 'Settings'), ['default/settings'])
?>
示例#9
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => 'ID', 'parent_id' => Module::t('main', 'Parent category'), 'title' => Module::t('main', 'Title'), 'alias' => Module::t('main', 'Alias'), 'position' => Module::t('main', 'Position')];
 }
示例#10
0
<?php

use yii\helpers\Html;
use pendalf89\blog\Module;
/* @var $this yii\web\View */
/* @var $model pendalf89\blog\models\Type */
$this->title = Module::t('main', 'Update post type “{title}”', ['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'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Module::t('main', 'Update post type');
?>

<div class="type-update">

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

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

</div>
示例#11
0
/* @var $form yii\widgets\ActiveForm */
?>

<div class="panel panel-warning">
    <div class="panel-heading"><?php 
echo Module::t('main', 'Post search');
?>
</div>
    <div class="panel-body">

        <?php 
$form = ActiveForm::begin(['action' => ['index'], 'method' => 'get', 'layout' => 'inline']);
?>

            <?php 
echo $form->field($model, 'title')->widget(Typeahead::classname(), ['options' => ['placeholder' => Module::t('main', 'Enter post title...')], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $titles]]]);
?>

            <?php 
echo Html::submitButton('<span class="glyphicon glyphicon-search"></span> ' . Module::t('main', 'Search'), ['class' => 'btn btn-primary']);
?>
            <?php 
echo Html::a('<span class="glyphicon glyphicon-remove text-danger"></span>', ['post/index'], ['class' => 'btn btn-default']);
?>

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

    </div>
</div>
示例#12
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>
示例#13
0
文件: Post.php 项目: GAMITG/yii2-blog
 /**
  * @return array statuses
  */
 public static function getStatuses()
 {
     return [self::STATUS_DRAFT => Module::t('main', 'Draft'), self::STATUS_PUBLISHED => Module::t('main', 'Published')];
 }
示例#14
0
$form = ActiveForm::begin();
?>

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

    <?php 
echo $form->field($model, 'parent_id')->dropDownList(Category::getList($model->id), ['prompt' => Module::t('main', 'Select parent category')]);
?>

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

    <?php 
echo $form->field($model, 'position')->textInput()->hint(Module::t('main', 'Number of position on sorting. The higher the number, the higher category is to issue.'));
?>

    <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>
示例#15
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>
示例#16
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => 'ID', 'title' => Module::t('main', 'Title'), 'alias' => Module::t('main', 'Alias'), 'show_category' => Module::t('main', 'Show Category')];
 }