コード例 #1
0
ファイル: list.php プロジェクト: marley-php/linuxforum
        echo $formatter->asInteger($user->number_posts);
        ?>
</td>
                    <td class="tcr"><?php 
        echo $formatter->asDate($user->created_at);
        ?>
</td>
                </tr>
            <?php 
    }
    ?>
            </tbody>
        <?php 
} else {
    ?>
            <tbody>
            <tr>
                <td colspan="4" class="tcl"><?php 
    echo \Yii::t('app/userlist', 'No result');
    ?>
</td>
            </tr>
            </tbody>
        <?php 
}
?>
    </table>
    <?php 
echo LinkPager::widget(['pagination' => $dataProvider->pagination]);
?>
</div>
コード例 #2
0
ファイル: index.php プロジェクト: tqsq2005/Yii2adv
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
/* echo Html::a('Create Events', ['create'], ['class' => 'btn btn-success'])*/
?>
    </p>

    <?php 
Pjax::begin();
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'user_id', 'value' => 'user.username', 'options' => ['width' => '20%'], 'filter' => \kartik\widgets\Select2::widget(['model' => $searchModel, 'attribute' => 'user_id', 'data' => \yii\helpers\ArrayHelper::map(\dektrium\user\models\User::find()->all(), 'id', 'username'), 'options' => ['prompt' => '---请选择需要筛选的用户---'], 'pluginOptions' => ['tags' => true, 'tokenSeparators' => [',', ' '], 'maximumInputLength' => 3, 'allowClear' => true]])], 'title', 'data:ntext', 'time:datetime', ['class' => 'yii\\grid\\ActionColumn', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-pencil" style="cursor: pointer;"></span>', false, ['class' => 'showModalButton', 'value' => Yii::$app->urlManager->createUrl(['events/view', 'id' => $model->id, 'edit' => 't']), 'title' => Yii::t('yii', 'Edit')]);
}, 'view' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-eye-open" style="cursor: pointer;"></span>', false, ['class' => 'showModalButton', 'value' => Yii::$app->urlManager->createUrl(['events/view', 'id' => $model->id]), 'title' => Yii::t('yii', 'View')]);
}]]], 'responsive' => true, 'hover' => true, 'condensed' => true, 'floatHeader' => true, 'panel' => ['heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-th-list"></i> ' . Html::encode($this->title) . ' </h3>', 'type' => 'info', 'before' => Html::a('<i class="glyphicon glyphicon-plus"></i> 新增', false, ['class' => 'showModalButton btn btn-success', 'value' => \yii\helpers\Url::to(['events/create']), 'title' => '新增事件']), 'after' => Html::a('<i class="glyphicon glyphicon-repeat"></i> Reset List', ['index'], ['class' => 'btn btn-info']), 'showFooter' => false], 'filterSelector' => "select[name='" . $dataProvider->getPagination()->pageSizeParam . "'],input[name='" . $dataProvider->getPagination()->pageParam . "']", 'pager' => ['class' => \common\widgets\LinkPager::className(), 'template' => '{pageButtons} {customPage} {pageSize}', 'pageSizeMargin' => 'margin-left:5px;margin-right:5px;', 'pageSizeOptions' => ['class' => 'form-control', 'style' => 'display: inline-block;width:auto;margin-top:0px; margin-bottom: 2px;'], 'customPageWidth' => 50, 'customPageBefore' => ' <span class="text-center text-primary" style="margin-left: 10px;"><i class="fa fa-cog fa-lg fa-spin"></i> 跳转至第</span> ', 'customPageAfter' => ' <span class="text-center text-primary">页 每页显示</span> ', 'customPageMargin' => 'margin-left:5px;margin-right:5px; ime-mode:disabled; margin-bottom: 2px;', 'firstPageLabel' => '<span class="fa fa-step-backward" />', 'prevPageLabel' => '<span class="fa fa-chevron-left" />', 'nextPageLabel' => '<span class="fa fa-chevron-right" />', 'lastPageLabel' => '<span class="fa fa-step-forward" />', 'maxButtonCount' => 15]]);
Pjax::end();
?>

</div>
<?php 
\common\widgets\JsBlock::begin();
?>
<script type="text/javascript">
    //js获取get参数
    function GetUrlParms()
    {
        var args=new Object();
        var query=location.search.substring(1);//获取查询串
        var pairs=query.split("&");//在逗号处断开
        for(var i=0;i<pairs.length;i++)