Пример #1
0
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="blog-post-index">

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

    <p>
        <?php 
echo Html::a(Module::t('blog', 'Create ') . Module::t('blog', 'Blog Post'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], ['attribute' => 'catalog_id', 'value' => function ($model) {
    return $model->catalog->title;
}, 'filter' => Html::activeDropDownList($searchModel, 'catalog_id', \funson86\blog\models\BlogPost::getArrayCatalog(), ['class' => 'form-control', 'prompt' => Module::t('blog', 'Please Filter')])], 'title', 'commentsCount', ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    if ($model->status === Status::STATUS_ACTIVE) {
        $class = 'label-success';
    } elseif ($model->status === Status::STATUS_INACTIVE) {
        $class = 'label-warning';
    } else {
        $class = 'label-danger';
    }
    return '<span class="label ' . $class . '">' . $model->getStatus()->label . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'status', Status::labels(), ['class' => 'form-control', 'prompt' => Module::t('blog', 'PROMPT_STATUS')])], 'created_at:date', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Пример #2
0
use yii\helpers\Html;
use yii\helpers\StringHelper;
?>

<?php 
foreach ($comments as $comment) {
    ?>
    <div class="comment" id="c<?php 
    echo $comment->id;
    ?>
">

        <div class="author">
            <?php 
    echo Html::a("#{$comment->id}", $comment->getUrl($post), ['class' => 'cid', 'title' => \funson86\blog\Module::t('blog', 'Permalink to this comment')]);
    ?>
            <?php 
    echo $comment->authorLink;
    ?>
&nbsp;<span><?php 
    echo Yii::$app->formatter->asDate($comment->created_at);
    ?>
        </div>

        <div class="content">
            <?php 
    echo nl2br(Html::encode($comment->content));
    ?>
        </div>
Пример #3
0
<?php

use yii\helpers\Html;
use funson86\blog\Module;
/* @var $this yii\web\View */
/* @var $model funson86\blog\models\BlogCatalog */
$this->title = Module::t('blog', 'Create ') . Module::t('blog', 'Blog Catalog');
$this->params['breadcrumbs'][] = ['label' => Module::t('blog', 'Blog Catalogs'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="blog-catalog-create">

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

</div>
Пример #4
0
<?php

use yii\helpers\Html;
use funson86\blog\Module;
/* @var $this yii\web\View */
/* @var $model funson86\blog\models\BlogCatalog */
$this->title = Module::t('blog', 'Update ') . Module::t('blog', 'Blog Catalog') . ' ' . $model->title;
$this->params['breadcrumbs'][] = ['label' => Module::t('blog', 'Blog Catalogs'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Module::t('blog', 'Update');
?>
<div class="blog-catalog-update">

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

</div>
Пример #5
0
    <?php 
// echo $form->field($model, 'url')
?>

    <?php 
// echo $form->field($model, 'status')
?>

    <?php 
// echo $form->field($model, 'create_time')
?>

    <?php 
// echo $form->field($model, 'update_time')
?>

    <div class="form-group">
        <?php 
echo Html::submitButton(Module::t('blog', 'Search'), ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::resetButton(Module::t('blog', 'Reset'), ['class' => 'btn btn-default']);
?>
    </div>

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

</div>
Пример #6
0
?>

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

    <?php 
echo $form->field($model, 'banner')->fileInput();
?>

    <?php 
echo $form->field($model, 'click')->textInput();
?>

    <?php 
echo $form->field($model, 'status')->dropDownList(\funson86\blog\models\Status::labels());
?>

    <div class="form-group">
        <label class="col-lg-2 control-label" for="">&nbsp;</label>
        <?php 
echo Html::submitButton($model->isNewRecord ? Module::t('blog', 'Create') : Module::t('blog', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

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

</div>
Пример #7
0
 public static function labels()
 {
     return [self::STATUS_ACTIVE => Module::t('blog', 'STATUS_ACTIVE'), self::STATUS_INACTIVE => Module::t('blog', 'STATUS_INACTIVE'), self::STATUS_DELETED => Module::t('blog', 'STATUS_DELETED')];
 }
Пример #8
0
<?php

use yii\helpers\Html;
use funson86\blog\Module;
use yii\grid\GridView;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\blog\models\BlogTagSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Module::t('blog', 'Blog Tags');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="blog-tag-index">

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

    <p>
        <?php 
echo Html::a(Module::t('blog', 'Create ') . Module::t('blog', 'Blog Tag'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], 'id', 'name', 'frequency', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Пример #9
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => Module::t('blog', 'ID'), 'post_id' => Module::t('blog', 'Post ID'), 'content' => Module::t('blog', 'Content'), 'author' => Module::t('blog', 'Author'), 'email' => Module::t('blog', 'Email'), 'url' => Module::t('blog', 'Url'), 'status' => Module::t('blog', 'Status'), 'created_at' => Module::t('blog', 'Created At'), 'updated_at' => Module::t('blog', 'Updated At')];
 }
Пример #10
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => Module::t('blog', 'ID'), 'name' => Module::t('blog', 'Name'), 'frequency' => Module::t('blog', 'Frequency')];
 }
Пример #11
0
<div id="comments">
    <?php 
if ($post->commentsCount >= 1) {
    ?>
        <h3>
            <?php 
    echo $post->commentsCount . Module::t('blog', 'Unit comments');
    ?>
        </h3>

        <?php 
    echo $this->render('_comments', array('post' => $post, 'comments' => $comments));
    ?>
    <?php 
}
?>

    <div id='reply'>
        <h3><?php 
echo Module::t('blog', 'Write comments');
?>
</h3>
        <?php 
echo $this->render('_form', ['model' => $comment]);
?>
    </div>

</div><!-- comments -->


Пример #12
0
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use funson86\blog\Module;
/* @var $this yii\web\View */
/* @var $model funson86\blog\models\BlogCatalog */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => Module::t('blog', 'Blog Catalogs'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="blog-catalog-view">

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

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', ['attribute' => 'parent_id', 'value' => $model->parent_id ? $model->parent->title : Module::t('blog', 'Root Catalog')], 'title', 'surname', 'banner', ['attribute' => 'is_nav', 'value' => $model->isNavLabel], 'sort_order', 'page_size', 'template', 'redirect_url:url', ['attribute' => 'status', 'value' => $model->getStatus()->label], 'created_at:datetime', 'updated_at:datetime']]);
?>

</div>
Пример #13
0
"" title="<?php 
    echo Module::t('blog', 'View');
    ?>
" data-pjax="0"><span class="glyphicon glyphicon-eye-open"></span></a>
                <a href="<?php 
    echo \Yii::$app->getUrlManager()->createUrl(['blog/blog-catalog/update', 'id' => $item['id']]);
    ?>
"" title="<?php 
    echo Module::t('blog', 'Update');
    ?>
" data-pjax="0"><span class="glyphicon glyphicon-pencil"></span></a>
                <a href="<?php 
    echo \Yii::$app->getUrlManager()->createUrl(['blog/blog-catalog/delete', 'id' => $item['id']]);
    ?>
"" title="<?php 
    echo Module::t('blog', 'Delete');
    ?>
" data-confirm="<?php 
    echo Module::t('blog', 'Are you sure you want to delete this item?');
    ?>
" data-method="post" data-pjax="0"><span class="glyphicon glyphicon-trash"></span></a>
            </td>
        </tr>
        <?php 
}
?>
        </tbody>
    </table>

</div>
Пример #14
0
<?php

use yii\helpers\Html;
use funson86\blog\Module;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model backend\modules\blog\models\BlogPost */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => Module::t('blog', 'Blog Posts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="blog-post-view">

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

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', ['attribute' => 'catalog_id', 'value' => $model->catalog->title], 'title', 'brief:ntext', 'content:ntext', 'tags', 'surname', 'banner', 'click', ['attribute' => 'user_id', 'value' => $model->user->username], ['attribute' => 'status', 'value' => $model->getStatus()->label], 'created_at:datetime', 'updated_at:datetime']]);
?>

</div>
Пример #15
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => Module::t('blog', 'ID'), 'catalog_id' => Module::t('blog', 'Catalog ID'), 'title' => Module::t('blog', 'Title'), 'brief' => Module::t('blog', 'Brief'), 'content' => Module::t('blog', 'Content'), 'tags' => Module::t('blog', 'Tags'), 'surname' => Module::t('blog', 'Surname'), 'banner' => Module::t('blog', 'Banner'), 'click' => Module::t('blog', 'Click'), 'user_id' => Module::t('blog', 'User ID'), 'status' => Module::t('blog', 'Status'), 'created_at' => Module::t('blog', 'Created At'), 'updated_at' => Module::t('blog', 'Updated At'), 'commentsCount' => Module::t('blog', 'Comments Count')];
 }
Пример #16
0
echo $form->field($model, 'author')->textInput(['maxlength' => 32]);
?>
    <?php 
echo $form->field($model, 'email')->textInput(['maxlength' => 32]);
?>
    <?php 
echo $form->field($model, 'url')->textInput(['maxlength' => 64]);
?>
    <?php 
echo $form->field($model, 'content')->textarea(['rows' => 6])->label(false);
?>

    <div class="form-group">
        <label class="col-lg-1 control-label" for="">&nbsp;</label>
        <?php 
echo Html::button(Module::t('blog', 'Add comments'), ['class' => 'btn btn-success']);
?>
    </div>


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

</div><!-- form -->

<?php 
$this->registerJs('
    jQuery(function(){
        jQuery(".btn-success").click(function(){
            var result = true;
Пример #17
0
 /**
  * return all sub catalogs of a parent catalog
  * @param int $parentId
  * @param array $array
  * @return array
  */
 public static function getCatalog($parentId = 0, $array = array())
 {
     $newArray = array();
     foreach ((array) $array as $v) {
         if ($v['parent_id'] == $parentId) {
             $newArray[$v['id']] = array('text' => $v['title'] . ' 导航[' . ($v['is_nav'] ? Module::t('common', 'CONSTANT_YES') : Module::t('common', 'CONSTANT_NO')) . '] 排序[' . $v['sort_order'] . '] 类型[' . ($v['page_type'] == 'list' ? Module::t('common', 'PAGE_TYPE_LIST') : Module::t('common', 'PAGE_TYPE_PAGE')) . '] 状态[' . F::getStatus2($v['status']) . '] [<a href="' . Yii::app()->createUrl('/catalog/update', array('id' => $v['id'])) . '">修改</a>][<a href="' . Yii::app()->createUrl('/catalog/create', array('id' => $v['id'])) . '">增加子菜单</a>]&nbsp;&nbsp[<a href="' . Yii::app()->createUrl('/catalog/delete', array('id' => $v['id'])) . '">删除</a>]');
             $tempArray = self::getCatalog($v['id'], $array);
             if ($tempArray) {
                 $newArray[$v['id']]['children'] = $tempArray;
             }
         }
     }
     return $newArray;
 }