Example:
~~~
echo Html::icon('pencil');
echo Html::icon('trash', ['style' => 'color: red; font-size: 2em']);
echo Html::icon('plus', ['class' => 'text-success']);
~~~
public static icon ( string $icon, array $options = [], string $prefix = 'glyphicon glyphicon-', string $tag = 'span' ) : string | ||
$icon | string | the bootstrap icon name without prefix (e.g. 'plus', 'pencil', 'trash') |
$options | array | HTML attributes / options for the icon container |
$prefix | string | the css class prefix - defaults to 'glyphicon glyphicon-' |
$tag | string | the icon container tag (usually 'span' or 'i') - defaults to 'span' |
Результат | string |
public function run() { $months = [0 => 'Январь', 1 => 'Февраль', 2 => 'Март', 3 => 'Апрель', 4 => 'Май', 5 => 'Июнь', 6 => 'Июль', 7 => 'Август', 8 => 'Сентябрь', 9 => 'Октябрь', 10 => 'Ноябрь', 11 => 'Декабрь']; $time = time(); $request = \Yii::$app->request; $time = $request->get('time', $time); $month = date('n', $time); $year = date('Y', $time); echo '<div class="b-calendar b-calendar--along">'; echo '<h4 class="text-center">'; echo Html::a(Html::icon('triangle-left'), '?time=' . strtotime('-1 month', $time), ['class' => 'pull-left']); echo $months[$month - 1] . ' ' . $year; echo Html::a(Html::icon('triangle-right'), '?time=' . strtotime('+1 month', $time), ['class' => 'pull-right']); echo '</h4>'; echo $this->draw_calendar($month, 2016); echo '</div>'; }
/** * * @param type $name * @param array $config */ public static function getIcon($input, array $config = []) { //Lookup DB Value corresponding to input $model = models\IconRegister::findOne(['name' => $input]); $icon = NULL; if (!isset($model) || $model->framework_id == 'bdg') { $icon = isset($model) ? $model->icon : $input; $config['as_badge'] = TRUE; } else { $icon = Html::icon($model->icon, $config, $model->framework_id == 'bsg' ? 'glyphicon glyphicon-' : 'fa fa-fw fa-'); } $output = $icon; if (isset($config['as_badge']) && $config['as_badge'] == TRUE) { $output = Html::badge($output . ' ' . (isset($config['label']) && isset($config['label_as_badge']) ? $config['label'] : ''), $config); } $label = isset($config['label']) && !isset($config['label_as_badge']) ? ' ' . $config['label'] : ''; return $output . $label; }
/** * Generates a jumbotron - a lightweight, flexible component that can optionally * extend the entire viewport to showcase key content on your site. * * @param mixed $content the jumbotron content * - when passed as a string, it will display this directly as a raw content * - when passed as an array, it requires these keys * - @param string $heading the jumbotron content title * - @param string $body the jumbotron content body * - @param array $buttons the jumbotron buttons * - @param string $label the button label * - @param string $icon the icon to place before the label * - @param string $url the button url * - @param string $type one of the color modifier constants - defaults to self::TYPE_DEFAULT * - @param string $size one of the size modifier constants * - @param array $options the button html options * @param boolean $fullWidth whether this is a full width jumbotron without any corners - defaults to false * @param array $options html options for the jumbotron * * Example(s): * ~~~ * echo Html::jumbotron( * '<h1>Hello, world</h1><p>This is a simple jumbotron-style component for calling extra attention to featured content or information.</p>' * ); * echo Html::jumbotron( * [ * 'heading' => 'Hello, world!', * 'body' => 'This is a simple jumbotron-style component for calling extra attention to featured content or information.' * ] * ); * echo Html::jumbotron([ * 'heading' => 'Hello, world!', * 'body' => 'This is a simple jumbotron-style component for calling extra attention to featured content or information.', * 'buttons' => [ * [ * 'label' => 'Learn More', * 'icon' => 'book', * 'url' => '#', * 'type' => Html::TYPE_PRIMARY, * 'size' => Html::LARGE * ], * [ * 'label' => 'Contact Us', * 'icon' => 'phone', * 'url' => '#', * 'type' => Html::TYPE_DANGER, * 'size' => Html::LARGE * ] * ] * ]); * ~~~ * * @see http://getbootstrap.com/components/#jumbotron */ public static function jumbotron($content = [], $fullWidth = false, $options = []) { static::addCssClass($options, 'jumbotron'); if (is_string($content)) { $html = $content; } else { $html = isset($content['heading']) ? "<h1>" . $content['heading'] . "</h1>\n" : ''; $body = isset($content['body']) ? $content['body'] . "\n" : ''; if (substr(preg_replace('/\\s+/', '', $body), 0, 3) != '<p>') { $body = static::tag('p', $body); } $html .= $body; $buttons = ''; if (isset($content['buttons'])) { foreach ($content['buttons'] as $btn) { $label = (isset($btn['icon']) ? Html::icon($btn['icon']) . ' ' : '') . (isset($btn['label']) ? $btn['label'] : ''); $url = isset($btn['url']) ? $btn['url'] : '#'; $btnOptions = isset($btn['options']) ? $btn['options'] : []; $class = 'btn' . (isset($btn['type']) ? ' btn-' . $btn['type'] : ' btn-' . self::TYPE_DEFAULT); $class .= isset($btn['size']) ? ' btn-' . $btn['size'] : ''; static::addCssClass($btnOptions, $class); $buttons .= Html::a($label, $url, $btnOptions) . " "; } } $html .= Html::tag('p', $buttons); } if ($fullWidth) { return static::tag('div', static::tag('div', $html, ['class' => 'container']), $options); } else { return static::tag('div', $html, $options); } }
<?php use kartik\helpers\Html; /* @var $this yii\web\View */ /* @var $model common\models\News */ $this->title = $model->title; $this->params['breadcrumbs'][] = ['label' => 'Новости', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="panel panel-primary"> <div class="panel-heading"> <?php echo Html::tag('div', Html::tag('span', Yii::$app->formatter->asDate($model->date_create, 'dd.MM.yy'), ['class' => ' ']) . ' | ' . Html::tag('span', $model->category->name, ['class' => '']) . ' | ' . Html::tag('span', Html::icon('eye-open') . ' ' . $model->views), ['class' => '']); ?> </div> <div class="panel-body"> <?php $images = $model->getImages(); if ($images[0]['urlAlias'] != 'placeHolder' && $images[0]->isMain) { $image = $model->getImage(); // $sizes = $image->getSizesWhen('x300'); // echo Html::img($image->getUrl('x300'),['class' => 'center-block img-responsive','width'=>$sizes['width'], 'height'=>$sizes['height']]); echo Html::img($image->getUrl('x900'), ['class' => 'center-block img-responsive', 'width' => '100%']); } ?> </div> </div> <div class="news-view well"> <h1 class="text-center"><?php echo Html::encode($this->title); ?>
<?php /** * @author oba.ou */ use kartik\helpers\Html; use kartik\grid\GridView; /* @var $this yii\web\View */ /* @var $searchModel app\core\models\AdminConfigSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('app', 'Admin Configs'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="admin-config-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'option_key', 'option_value', 'option_text', 'create_time', 'creater', ['class' => 'yii\\grid\\ActionColumn']], 'pjax' => true, 'headerRowOptions' => ['class' => 'kartik-sheet-style'], 'filterRowOptions' => ['class' => 'kartik-sheet-style'], 'export' => ['fontAwesome' => true], 'condensed' => true, 'hover' => true, 'panel' => ['heading' => '', 'type' => GridView::TYPE_SUCCESS, 'before' => Html::a(Html::icon('plus') . Yii::t('app', 'Create'), ['create'], ['class' => 'btn btn-default']), 'after' => false]]); ?> </div>
<h3 class="panel-title">APIs to see</h3> </div> <ul class="recommendation-list list-group"> <?php foreach ($recommend['hits']['hits'] as $rec) { echo '<li class="list-group-item">'; echo Html::a($rec['fields']['name'][0], ['view', 'id' => $rec['_id']]); if (array_key_exists('inner_hits', $rec)) { $show_objects_to_fork = false; foreach ($rec['inner_hits'] as $innner_hitsRec) { if ($innner_hitsRec['hits']['total'] > 0) { $show_objects_to_fork = true; } } if ($show_objects_to_fork) { echo Html::a(Html::badge(Html::icon('chevron-right', ['class' => 'badge-success'])), null, ['class' => 'pull-right', 'id' => str_replace(' ', '', $rec['fields']['name'][0])]); } } echo '</li>'; } ?> </ul> </div> </div> <?php foreach ($recommend['hits']['hits'] as $key => $rec) { $recDivID = 'recommendation-object-block-' . str_replace(' ', '', $rec['fields']['name'][0]); if (array_key_exists('inner_hits', $rec)) { $objectsToShowNoDupsNames = []; $objectsToShowNoDupsIds = []; foreach ($rec['inner_hits'] as $innner_hitsRec) {
<h3>Properties</h3> <h4>Basic Properties</h4> <?php echo GridView::widget(['tableOptions' => ['class' => 'text-center'], 'headerRowOptions' => ['class' => 'text-center'], 'dataProvider' => $dataProviderBasic, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'name', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => 'description', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => 'type', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => 'createdBy.username', 'value' => function ($model, $key, $index, $widget) { return Html::a($model->createdBy->username, ['/profile/view', 'id' => $model->createdBy->id]); }, 'format' => 'raw', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => 'created_at', 'format' => 'date', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE]]]); ?> <?php if ($model->api0->name !== 'core') { ?> <p> <?php echo Html::a(Html::icon('plus', ['data' => ['toggle' => 'tooltip', 'placement' => 'right'], 'title' => 'Create Property']), ['properties/create', 'id' => $model->id], ['class' => 'btn btn-success']); ?> </p> <h4>New Properties</h4> <?php echo GridView::widget(['tableOptions' => ['class' => 'text-center'], 'headerRowOptions' => ['class' => 'text-center'], 'dataProvider' => $dataProviderExceptBasic, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'name', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => 'description', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => 'type', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => 'createdBy.username', 'value' => function ($model, $key, $index, $widget) { return Html::a($model->createdBy->username, ['/profile/view', 'id' => $model->createdBy->id]); }, 'format' => 'raw', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => 'created_at', 'format' => 'date', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE], ['class' => 'kartik\\grid\\ActionColumn', 'controller' => 'properties']]]); ?> <?php echo $this->render('_formMethods', ['model' => $model, 'methodDropdownList' => $methodDropdownList, 'cbsDropdownList' => $cbsDropdownList]); ?>
use yii\helpers\Html; use kartik\widgets\ActiveForm; use kartik\builder\Form; use kartik\datecontrol\DateControl; /** * @var yii\web\View $this * @var common\models\Events $model * @var yii\widgets\ActiveForm $form */ ?> <div class="events-form"> <?php $form = ActiveForm::begin(['id' => 'events-form', 'type' => ActiveForm::TYPE_HORIZONTAL, 'formConfig' => ['labelSpan' => 3]]); echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['user_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\Select2', 'options' => ['data' => \yii\helpers\ArrayHelper::map(\dektrium\user\models\User::find()->all(), 'id', 'username'), 'value' => $model->isNewRecord ? Yii::$app->user->identity->getId() : $model->user_id, 'options' => ['prompt' => '---请选择事件关联的用户---'], 'addon' => ['append' => ['content' => Html::button(\kartik\helpers\Html::icon('fa fa-user-plus', [], ''), ['class' => 'btn btn-primary', 'title' => '请选择事件关联的用户', 'data-toggle' => 'tooltip', 'data-placement' => 'bottom']), 'asButton' => true]], 'pluginOptions' => ['tags' => true, 'tokenSeparators' => [',', ' '], 'maximumInputLength' => 3]]], 'title' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter 事件标题...', 'maxlength' => 100]], 'data' => ['type' => Form::INPUT_TEXTAREA, 'options' => ['placeholder' => 'Enter 事件内容...', 'rows' => 6]], 'time' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter 触发事件次数...']]]]); ?> <div class="form-group"> <div class="col-sm-offset-3 col-sm-9"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Save') : Yii::t('app', 'Update'), ['id' => 'btn-modal-footer', 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button> </div> </div> <?php //echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Save') : Yii::t('app', 'Update'), ['id' => 'btn-modal-footer','class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ActiveForm::end(); ?>
} else { ?> <h1><?php echo Html::encode($this->title); ?> </h1> <?php } ?> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Html::icon('plus', ['data' => ['toggle' => 'tooltip', 'placement' => 'right'], 'title' => 'Create Apis']), ['create'], ['class' => 'btn btn-success']); ?> <?php echo Html::a('Read From Swagger', ['swagger/read', 'cbs' => false], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'name', 'value' => function ($model, $key, $index, $widget) { return Html::a($model->name, ['view', 'id' => $model->id]); }, 'format' => 'raw', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => 'description', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => 'version', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => 'createdBy.username', 'value' => function ($model, $key, $index, $widget) { return Html::a($model->createdBy->username, ['/profile/view', 'id' => $model->createdBy->id]); }, 'format' => 'raw', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => '', 'label' => 'Votes', 'value' => function ($model, $key, $index, $widget) { return Html::a($model->votes_up, ['apis/voteup', 'id' => $model->id], ['class' => 'glyphicon glyphicon-thumbs-up nounderline']) . ' / ' . Html::a($model->votes_down, ['apis/votedown', 'id' => $model->id], ['class' => 'glyphicon glyphicon-thumbs-down nounderline']); }, 'format' => 'raw', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => 'created_at', 'format' => 'date', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE], ['class' => 'kartik\\grid\\ActionColumn'], ['attribute' => '', 'label' => 'Swagger Page', 'value' => function ($model, $key, $index, $widget) { if ($model->published) {
<?php use kartik\helpers\Html; use kartik\grid\GridView; use app\helpers\Column; /* @var $this yii\web\View */ /* @var $searchModel app\models\BrandSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = '页面标题'; $this->params['breadcrumbs'][] = $this->title; Yii::$app->timeZone = 'UTC'; ?> <div class="brand-index"> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['value' => 'label', 'header' => '页面标题'], ['value' => 'nb_visits', 'header' => '唯一页面浏览量'], ['value' => 'bounce_rate', 'header' => '跳出率'], ['value' => 'avg_time_on_page', 'header' => '平均停留时间', 'format' => ['date', 'H:i:s']], ['value' => 'exit_rate', 'header' => '退出率'], ['value' => function ($data) { return yii::$app->formatter->asDecimal($data['avg_time_generation'], 2) . '秒'; }, 'header' => '平均生成时间']], 'pjax' => true, 'headerRowOptions' => ['class' => 'kartik-sheet-style'], 'filterRowOptions' => ['class' => 'kartik-sheet-style'], 'export' => ['fontAwesome' => true], 'condensed' => true, 'hover' => true, 'panel' => ['heading' => '', 'type' => GridView::TYPE_SUCCESS, 'before' => Html::a(Html::icon('plus') . Yii::t('app', 'Create'), ['create'], ['class' => 'btn btn-default']), 'after' => false]]); ?> </div>
$this->title = 'Обновление Сезона: ' . ' ' . $model->name; $this->params['breadcrumbs'][] = ['label' => 'Сезоны', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = 'Обновление'; ?> <div class="seasons-update"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_form', ['model' => $model]); $gridId = 'teams'; echo $this->render('_grid', ['model' => $model, 'dataProvider' => $dataProvider['teams'], 'filterModel' => $searchModel['teams'], 'gridOptions' => ['id' => $gridId, 'panel' => ['heading' => '<h4>Все команды</h4>', 'after' => Html::button(Html::icon('plus') . ' Добавить Команды в Сезон', ['class' => 'btn btn-success perform-action', 'data-season' => $model->id, 'data-grid-id' => $gridId])], 'columns' => [['class' => 'kartik\\grid\\CheckboxColumn'], ['label' => 'Логотип', 'format' => 'raw', 'value' => function ($data) { $images = $data->getImages(); if ($images[0]['urlAlias'] != 'placeHolder' && $images[0]->isMain) { $image = $data->getImage(); $sizes = $image->getSizesWhen('x25'); return Html::img($image->getUrl('x25'), ['alt' => 'yii2 - картинка в gridview', 'class' => 'img-responsive', 'width' => $sizes['width'], 'height' => $sizes['height']]); } }], 'name', ['class' => 'yii\\grid\\ActionColumn', 'urlCreator' => function ($action, $model) { $url = Url::to(['teams/' . $action, 'id' => $model->id]); return $url; }, 'template' => '{view} {update}']]]]); $gridId = 'sub-teams'; echo $this->render('_grid', ['model' => $model, 'dataProvider' => $dataProvider['seasonTeams'], 'gridOptions' => ['id' => $gridId, 'panel' => ['heading' => '<h4>Команды Сезона ' . $model->name . '</h4>', 'after' => false], 'columns' => [['attribute' => 'team.name', 'label' => 'Имя'], 'games', 'wins', 'draws', 'lesions', 'spectacles', 'goals_against', 'goals_scored', ['class' => 'yii\\grid\\ActionColumn', 'urlCreator' => function ($action, $model) { $url = Url::to(['season-details/' . $action, 'id' => $model->id]); return $url; }, 'template' => '{update}{delete-pjax}', 'buttons' => ['delete-pjax' => function ($url, $model) {
<?php use kartik\helpers\Html; use yii\widgets\ListView; use yii\widgets\Pjax; /* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Галерея'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="gallery-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php Pjax::begin(); ?> <div class="gallery-view-block"> <?php echo ListView::widget(['dataProvider' => $dataProvider, 'itemOptions' => ['class' => 'item'], 'layout' => '{items}{pager}', 'itemView' => function ($model, $key, $index, $widget) { return Html::a(Html::tag('div', Html::icon('folder-open')) . Html::tag('div', Html::encode($model->name), ['class' => 'gallery-view-box-name']), ['view', 'id' => $model->id], ['class' => 'gallery-view-box text-center']); }]); ?> </div> <?php Pjax::end(); ?> </div>
<div class="row"> <div class="col-xs-12 col-xs-offset-0 col-sm-offset-1 col-sm-10 teams-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Yii::t('app', 'Create', ['modelClass' => 'Teams']), ['create'], ['class' => 'btn btn-success']); ?> </p> <div class="row"> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pager' => ['firstPageLabel' => Html::icon('fast-backward'), 'prevPageLabel' => Html::icon('backward'), 'nextPageLabel' => Html::icon('forward'), 'lastPageLabel' => Html::icon('fast-forward')], 'options' => ['class' => 'col-xs-12 col-md-10 col-lg-7'], 'columns' => [['class' => 'yii\\grid\\SerialColumn', 'contentOptions' => ['align' => 'center', 'style' => 'vertical-align:middle'], 'headerOptions' => ['style' => 'text-align:center'], 'options' => ['class' => 'col-xs-1']], ['attribute' => 'id_team', 'options' => ['class' => 'col-xs-1'], 'contentOptions' => ['align' => 'center', 'style' => 'vertical-align:middle'], 'headerOptions' => ['style' => 'text-align:center']], ['attribute' => 'team_name', 'options' => ['class' => 'col-xs-4'], 'contentOptions' => ['style' => 'vertical-align:middle'], 'headerOptions' => ['style' => 'text-align:center'], 'value' => function ($model) { return Html::a($model->team_name, ['teams/update', 'id' => $model->id_team]); }, 'format' => 'raw'], ['attribute' => 'country', 'contentOptions' => ['align' => 'center', 'style' => 'vertical-align:middle'], 'headerOptions' => ['style' => 'text-align:center'], 'value' => function ($model) { return Html::a($model->country0->country, ['countries/update', 'id' => $model->country]); }, 'format' => 'raw', 'filter' => \app\models\countries\Countries::getCountriesArray(), 'filterInputOptions' => ['class' => 'form-control'], 'options' => ['class' => 'col-xs-3']], ['attribute' => 'team_logo', 'options' => ['class' => 'col-xs-2'], 'headerOptions' => ['style' => 'text-align:center'], 'filter' => false, 'format' => 'raw', 'value' => function ($model) { return Html::img($model->fileUrl, ['height' => '50', 'width' => '50']); }, 'contentOptions' => ['align' => 'center']], ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Удалить', 'template' => '{delete}', 'options' => ['class' => 'col-xs-1'], 'contentOptions' => ['align' => 'center', 'style' => 'vertical-align:middle'], 'headerOptions' => ['style' => 'text-align:center']]]]); ?> </div> </div> </div>
<?php use kartik\helpers\Html; use kartik\grid\GridView; /* @var $this yii\web\View */ /* @var $searchModel app\models\BrandSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('app', 'Brands'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="brand-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'sn', 'cn_name', 'en_name', 'py_name', 'initial', ['attribute' => 'show_type_name', 'vAlign' => 'middle', 'width' => '180px', 'value' => 'viewShowTypeName', 'filterType' => GridView::FILTER_SELECT2, 'filter' => \app\models\Brand::$showTypeNameArray, 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => '', 'style' => 'width:200px;'], 'format' => 'raw'], ['attribute' => 'imageLogo', 'format' => ['image', ['width' => 100]]], ['class' => 'yii\\grid\\ActionColumn']], 'pjax' => true, 'headerRowOptions' => ['class' => 'kartik-sheet-style'], 'filterRowOptions' => ['class' => 'kartik-sheet-style'], 'export' => ['fontAwesome' => true], 'condensed' => true, 'hover' => true, 'panel' => ['heading' => '', 'type' => GridView::TYPE_SUCCESS, 'before' => Html::a(Html::icon('plus') . Yii::t('app', 'Create'), ['create'], ['class' => 'btn btn-default']), 'after' => false]]); ?> </div>
<nav class="navbar navbar-static-top" role="navigation"> <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"> <span class="sr-only">Toggle navigation</span> </a> <div class="navbar-custom-menu"> <ul class="nav navbar-nav"> <li class="dropdown user user-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <?php echo \kartik\helpers\Html::icon('user'); ?> <span class="hidden-xs"><?php echo yii::$app->user->identity->username; ?> </span> </a> <ul class="dropdown-menu"> <!-- User image --> <li class="user-header"> <img src="/logo.jpg" class="img-circle"/> <p> <?php echo yii::$app->user->identity->username; ?> - <?php
$url = Url::to(['players/' . $action, 'id' => $model->id]); return $url; }, 'template' => '{view} {update}']]]]); $gridId = 'sub-players-home'; echo $this->render('_grid', ['model' => $model, 'dataProvider' => $dataProvider['gamePlayersHome'], 'gridOptions' => ['id' => $gridId, 'panel' => ['heading' => '<h4>Состав матча команды ' . $model->home->name . '</h4>', 'after' => false], 'columns' => [['attribute' => 'players.name', 'label' => 'Имя'], ['attribute' => 'players.surname', 'label' => 'Фамилия'], ['attribute' => 'players.number', 'label' => 'Номер'], ['class' => 'yii\\grid\\ActionColumn', 'urlCreator' => function ($action, $model) { $url = Url::to(['games-players/' . $action, 'id' => $model->id]); return $url; }, 'template' => '{delete-pjax}', 'buttons' => ['delete-pjax' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-trash"></span>', false, ['onclick' => 'deletePlayer(' . $model->id . ',\'/admin/games-players/delete-pjax\')', 'style' => 'cursor:pointer', 'title' => 'Удалить', 'data-pjax' => 1]); }]]]]]); ?> </div> <div class="col-md-6"> <?php $gridId = 'players-guest'; echo $this->render('_grid', ['model' => $model, 'dataProvider' => $dataProvider['playersGuest'], 'gridOptions' => ['id' => $gridId, 'panel' => ['heading' => '<h4>Все игроки команды ' . $model->guest->name . '</h4>', 'after' => Html::button(Html::icon('plus') . ' Добавить Игроков к Матчу', ['class' => 'btn btn-success perform-action', 'data-game' => $model->id, 'data-team' => $model->guest_id, 'data-grid-id' => $gridId])], 'columns' => [['class' => 'kartik\\grid\\CheckboxColumn'], 'surname', 'number', ['class' => 'yii\\grid\\ActionColumn', 'urlCreator' => function ($action, $model) { $url = Url::to(['players/' . $action, 'id' => $model->id]); return $url; }, 'template' => '{view} {update}']]]]); $gridId = 'sub-players-guest'; echo $this->render('_grid', ['model' => $model, 'dataProvider' => $dataProvider['gamePlayersGuest'], 'gridOptions' => ['id' => $gridId, 'panel' => ['heading' => '<h4>Состав матча команды ' . $model->guest->name . '</h4>', 'after' => false], 'columns' => [['attribute' => 'players.name', 'label' => 'Имя'], ['attribute' => 'players.surname', 'label' => 'Фамилия'], ['attribute' => 'players.number', 'label' => 'Номер'], ['class' => 'yii\\grid\\ActionColumn', 'urlCreator' => function ($action, $model) { $url = Url::to(['games-players/' . $action, 'id' => $model->id]); return $url; }, 'template' => '{delete-pjax}', 'buttons' => ['delete-pjax' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-trash"></span>', false, ['onclick' => 'deletePlayer(' . $model->id . ',\'/admin/games-players/delete-pjax\')', 'style' => 'cursor:pointer', 'title' => 'Удалить', 'data-pjax' => 1]); }]]]]]); ?> </div> </div> <div class="row"> <div class="col-md-6">
AdminAsset::register($this); ?> <div class="page-header"> <div class="pull-right"><?php echo AdminMenu::widget(['ui' => 'list', 'user' => null]); ?> </div> <h1><?php echo $this->title; ?> </h1> </div> <div id="batch-status-out"></div> <div style="width:200px;float:right;margin:-10px auto;"> <?php echo Select2::widget(['name' => 'batch-status', 'value' => '', 'data' => $m->getValidStatuses(), 'addon' => ['append' => ['content' => Html::button(Html::icon('saved'), ['class' => 'btn btn-default', 'id' => 'btn-batch-update', 'title' => Yii::t('user', 'Go!')]), 'asButton' => true]], 'options' => ['id' => 'batch-status', 'placeholder' => Yii::t('user', 'Batch update...')]]); ?> </div> <div class="clearfix"></div> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'panel' => false, 'export' => false, 'options' => ['id' => 'user-grid'], 'columns' => [['attribute' => 'id', 'width' => '80px'], ['attribute' => 'username', 'width' => '120px', 'format' => 'raw', 'content' => function ($model) { return $model->getUserLink(); }], 'email:email', ['attribute' => 'status', 'format' => 'raw', 'hAlign' => 'center', 'content' => function ($model) { return $model->getStatusHtml(); }, 'filter' => $m->getPrimaryStatuses(), 'width' => '140px', 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['options' => ['placeholder' => Yii::t('user', 'Select...')], 'pluginOptions' => ['allowClear' => true]]], ['attribute' => 'status_sec', 'format' => 'raw', 'hAlign' => 'center', 'content' => function ($model) { return $model->getStatusSecHtml(); }, 'filter' => $m->getSecondaryStatuses(), 'width' => '140px', 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['options' => ['placeholder' => Yii::t('user', 'Select...')], 'pluginOptions' => ['allowClear' => true]]], ['attribute' => 'last_login_ip', 'format' => 'raw', 'hAlign' => 'center', 'width' => '130px', 'value' => function ($model) { return $model->last_login_ip ? '<samp>' . $model->last_login_ip . '</samp>' : null; }], ['attribute' => 'last_login_on', 'format' => ['datetime', $m->datetimeDispFormat], 'hAlign' => 'center', 'filter' => false, 'mergeHeader' => true, 'value' => function ($model) { return Module::displayAttrTime($model, 'last_login_on'); }], ['attribute' => 'created_on', 'hAlign' => 'center', 'format' => 'date', 'label' => Yii::t('user', 'Member Since'), 'filter' => false, 'mergeHeader' => true], ['class' => 'kartik\\grid\\CheckboxColumn', 'checkboxOptions' => function ($model) {
\$('#mod_entity_type_add').on('click',opencentitytypemod); MODALJS; $this->registerJs($modalJS); ?> <div class="entity-form"> <?php $form = ActiveForm::begin(['id' => 'EntityCreateForm', 'action' => Url::to(['/entity/default/create'])]); ?> <div class="row"> <div class="col-md-12"> <?php echo $form->field($model, 'entity_type_id')->widget(Select2::classname(), ['data' => EntityType::pdEntityType(), 'options' => ['placeholder' => 'Entity Type...'], 'addon' => ['prepend' => ['content' => Html::icon('globe')], 'append' => ['content' => Html::button(Html::icon('plus'), ['class' => 'btn btn-default', 'id' => 'mod_entity_type_add', 'title' => 'add new entity', 'data-toggle' => 'tooltip', 'href' => Url::to(['/entity/entity-type/create'])]), 'asButton' => true]], 'pluginOptions' => ['allowClear' => true]]); ?> </div> </div> <div class="row"> <div class="col-md-6"> <?php echo $form->field($model, 'prename')->textInput(['maxlength' => 100]); ?> </div> <div class="col-md-6"> <?php echo $form->field($model, 'name')->textInput(['maxlength' => 140]); ?> </div>
?> <div class="row"> <div class="col-md-6"> <?php echo $this->render('_user', ['form' => $form, 'module' => $m, 'model' => $model]); ?> </div> </div> <?php } else { ?> <?php if (empty($profile->avatar)) { $delete = ''; } else { $delete = Html::a(Html::icon('trash'), [$m->actionSettings[Module::ACTION_AVATAR_DELETE], 'user' => $model->username], ['class' => 'btn btn-danger', 'data-method' => 'post', 'data-confirm' => Yii::t('user', 'Are you sure you want to delete your avatar?'), 'title' => Yii::t('user', 'Remove avatar image')]); } $widgetOptions = array_replace_recursive($m->profileSettings['widgetAvatar'], ['model' => $profile, 'attribute' => 'image', 'options' => ['accept' => 'image/*'], 'pluginOptions' => ['elErrorContainer' => '#user-avatar-errors', 'layoutTemplates' => ['main2' => "{preview} {$delete} {remove} {browse}"], 'defaultPreviewContent' => Html::img($profile->getAvatarUrl(), ['alt' => Yii::t('user', 'Avatar'), 'style' => 'width:180px;margin-bottom:20px'])]]); $css = ".user-avatar .file-input{display:table-cell;max-width:220px;text-align:center}\n" . ".user-avatar .file-preview-frame," . ".user-avatar .file-preview-frame:hover{margin:0;padding:0;border:none;box-shadow:none}"; $this->registerCss($css); ?> <?php if ($model->hasErrors() || $profile->hasErrors()) { ?> <?php echo $form->errorSummary([$model, $profile]); ?> <?php } ?> <div id="user-avatar-errors" style="display:none"></div>
public function afterSave($insert, $changedAttributes) { parent::afterSave($insert, $changedAttributes); \yii::$app->session->setFlash('success', ($insert ? Yii::t('app', 'Create') : Yii::t('app', 'Update')) . "成功" . Html::icon('smile-o')); }
<?php /** * @author oba.ou */ use kartik\helpers\Html; use yii\grid\GridView; use yii\widgets\Pjax; /* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ /* @var $searchModel mdm\admin\models\searchs\Assignment */ /* @var $usernameField string */ /* @var $extraColumns string[] */ $this->title = Yii::t('rbac-admin', 'Assignments'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="assignment-index"> <?php Pjax::begin(['enablePushState' => false]); $columns = [['class' => 'yii\\grid\\SerialColumn'], $usernameField, ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}', 'buttons' => ['view' => function ($url, $model, $key) { return Html::a(Html::icon('eye-open'), \yii\helpers\Url::to(['/rbac/assignment/view', 'id' => $model->getId()])); }]]]; echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => $columns]); Pjax::end(); ?> </div>