i() публичный статический Метод

Shortcut for icon() method
См. также: icon()
public static i ( string $name, array $options = [] ) : Icon
$name string
$options array
Результат rmrevin\yii\fontawesome\component\Icon
Пример #1
0
use backend\helpers\ArrayHelper;
use dosamigos\chartjs\ChartJs;
use rmrevin\yii\fontawesome\FontAwesome;
use yii\bootstrap\Html;
$this->title = "Просмотр опроса '{$quiz->name}'";
$this->params['breadcrumbs'][] = ['url' => '/quiz', 'label' => 'Опросы'];
$this->params['breadcrumbs'][] = 'Просмотр опроса';
$colors = \Colors\RandomColor::many(sizeof($quiz->answersWithCount), ['hue' => 'blue', 'luminosity' => 'light']);
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo Html::a(FontAwesome::i('arrow-left') . Html::tag('small', 'Назад'), ['/quiz/default/index'], ['class' => 'btn btn-app']);
?>
        <?php 
echo Html::a(FontAwesome::i('pencil') . Html::tag('small', 'Редактировать'), ['/quiz/edit/' . $quiz->id], ['class' => 'btn btn-app']);
?>
    </div>
    <div class="panel-body">
        <div class="col-xs-6">
            <?php 
echo ChartJs::widget(['type' => 'pie', 'data' => ['datasets' => [['data' => ArrayHelper::toPercents(array_values(ArrayHelper::getColumn($quiz->answersWithCount, 'count'))), 'label' => 'Результаты опроса', 'backgroundColor' => $colors]], 'labels' => array_values(ArrayHelper::getColumn($quiz->answersWithCount, 'text'))]]);
?>
        </div>
        <div class="col-xs-6">
            <?php 
echo ChartJs::widget(['type' => 'bar', 'data' => ['datasets' => [['data' => array_values(ArrayHelper::getColumn($quiz->answersWithCount, 'count')), 'label' => 'Результаты опроса', 'backgroundColor' => $colors]], 'labels' => array_values(ArrayHelper::getColumn($quiz->answersWithCount, 'text'))], 'options' => []]);
?>
        </div>
        <div class="col-xs-12">
            <hr>
Пример #2
0
            value: enabled ? false : true,
            key: button.closest('tr').attr('data-key')
        },
        success: function(data){
            button.toggleClass('btn-success')
                .toggleClass('btn-danger')
                .find('i')
                .toggleClass('fa-eye')
                .toggleClass('fa-eye-slash');
        } 
    });
});
JS;
$this->registerJs($js);
echo Html::tag('div', Html::tag('div', Html::tag('div', Html::a(FontAwesome::i('plus') . Html::tag('small', 'Добавить'), ['add'], ['class' => 'btn btn-app']), ['class' => 'row col-xs-12']) . Html::tag('div', '', ['class' => 'clearfix']), ['class' => 'panel-heading']) . Html::tag('div', GridView::widget(['dataProvider' => $ads, 'bordered' => false, 'summary' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'resizableColumns' => false, 'columns' => ['name', 'position', ['attribute' => 'createDate', 'value' => function ($model) {
    return \Yii::$app->formatter->asDatetime($model->createDate);
}], ['attribute' => 'enableDate', 'value' => function ($model) {
    if (empty($model->enableDate)) {
        return;
    }
    return \Yii::$app->formatter->asDatetime($model->enableDate);
}], ['attribute' => 'disableDate', 'value' => function ($model) {
    if (empty($model->enableDate)) {
        return;
    }
    return \Yii::$app->formatter->asDatetime($model->disableDate);
}], ['class' => \kartik\grid\ActionColumn::className(), 'template' => Html::tag('div', '{view} {enabled}', ['class' => 'btn-group btn-group-sm']), 'vAlign' => \kartik\grid\GridView::ALIGN_MIDDLE, 'width' => '90px', 'buttons' => ['view' => function ($key, $model) {
    return Html::a(FontAwesome::i('pencil'), ['edit/' . $model->id], ['class' => 'btn btn-sm btn-default']);
}, 'enabled' => function ($key, $model) {
    return Html::button(FontAwesome::i($model->state ? 'eye' : 'eye-slash'), ['class' => 'btn toggleEnabled btn-sm btn-' . ($model->state ? 'success' : 'danger')]);
}]]]]), ['class' => 'panel-body']) . Html::tag('div', '', ['class' => 'clearfix']), ['class' => 'panel panel-default']);
Пример #3
0
    }).on('click', '.toggleDeleted', function(){
        if(toggleAttribute('deleted', $(this).closest('tr').attr('data-key'), $(this).hasClass('btn-success'))){
            $(this).toggleClass('btn-success')
                .toggleClass('btn-danger')
                .find('i')
                .toggleClass('fa-trash')
                .toggleClass('fa-trash-o');
        }
    });
