本文整理汇总了PHP中yii\bootstrap\Tabs类的典型用法代码示例。如果您正苦于以下问题:PHP Tabs类的具体用法?PHP Tabs怎么用?PHP Tabs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tabs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$label = Html::activeLabel($this->translations[0], $this->fieldName, ['class' => 'control-label']);
$tabs = Tabs::widget(['encodeLabels' => false, 'items' => $this->_tabItems, 'options' => ['class' => 'translation-tabs']]);
$content = Html::tag('div', $label . $tabs, ['class' => 'form-group nav-tabs-custom language-tabs']);
return $content;
}
示例2: run
public function run()
{
$items = [];
$preContent = '';
$isPost = \Yii::$app->request->isPost;
$defaultLang = Lang::getLang()->code;
foreach ($this->models as $k => $model) {
$preContent .= $isPost && !$model->validate() ? '<div class="alert alert-warning" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><h4>' . $model->langModel->title . '</h4>' . Html::errorSummary($model) . '</div>' : '';
$content = $this->view->render($this->template, ['model' => $model, 'k' => $k, 'form' => $this->form]);
$items[] = ['label' => $model->langModel->title, 'content' => $content, 'active' => $model->lang == $defaultLang];
}
return $preContent . Tabs::widget(['items' => $items]);
}
示例3: run
public function run()
{
TabsAsset::register($this->getView());
if (!$this->hasActiveTab() && !empty($this->items)) {
reset($this->items);
$this->items[key($this->items)]['active'] = true;
}
return parent::run();
}
示例4: renderModal
public static function renderModal()
{
$btnClose = Html::button(Html::tag('span', '×', ['aria-hidden' => 'true']), ['class' => 'close', 'data-dismiss' => 'modal', 'aria-label' => "Close"]);
$modalTitle = Html::tag('h4', Yii::t('filemanager', 'Media Gallery'), ['class' => 'modal-title', 'id' => 'fm-modal-label']);
$modalHeader = Html::tag('div', $btnClose . $modalTitle, ['class' => 'modal-header']);
$tab = Tabs::widget(['items' => [['label' => Yii::t('filemanager', 'Media Gallery'), 'linkOptions' => ['id' => 'fm-upload-tab', 'data-url' => \yii\helpers\Url::to(['/filemanager/files/upload-tab'])]], ['label' => Yii::t('filemanager', 'Library'), 'linkOptions' => ['id' => 'fm-library-tab', 'data-url' => \yii\helpers\Url::to(['/filemanager/files/library-tab'])]]]]);
$modalBody = Html::tag('div', $tab, ['class' => 'modal-body', 'style' => 'min-height: 560px;']);
$modalContent = Html::tag('div', $modalHeader . $modalBody, ['class' => 'modal-content']);
$modalHtml = Html::tag('div', Html::tag('div', $modalContent, ['class' => 'modal-dialog modal-lg', 'role' => 'document']), ['class' => 'fm-modal modal fade', 'id' => "fm-modal", 'tabindex' => "-1", 'role' => "dialog", 'aria-labelledby' => "fm-modal-label"]);
return $modalHtml;
}
示例5: testIds
/**
* Each tab should have a corresponding unique ID
*
* @see https://github.com/yiisoft/yii2/issues/6150
*/
public function testIds()
{
Tabs::$counter = 0;
$out = Tabs::widget(['items' => [['label' => 'Page1', 'content' => 'Page1'], ['label' => 'Dropdown1', 'items' => [['label' => 'Page2', 'content' => 'Page2'], ['label' => 'Page3', 'content' => 'Page3']]], ['label' => 'Dropdown2', 'items' => [['label' => 'Page4', 'content' => 'Page4'], ['label' => 'Page5', 'content' => 'Page5']]]]]);
$page1 = 'w0-tab0';
$page2 = 'w0-dd1-tab0';
$page3 = 'w0-dd1-tab1';
$page4 = 'w0-dd2-tab0';
$page5 = 'w0-dd2-tab1';
$shouldContain = ['w0', "#{$page1}", 'w1', "{$page2}", "{$page3}", 'w2', "#{$page4}", "#{$page5}", "id=\"{$page1}\"", "id=\"{$page2}\"", "id=\"{$page3}\"", "id=\"{$page4}\"", "id=\"{$page5}\""];
foreach ($shouldContain as $string) {
$this->assertContains($string, $out);
}
}
示例6: run
/**
* @inheritdoc
*/
public function run()
{
$items = [];
/** @var \DevGroup\Multilingual\Multilingual $multilingual */
$multilingual = Yii::$app->get('multilingual');
$languages = $multilingual->getAllLanguages();
foreach ($languages as $index => $language) {
$flag = $language->iso_639_1 === 'en' ? 'gb' : $language->iso_639_1;
$items[] = ['label' => '<span class="flag-icon flag-icon-' . $flag . '"></span> ' . $language->name, 'active' => $index === 0, 'content' => $this->renderFile($this->childView, ['model' => $this->model->getTranslation($language->id), 'form' => $this->form, 'language' => $language, 'language_id' => $language->id, 'attributePrefix' => "[{$language->id}]"])];
}
FlagIconAsset::register($this->view);
$items = ArrayHelper::merge($items, $this->additionalTabs);
return "<div class=\"nav-tabs-custom {$this->tagClass}\">" . Tabs::widget(['items' => $items, 'options' => $this->options, 'encodeLabels' => false]) . $this->footer . '</div>';
}
示例7: render
/**
* @inheritdoc
*/
public function render($params = [])
{
if (!empty($params['tabbed'])) {
$tabs = [];
foreach ($this->items as $item) {
if ($item instanceof Tab) {
$tabs[] = ['label' => $item->getLabel(), 'content' => $item->render($params)];
}
}
$output = Html::beginTag('div', ['class' => 'nav-tabs-custom']);
$output .= Tabs::widget(['items' => $tabs]);
$output .= Html::endTag('div');
return $output;
} else {
return parent::render($params);
}
}
示例8: getNavigation
protected function getNavigation()
{
$new = $this->model->hasNew();
switch ($new >= 1) {
case true:
$newMessage = $new . " new messages";
$newClass = "bg-success";
break;
default:
$newMessage = 'No new messages';
$newClass = "bg-transparent";
break;
}
$uniqid = uniqid();
$ret_val = Tabs::widget(['options' => ['id' => 'nitm-chat-widget' . $uniqid], 'encodeLabels' => false, 'items' => [['label' => 'Messages ' . Html::tag('span', $this->model->hasNew(), ['class' => 'badge']), 'active' => false, 'content' => Html::tag('div', '', ['id' => 'chat-widget-container' . $uniqid, 'role' => 'chatParent', 'id' => 'chat' . $uniqid, 'class' => 'chat col-md-4 col-lg-4', 'style' => 'z-index: 10000; position: fixed;top: 6px; right: 6px;bottom: 40px;overflow: hidden;padding: 0px;box-shadow: 2px 2px 15px #000; background-color: rgba(153,153,153,0.9);']), 'options' => ['id' => 'chat-widget-messages' . $uniqid], 'headerOptions' => ['id' => 'chat-widget-messages-tab' . $uniqid], 'linkOptions' => ['role' => 'visibility', 'data-type' => 'html', 'data-on' => '#chat-widget-messages' . $uniqid . ':hidden', 'data-id' => '#chat' . $uniqid, 'data-url' => \Yii::$app->urlManager->createUrl(['/reply/index/chat/0', '__format' => 'html', \nitm\widgets\models\Replies::FORM_PARAM => true]), 'id' => 'chat-widget-messages-link' . $uniqid]], ['label' => '', 'content' => '', 'active' => true, 'headerOptions' => ['class' => 'hidden']]]]);
if (isset($this->updateOptions['enable']) && $this->updateOptions['enable']) {
$ret_val .= Html::script("\$nitm.module('replies').initChatActivity(\"[role='chatParent']\", '" . $this->updateOptions['url'] . "', " . $this->updateOptions['interval'] . ")");
}
return $ret_val;
}
示例9: isset
<?php
use yii\helpers\Html;
use kartik\grid\GridView;
use yii\helpers\Url;
use yii\web\JsExpression;
use yii\bootstrap\Tabs;
echo Tabs::widget(['navType' => 'nav-pills', 'items' => [['label' => '<span class="glyphicon glyphicon-signal"></span>', 'encode' => false, 'content' => $this->render('_charts_executive_summary_by_sales_man', ['provider' => $provider, 'chart' => $chart, 'year' => $year, 'salesTitle' => isset($salesTitle) ? $salesTitle : 'All Sales']), 'active' => true], ['label' => '<span class="glyphicon glyphicon-list"></span>', 'encode' => false, 'content' => $this->render('_grid_executive_summary_by_sales_man', ['provider' => $provider, 'year' => $year, 'salesTitle' => isset($salesTitle) ? $salesTitle : 'All Sales'])]]]);
示例10:
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use app\modules\admin\Module;
use yii\bootstrap\Tabs;
use yii\helpers\StringHelper;
use app\modules\admin\components\widgets\AdminBoxWidget;
/* @var $this yii\web\View */
/* @var $model app\modules\main\models\Article */
$this->title = StringHelper::truncate($model->title, 50);
$this->params['breadcrumbs'][] = ['label' => Module::t('app', 'ADMIN'), 'url' => ['default/index']];
$this->params['breadcrumbs'][] = ['label' => Module::t('app', 'ADMIN_ARTICLE'), 'url' => ['index']];
$this->params['breadcrumbs'][] = StringHelper::truncate($model->title, 20);
?>
<div class="article-view">
<?php
AdminBoxWidget::begin(['type' => AdminBoxWidget::TYPE_PRIMARY, 'title' => Html::a('<i class="fa fa-pencil-square-o"></i>' . ' ' . Module::t('app', 'BUTTON_UPDATE'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary btn-xs']) . ' ' . Html::a('<i class="fa fa-trash-o"></i>' . ' ' . Module::t('app', 'BUTTON_DELETE'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger btn-xs', 'data' => ['confirm' => Module::t('app', 'CONFIRM_DELETE'), 'method' => 'post']]), 'left_tools' => 'Количество просмотров статьи: <strong>' . $model->click . '</strong>', 'footer' => '<strong>Статья созана:</strong> ' . Yii::$app->formatter->asDatetime($model->created_at) . '<br/>' . '<strong>Статья обновлена:</strong> ' . Yii::$app->formatter->asDatetime($model->updated_at) . '<br/>' . '<i class="fa fa-link"></i> <code>' . Yii::$app->urlManager->createAbsoluteUrl(['main/default/view', 'alt_title' => $model->alt_title]) . '</code>']);
?>
<?php
echo Tabs::widget(['items' => [['label' => 'Основная информация', 'content' => DetailView::widget(['model' => $model, 'attributes' => [['attribute' => 'category_id', 'format' => 'html', 'value' => Html::a($model->category->title, ['category/view', 'id' => $model->category->id], ['target' => 'blank'])], 'title', ['attribute' => 'alt_title', 'format' => 'html', 'value' => Html::decode('<strong>' . $model->alt_title . '</strong>') . '<br/>' . $model->getArticleUrl()], ['attribute' => 'author_id', 'format' => 'html', 'value' => Html::a($model->author->username, ['user/view', 'id' => $model->author->id], ['target' => 'blank'])], ['attribute' => 'status', 'format' => 'html', 'value' => $model->getArticleStatusSwitch()], 'tags', ['attribute' => 'anons_img', 'format' => 'html', 'value' => Html::img(Yii::$app->request->baseUrl . $model->anons_img, ['class' => 'img-responsive'])], 'anons:ntext', 'post:ntext']]), 'active' => true], ['label' => 'Рендер статьи', 'content' => $this->render('_article', ['model' => $model])]]]);
?>
<?php
AdminBoxWidget::end();
?>
</div>
示例11:
if (count($model->players_list) > 0) {
$tab_items[] = ['label' => Yii::t('app', 'Players'), 'content' => $this->render('_form-players', ['model' => $model, 'form' => $form])];
}
$tab_items[] = ['label' => Yii::t('app', 'Heroes'), 'content' => $this->render('_form-heroes', ['model' => $model, 'form' => $form])];
//var_dump($model->dotaEventPlayers);die;
if (count($model->dotaEventPlayers) > 0) {
$tab_items[] = ['label' => Yii::t('app', 'Players Stat'), 'content' => $this->render('_form-players-stat', ['model' => $model, 'form' => $form, 'dataProviderPlayersStat' => $dataProviderPlayersStat, 'last_update_info' => $last_update_info])];
}
if (count($model->dotaEventHeroes) > 0) {
$tab_items[] = ['label' => 'Heroes Stat', 'content' => $this->render('_form-heroes-stat', ['model' => $model, 'form' => $form, 'dataProvider' => $dataProviderHeroesStat, 'last_update_info' => $last_update_info])];
}
}
?>
<?php
echo Tabs::widget(['items' => $tab_items]);
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary', 'name' => 'task', 'value' => 'save']);
?>
<?php
echo Html::submitButton(Yii::t('app', 'Apply'), ['class' => 'btn btn-info', 'name' => 'task', 'value' => 'apply']);
?>
</div>
示例12: function
?>
<p class='pull-left'>
</p>
<p class='pull-right'>
<?php
echo \yii\helpers\Html::a('New City', ['city/create', 'City' => ['country_id' => $model->country_id]], ['class' => 'btn btn-default btn-xs']);
?>
<?php
echo \yii\helpers\Html::a('List All Cities', ['city/index'], ['class' => 'btn btn-default btn-xs']);
?>
</p><div class='clearfix'></div>
<?php
Pjax::begin();
echo \yii\grid\GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => $model->getCities(), 'pagination' => ['pageSize' => 10]]), 'columns' => ['city_id', 'city', ["class" => yii\grid\DataColumn::className(), "attribute" => "country_id", "value" => function ($model) {
if ($rel = $model->getCountry()->one()) {
return yii\helpers\Html::a($rel->country_id, ["country/view", "id" => $rel->country_id], ["data-pjax" => 0]);
} else {
return '';
}
}, "format" => "raw"], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {update}', 'buttons' => [], 'controller' => 'city']]]);
Pjax::end();
$this->endBlock();
?>
<?php
echo \yii\bootstrap\Tabs::widget(['encodeLabels' => false, 'items' => [['label' => '<span class="glyphicon glyphicon-asterisk"></span> Country', 'content' => $this->blocks['schmunk42\\sakila\\models\\Country'], 'active' => true], ['label' => '<small><span class="glyphicon glyphicon-paperclip"></span> Cities</small>', 'content' => $this->blocks['Cities'], 'active' => false]]]);
?>
</div>
示例13:
<div class="alert alert-success alert-dismissable" style="margin-top:1em;">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php
echo Html::encode($message);
?>
</div>
<?php
}
?>
<h3>
添加新文章分类
<div class="pull-right">
<?php
echo Html::a('返回文章分类列表', ['index'], ['class' => 'btn btn-sm btn-default']);
?>
</div>
</h3>
<?php
$form = ActiveForm::begin(['enableClientValidation' => false]);
$tab1 = $form->field($model, 'name')->textInput();
$tab1 .= $form->field($model, 'sort_order')->textInput();
echo Tabs::widget(['items' => [['label' => '主要内容', 'options' => ['style' => 'padding:1em;'], 'content' => $tab1, 'active' => true]]]);
echo Html::a('清 空', ['create'], ['class' => 'btn btn-default']);
?>
<?php
echo Html::submitButton('提 交', ['class' => 'btn btn-success']);
?>
<?php
ActiveForm::end();
示例14: round
<div class="list-group-item"><?php
echo Html::tag('dt', "Специальность");
echo Html::tag('dd', $student->group->speciality->name);
?>
</div>
</dl>
</div>
<?php
$this->endBlock('info');
$this->beginBlock('stat');
?>
<div class="list-group">
<?php
echo "<div class='list-group-item list-group-item-info'><span class='badge'>{$student->gpa}</span>Средний балл</div>";
foreach ($student->taskStat as $stat) {
if (Yii::$app->user->identity->student->tasksCount) {
$taskPercent = round($stat['value'] / $student->tasksCount * 100, 2);
} else {
$taskPercent = $student->tasksCount;
}
echo "<div class='list-group-item '><span class='badge'>{$stat['value']} ({$taskPercent}%)</span>{$stat['status']}</div>";
}
echo "<div class='list-group-item list-group-item-info'><span class='badge'>{$student->tasksCount}</span>Всего получено заданий</div>";
?>
</div>
<?php
$this->endBlock('stat');
echo Tabs::widget(['options' => ['class' => 'nav nav-pills nav-justified'], 'items' => [['label' => 'Личные данные', 'content' => $this->blocks['info']], ['label' => 'Статистика заданий', 'content' => $this->blocks['stat']]]]);
?>
示例15:
<?php
use yii\bootstrap\Tabs;
echo Tabs::widget(['items' => [['label' => 'One', 'content' => 'Anim pariatur cliche...', 'active' => true], ['label' => 'Two', 'content' => 'Anim pariatur cliche...', 'headerOptions' => [''], 'options' => ['id' => 'myveryownID']], ['label' => 'Dropdown', 'items' => [['label' => 'DropdownA', 'content' => 'DropdownA, Anim pariatur cliche...'], ['label' => 'DropdownB', 'content' => 'DropdownB, Anim pariatur cliche...']]]]]);