Ejemplo n.º 1
0
use yii\helpers\Html;
use callmez\wechat\models\Module;
use callmez\wechat\widgets\GridView;
use callmez\wechat\widgets\PagePanel;
$this->title = '模块管理';
$this->params['breadcrumbs'][] = $this->title;
$wechat = Yii::$app->getModule('wechat');
if ($wechat->canCreateModule()) {
    $createModule = Html::a('我要设计新模块', ["/{$wechat->giiModuleName}/{$wechat->giiGeneratorName}"], ['class' => 'pull-right']);
} else {
    $createModule = Html::a('想设计新模块?', 'https://github.com/callmez/yii2-wechat/blob/master/docs/addon-module.md', ['class' => 'pull-right']);
}
PagePanel::begin(['rightHtml' => $createModule, 'options' => ['class' => 'addon-module-index']]);
?>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['name', 'id', ['attribute' => 'type', 'format' => 'html', 'value' => function ($model) use($models) {
    return Html::tag('span', Module::$types[$model->type], ['class' => 'label label-' . ($model->type == Module::TYPE_CORE ? 'danger' : 'info')]);
}], 'version', ['attribute' => 'author', 'format' => 'html', 'value' => function ($model) {
    $author = $model->author ?: '匿名';
    return $model->site ? Html::a($author, $model->site) : Html::encode($author);
}, 'options' => ['width' => 80]], 'ability', ['header' => '安装状态', 'format' => 'html', 'value' => function ($model) use($models) {
    $installed = $model->getIsInstalled();
    return Html::tag('span', $installed ? '已安装' : '未安装', ['class' => 'label label-' . ($installed ? 'warning' : 'success')]);
}], 'created_at:datetime', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{install}', 'buttons' => ['install' => function ($url, $model, $key) use($models) {
    if ($model->getIsInstalled()) {
        return Html::a('卸载模块', ['uninstall', 'id' => $model->id], ['data-confirm' => '确定要卸载此模块?']);
    } else {
        return Html::a('安装模块', ['install', 'id' => $model->id]);
    }
}]]]]);
PagePanel::end();
Ejemplo n.º 2
0
<?php

use yii\helpers\Html;
use callmez\wechat\widgets\GridView;
use callmez\wechat\widgets\PagePanel;
$this->title = '素材管理';
$this->params['breadcrumbs'][] = $this->title;
PagePanel::begin(['options' => ['class' => 'media-index']]);
?>
    <p>
        <?php 
echo Html::a('添加素材', ['create'], ['class' => 'btn btn-success', 'data' => ['toggle' => 'modal', 'target' => '#mediaCreateModal']]);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'mediaId', 'post:ntext', 'result:ntext', 'type', 'material', 'created_at:datetime', 'updated_at:datetime', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

<?php 
PagePanel::end();
Ejemplo n.º 3
0
<?php

use yii\helpers\Html;
use callmez\wechat\widgets\GridView;
use callmez\wechat\assets\FileApiAsset;
Yii::$app->request->getIsAjax() && ($this->context->layout = false);
?>
<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    <h4 class="modal-title" id="exampleModalLabel">选择媒体素材</h4>
</div>
<div class="modal-body">
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', 'mediaId', 'post:ntext', 'result:ntext', 'type', ['class' => 'yii\\grid\\ActionColumn']]]);
?>
</div>
<div class="modal-footer">
    <?php 
echo Html::a('上传文件', ['create'], ['class' => 'pull-left btn btn-success', 'data' => ['toggle' => 'modal', 'target' => '#mediaUploadModal']]);
?>
    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
    <button type="button" class="btn btn-primary">确定</button>