JS;
$this->registerJs($js);
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo Html::a(FontAwesome::i('plus') . Html::tag('small', 'Добавить'), Url::toRoute(['/news/new']), ['class' => 'btn btn-app']), Html::button(FontAwesome::i('eye') . Html::tag('small', 'Опубликовать'), ['class' => 'btn publishChecked btn-app']), Html::button(FontAwesome::i('eye-slash') . Html::tag('small', 'Скрыть'), ['class' => 'btn unpublishChecked btn-app']), Html::button(FontAwesome::i('trash') . Html::tag('small', 'Удалить'), ['class' => 'btn deleteChecked btn-app']), Html::button(FontAwesome::i('trash-o') . Html::tag('small', 'Восстановить'), ['class' => 'btn restoreChecked btn-app']);
?>
    </div>
    <div class="panel-body">
        <?php 
echo GridView::widget(['dataProvider' => $newsDataProvider, 'bordered' => false, 'export' => false, 'summary' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'resizableColumns' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'id' => 'newsGrid', 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'tableOptions' => ['class' => 'gridWithLongText'], 'columns' => [['class' => \yii\grid\CheckboxColumn::className(), 'options' => ['style' => 'width: 30px'], 'contentOptions' => ['style' => 'vertical-align: middle']], ['attribute' => 'title', 'format' => 'html', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return Html::a($model->title, ['/news/show/' . $model->id], ['class' => 'longText']);
}], ['attribute' => 'categoryID', 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '180px', 'value' => function ($model) {
    if (empty($model)) {
        return '';
    }
    return $model->category->title;
}], ['attribute' => 'publishDate', 'label' => 'Опубликовано', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '120px', 'value' => function ($model) {
    return \Yii::$app->formatter->asDate($model->publishDate);
}], ['attribute' => 'hits', 'width' => '90px', 'format' => 'raw', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    $views = $model->hits;
Пример #4
0
    $this->title = 'Добавление новости';
    $breadcrumb = $this->title;
}
$this->params['breadcrumbs'][] = ['url' => '/news', 'label' => 'Новости'];
$this->params['breadcrumbs'][] = $breadcrumb;
echo Html::beginTag('div', ['class' => 'col-xs-12']);
if (\Yii::$app->session->getFlash('saved', false)) {
    echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('saved'), 'options' => ['class' => 'alert alert-success alert-dismissible']]);
} else {
    if (\Yii::$app->session->getFlash('error', false)) {
        echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('error'), 'options' => ['class' => 'alert alert-danger alert-dismissible row col-xs-10 col-xs-offset-1']]);
    }
}
echo Html::endTag('div');
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL]);
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo $this->render('_news_header_buttons', ['model' => $model, 'mode' => $mode]);
?>
    </div>
    <div class="panel-body">
        <?php 
echo Html::tag('div', $form->field($model, 'title') . $form->field($model, 'category')->widget(\kartik\select2\Select2::className(), ['data' => ArrayHelper::map(Category::find()->where(['deleted' => 0])->asArray()->all(), 'id', 'title')]) . $form->field($model, 'link')->hint('Оставьте поле пустым, чтобы ссылку сгенерировала система') . $form->field($model, 'text')->widget(\yii\imperavi\Widget::className(), ['id' => 'textEditor', 'options' => ['lang' => 'ru', 'imageUpload' => '/news/upload', 'imageManagerJson' => '/news/uploaded'], 'plugins' => ['imagemanager', 'video', 'border']]) . $form->field($model, 'metaDescription')->textarea() . $form->field($model, 'metaKeywords') . $form->field($model, 'language')->dropDownList($model->getLanguages()) . $form->field($model, 'publishDate')->widget(\kartik\datetime\DateTimePicker::className(), ['pluginOptions' => ['format' => 'dd.mm.yyyy HH:ii']]) . $form->field($model, 'genre')->dropDownList($model->getGenres()) . $form->field($model, 'author'), ['class' => 'col-xs-12']), $form->field($model, 'published', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), $form->field($model, 'favorite', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), $form->field($model, 'deleted', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), $form->field($model, 'moderatedComments', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), Html::tag('div', Html::button(FontAwesome::i('save') . Html::tag('small', 'сохранить'), ['class' => 'btn btn-app btn-success', 'type' => 'submit']), ['class' => 'text-center']);
?>
    </div>
</div>
<?php 
$form->end();
echo Html::tag('div', '', ['class' => 'clearfix']);
Пример #5
0
/** @var \backend\modules\quiz\models\QuizForm $model */
use rmrevin\yii\fontawesome\FontAwesome;
use yii\bootstrap\Html;
$this->title = 'Редактирование опроса';
$this->params['breadcrumbs'][] = ['url' => ['/quiz/default/index'], 'label' => 'Опросы'];
$this->params['breadcrumbs'][] = ['url' => ['/quiz/view/' . $model->id], 'label' => $model->name];
$this->params['breadcrumbs'][] = $this->title;
$js = <<<'JS'
$("body").on('click', '.saveBtn', function(){
    $("#edit-quiz-form").submit();
});
JS;
$this->registerJs($js);
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo Html::a(FontAwesome::i('arrow-left') . Html::tag('small', 'Назад'), ['/quiz/view/' . $model->id], ['class' => 'btn btn-app']);
?>
        <?php 
echo Html::button(FontAwesome::i('save') . Html::tag('small', 'Сохранить'), ['class' => 'btn btn-app saveBtn']);
?>
    </div>
    <div class="panel-body">
        <div class="col-xs-8 col-xs-offset-2">
            <?php 
echo $this->render('editForm', ['model' => $model]);
?>
        </div>
    </div>