</div>
Ejemplo n.º 4
0
use callmez\wechat\widgets\GridView;
use callmez\wechat\widgets\PagePanel;
$this->title = '回复规则';
$this->params['breadcrumbs'][] = $this->title;
PagePanel::begin(['options' => ['class' => 'reply-index']]);
?>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('添加回复规则', ['create', 'mid' => $mid], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['tableOptions' => ['class' => 'table table-hover'], 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'id', 'options' => ['width' => 75]], 'name', ['attribute' => 'mid', 'value' => function ($model) {
    $module = Yii::$app->getModule('wechat');
    return (($module = $module->getModule($model->mid)) ? $module->name : '') . '(' . $model->mid . ')';
}], ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    return Html::tag('span', ReplyRule::$statuses[$model->status], ['class' => 'label label-' . ($model->status == ReplyRule::STATUS_ACTIVE ? 'success' : 'info')]);
}, 'filter' => ReplyRule::$statuses, 'options' => ['width' => 80]], ['attribute' => 'keywords', 'format' => 'html', 'value' => function ($model) {
    return implode(' ', array_map(function ($model) {
        return Html::tag('code', $model->keyword);
    }, $model->keywords));
}], 'created_at:datetime', 'updated_at:datetime', ['attribute' => 'priority', 'options' => ['width' => 60]], ['class' => 'callmez\\wechat\\widgets\\ActionColumn', 'template' => '{update} {delete}', 'options' => ['width' => 80]]]]);
?>

<?php 
PagePanel::end();
Ejemplo n.º 5
0
<?php

use yii\helpers\Html;
use callmez\wechat\models\Fans;
use callmez\wechat\widgets\GridView;
use callmez\wechat\widgets\PagePanel;
use callmez\wechat\assets\WechatAsset;
$wechatAsset = WechatAsset::register($this);
$this->title = '粉丝列表';
$this->params['breadcrumbs'][] = $this->title;
PagePanel::begin(['options' => ['class' => 'fans-update']]);
?>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'id', 'options' => ['width' => 75]], ['attribute' => 'user.avatar', 'format' => 'html', 'value' => function ($model) use($wechatAsset) {
    return Html::img($model->user ? $model->user->avatar : $wechatAsset->baseUrl . '/images/anonymous_avatar.jpg', ['width' => 40, 'class' => 'img-rounded']);
}, 'options' => ['width' => 70]], ['attribute' => 'user.nickname', 'value' => function ($model) {
    return $model->user ? $model->user->nickname : '';
}], ['attribute' => 'open_id', 'options' => ['width' => 200]], ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    return Html::tag('span', Fans::$statuses[$model->status], ['class' => 'label label-' . ($model->status == Fans::STATUS_SUBSCRIBED ? 'success' : 'info')]);
}, 'filter' => Fans::$statuses, 'options' => ['width' => 120]], ['attribute' => 'created_at', 'format' => 'datetime'], ['class' => 'callmez\\wechat\\widgets\\ActionColumn', 'template' => '{history} {update}', 'buttons' => ['history' => function ($url, $model, $key) {
    return Html::a('发送消息', ['message', 'id' => $key]);
}]]]]);
PagePanel::end();
Ejemplo n.º 6
0
<?php

use yii\helpers\Html;
use callmez\wechat\models\Wechat;
use callmez\wechat\widgets\GridView;
use callmez\wechat\widgets\PagePanel;
$this->title = '公众号列表';
$this->params['breadcrumbs'][] = $this->title;
PagePanel::begin(['options' => ['class' => 'wechat-index']]);
?>
    <p>
        <?php 
echo Html::a('添加公众号', ['create'], ['class' => 'btn btn-success']);
?>
    </p>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'id', 'options' => ['width' => 75]], 'name', ['attribute' => 'type', 'format' => 'html', 'value' => function ($model) {
    return Html::tag('span', Wechat::$types[$model->type], ['class' => 'label label-info']);
}, 'filter' => Wechat::$types], ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    return Html::tag('span', Wechat::$statuses[$model->status], ['class' => 'label label-' . ($model->status == Wechat::STATUS_ACTIVE ? 'success' : 'danger')]);
}, 'filter' => Wechat::$statuses], 'created_at:datetime', 'updated_at:datetime', ['class' => 'callmez\\wechat\\widgets\\ActionColumn', 'template' => '{manage} {update} {delete}', 'buttons' => ['manage' => function ($url, $model) {
    return Html::a('管理此公众号', $url, ['class' => 'text-danger', 'data' => ['toggle' => 'tooltip', 'placement' => 'bottom'], 'title' => '管理此公众号']);
}]]]]);
PagePanel::end();
$this->registerJs(<<<EOF
    \$('[data-toggle="tooltip"]').tooltip();
EOF
);