</div>
Пример #6
0
    
    switch($(this).attr('data-attribute')){
        case 'published':
            html = newValue != 1 ? '<i class="fa fa-eye-slash"></i><small>спрятано</small>' : '<i class="fa fa-eye"></i><small>опубликовано</small>';
            break;
        case 'favorite':
            html = newValue != 1 ? '<i class="fa fa-star-o"></i><small>в избранное</small>' : '<i class="fa fa-star"></i><small>в избранном</small>';
            break;
        case 'deleted':
            html = newValue != 1 ? '<i class="fa fa-trash-o"></i><small>удалить</small>' : '<i class="fa fa-trash"></i><small>удалено</small>';
            break;
        case 'moderatedComments':
            html = newValue != 1 ? '<i class="fa fa-comments"></i><small>комментируемо</small>' : '<i class="fa fa-ban"></i><small>модерируемо</small>';
            break;
    }

    $(this).html(html);
});
JS;
$buttons = [];
if (isset($mode)) {
    if ($mode == 'edit') {
        $buttons[] = Html::a(FontAwesome::i('arrow-left') . Html::tag('small', 'назад'), Url::to(['/news/show/' . $model->id], true), ['class' => 'btn btn-app']);
    }
    $this->registerJs($buttonsJs);
    $buttons = array_merge($buttons, [Html::button(FontAwesome::i('save') . Html::tag('small', 'сохранить'), ['class' => 'btn btn-app btn-success', 'type' => 'submit']), Html::button(FontAwesome::i($model->published == 1 ? 'eye' : 'eye-slash') . Html::tag('small', $model->published == 1 ? 'опубликовано' : 'спрятано'), ['class' => 'btn btn-app apps-buttons toggleButtons', 'data-attribute' => 'published']), Html::button(FontAwesome::i($model->favorite == 1 ? 'star' : 'star-o') . Html::tag('small', $model->favorite == 1 ? 'в избранном' : 'в избранное'), ['class' => 'btn btn-app apps-buttons toggleButtons', 'data-attribute' => 'favorite']), Html::button(FontAwesome::i($model->deleted == 1 ? 'trash' : 'trash-o') . Html::tag('small', $model->deleted == 1 ? 'удалено' : 'удалить'), ['class' => 'btn btn-app apps-buttons toggleButtons', 'data-attribute' => 'deleted']), Html::button(FontAwesome::i($model->moderatedComments == 1 ? 'ban' : 'comments') . Html::tag('small', $model->moderatedComments == 1 ? 'модерируемо' : 'комментируемо'), ['class' => 'btn btn-app apps-buttons toggleButtons', 'data-attribute' => 'moderatedComments'])]);
} else {
    $this->registerJs($js);
    $buttons = array_merge($buttons, [Html::a(FontAwesome::i('edit') . Html::tag('small', 'редактировать'), Url::toRoute(['/news/show/' . $model->id, 'act' => 'edit'], true), ['class' => 'btn btn-app']), Html::a(FontAwesome::i('globe') . Html::tag('small', 'на сайте'), \Yii::$app->params['frontend'] . '/news/' . $model->id . '-adminka_see_news', ['class' => 'btn btn-app', 'target' => '_blank']), Html::button(FontAwesome::i($model->published == 1 ? 'eye' : 'eye-slash') . Html::tag('small', $model->published == 1 ? 'опубликовано' : 'спрятано'), ['class' => 'btn btn-app apps-buttons', 'data-attribute' => 'published', 'data-attribute-newsID' => $model->id]), Html::button(FontAwesome::i($model->favorite == 1 ? 'star' : 'star-o') . Html::tag('small', $model->favorite == 1 ? 'в избранном' : 'в избранное'), ['class' => 'btn btn-app apps-buttons', 'data-attribute' => 'favorite', 'data-attribute-newsID' => $model->id]), Html::button(FontAwesome::i($model->deleted == 1 ? 'trash' : 'trash-o') . Html::tag('small', $model->deleted == 1 ? 'удалено' : 'удалить'), ['class' => 'btn btn-app apps-buttons', 'data-attribute' => 'deleted', 'data-attribute-newsID' => $model->id]), Html::button(FontAwesome::i($model->moderatedComments == 1 ? 'ban' : 'comments') . Html::tag('small', $model->moderatedComments == 1 ? 'модерируемо' : 'комментируемо'), ['class' => 'btn btn-app apps-buttons', 'data-attribute' => 'moderatedComments', 'data-attribute-newsID' => $model->id])]);
}
echo implode($buttons);
Пример #7
0
}).on('click', '.toggleDeleted', function(){
    if(toggleAttribute('deleted', $(this).closest('tr').attr('data-key'), $(this).hasClass('btn-success'))){
        $(this).toggleClass('btn-success')
            .toggleClass('btn-danger')
            .find('i')
            .toggleClass('fa-trash')
            .toggleClass('fa-trash-o');
    }
});
JS;
$this->registerJs($js);
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo Html::a(FontAwesome::i('plus') . Html::tag('small', 'Добавить'), Url::toRoute(['/categories/add']), ['class' => 'btn btn-app']), Html::button(FontAwesome::i('eye') . Html::tag('small', 'Опубликовать'), ['class' => 'btn publishChecked btn-app']), Html::button(FontAwesome::i('eye-slash') . Html::tag('small', 'Скрыть'), ['class' => 'btn unpublishChecked btn-app']), Html::button(FontAwesome::i('trash') . Html::tag('small', 'Удалить'), ['class' => 'btn deleteChecked btn-app']);
?>
    </div>
    <div class="panel-body">
        <?php 
echo \kartik\grid\GridView::widget(['dataProvider' => $dataProvider, 'bordered' => false, 'summary' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'export' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'containerOptions' => ['class' => 'box-body table-responsive no-padding', 'style' => 'padding: 0'], 'resizableColumns' => false, 'columns' => [['class' => \kartik\grid\CheckboxColumn::className()], 'title', ['attribute' => 'parent', 'value' => function ($model) {
    if (empty($model->parentCategory)) {
        return ' ';
    }
    return $model->parentCategory->title;
}], ['attribute' => 'created', 'value' => function ($model) {
    return \Yii::$app->formatter->asDatetime($model->created);
}], ['label' => 'Создатель'], ['class' => \kartik\grid\ActionColumn::className(), 'width' => '120px', 'template' => Html::tag('div', '{edit}{publish}{delete}', ['class' => 'btn-group btn-group-sm']), 'buttons' => ['edit' => function ($key, $model) {
    return Html::a(FA::i('pencil'), '/categories/edit/' . $model->id, ['class' => 'btn btn-default']);
}, 'publish' => function ($key, $model) {
    return Html::button(FA::i('eye' . ($model->published ? '' : '-slash')), ['class' => 'btn togglePublished btn-' . ($model->published ? 'success' : 'danger')]);
Пример #8
0
    }).on('click', '.toggleFavorite', function(){
        if(toggleAttribute('favorite', $(this).closest('tr').attr('data-key'), $(this).find('.fa').hasClass('fa-star-o'))){
            $(this).toggleClass('btn-success')
                .toggleClass('btn-danger')
                .find('i')
                .toggleClass('fa-star')
                .toggleClass('fa-star-o');
        }
    });
JS;
$this->registerJs($js);
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo Html::button(FontAwesome::i('eye') . Html::tag('small', 'Опубликовать'), ['class' => 'btn publishChecked btn-app']), Html::button(FontAwesome::i('eye-slash') . Html::tag('small', 'Скрыть'), ['class' => 'btn unpublishChecked btn-app']), Html::button(FontAwesome::i('trash') . Html::tag('small', 'Удалить'), ['class' => 'btn deleteChecked btn-app']), Html::button(FontAwesome::i('star-o') . Html::tag('small', 'Из избранного'), ['class' => 'btn unfavoriteChecked btn-app']);
?>
    </div>
    <div class="panel-body">
        <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'bordered' => false, 'export' => false, 'summary' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'resizableColumns' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'id' => 'newsGrid', 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'tableOptions' => ['class' => 'gridWithLongText'], 'columns' => [['class' => \yii\grid\CheckboxColumn::className(), 'options' => ['style' => 'width: 30px'], 'contentOptions' => ['style' => 'vertical-align: middle']], ['attribute' => 'title', 'format' => 'html', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return Html::a($model->title, ['/news/show/' . $model->id], ['class' => 'longText']);
}], ['attribute' => 'categoryID', 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '180px', 'value' => function ($model) {
    if (empty($model)) {
        return '';
    }
    return $model->category->title;
}], ['attribute' => 'publishDate', 'label' => 'Опубликовано', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '120px', 'value' => function ($model) {
    return \Yii::$app->formatter->asDate($model->publishDate);
}], ['attribute' => 'hits', 'width' => '90px', 'format' => 'raw', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    $views = $model->hits;
Пример #9
0
                .toggleClass('fa-eye-slash');
        } 
    });
});
JS;
$this->registerJs($js);
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo Html::a(FontAwesome::i('plus') . Html::tag('small', 'Добавить'), ['/quiz/default/add'], ['class' => 'btn btn-app']);
?>
    </div>
    <div class="panel-body" style="padding: 0">
        <?php 
echo \kartik\grid\GridView::widget(['dataProvider' => $dataProvider, 'bordered' => false, 'resizableColumns' => false, 'export' => false, 'summary' => false, 'tableOptions' => ['class' => 'gridWithLongText'], 'columns' => [['attribute' => 'name', 'format' => 'raw', 'vAlign' => \kartik\grid\GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return Html::a($model->name, '/quiz/view/' . $model->id, ['class' => 'longText', 'title' => $model->name]);
}], ['width' => '60px', 'label' => 'Голосов', 'vAlign' => \kartik\grid\GridView::ALIGN_MIDDLE, 'hAlign' => \kartik\grid\GridView::ALIGN_CENTER, 'value' => function ($model) {
    return count($model->votes);
}], ['attribute' => 'dateStart', 'contentOptions' => ['style' => 'white-space: normal'], 'width' => '120px', 'vAlign' => \kartik\grid\GridView::ALIGN_MIDDLE, 'hAlign' => \kartik\grid\GridView::ALIGN_CENTER, 'value' => function ($model) {
    return \Yii::$app->formatter->asDatetime($model->dateStart);
}], ['attribute' => 'dateEnd', 'contentOptions' => ['style' => 'white-space: normal'], 'width' => '120px', 'vAlign' => \kartik\grid\GridView::ALIGN_MIDDLE, 'hAlign' => \kartik\grid\GridView::ALIGN_CENTER, 'value' => function ($model) {
    return \Yii::$app->formatter->asDatetime($model->dateEnd);
}], ['class' => \kartik\grid\ActionColumn::className(), 'vAlign' => \kartik\grid\GridView::ALIGN_MIDDLE, 'buttons' => ['edit' => function ($key, $model) {
    return Html::a(FontAwesome::i('pencil'), ['edit/' . $model->id], ['class' => 'btn btn-sm btn-default']);
}, 'published' => function ($key, $model) {
    return Html::button(FontAwesome::i($model->published ? 'eye' : 'eye-slash'), ['class' => 'btn togglePublished btn-sm btn-' . ($model->published ? 'success' : 'danger')]);
}], 'width' => '90px', 'template' => Html::tag('div', '{edit} {published}', ['class' => 'btn-group btn-group-sm'])]]]);
?>
    </div>
</div>