本文整理汇总了PHP中yii\bootstrap\Tabs::widget方法的典型用法代码示例。如果您正苦于以下问题:PHP Tabs::widget方法的具体用法?PHP Tabs::widget怎么用?PHP Tabs::widget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\bootstrap\Tabs
的用法示例。
在下文中一共展示了Tabs::widget方法的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: 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;
}
示例4: 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);
}
}
示例5: 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>';
}
示例6: 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);
}
}
示例7: 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;
}
示例8: implode
$fields[] = $form->field($model, 'stock_qty')->textInput();
$fields[] = $form->field($model, 'min_sale_qty')->textInput();
$fields[] = $form->field($model, 'max_sale_qty')->textInput();
$fields[] = $form->field($model, 'weight')->textInput(['maxlength' => 10]);
$fields[] = $form->field($model, 'shipping_fee')->textInput(['maxlength' => 10]);
$fields[] = $form->field($model, 'is_free_shipping')->checkbox();
$fieldGroups[] = ['label' => 'Price & Stock', 'content' => implode('', $fields)];
$fields = [];
$fields[] = $form->field($model, 'pictures')->widget(InputFile::className(), ['multiple' => true, 'template' => '<div class="input-group">{input}<span class="input-group-btn">{button}</span></div>', 'options' => ['class' => 'form-control'], 'buttonOptions' => ['class' => 'btn btn-default']]);
$categories = \kiwi\Kiwi::getCategory()->find()->all();
$categories = ArrayHelper::map($categories, 'id', 'name');
$fields[] = $form->field($model, 'categoryIds')->widget(Select2::classname(), ['data' => $categories, 'language' => 'en', 'options' => ['placeholder' => 'Select a state ...'], 'options' => ['multiple' => true]]);
$tags = \kiwi\Kiwi::getTag()->find()->all();
$tags = ArrayHelper::map($tags, 'id', 'name');
$fields[] = $form->field($model, 'tagIds')->widget(Select2::classname(), ['data' => $tags, 'language' => 'en', 'options' => ['placeholder' => 'Select a state ...'], 'options' => ['multiple' => true]]);
$fieldGroups[] = ['label' => 'Picture & Category & Tag', 'content' => implode('', $fields)];
echo Tabs::widget(['items' => $fieldGroups]);
?>
<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']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
示例9: 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>
示例10:
<?php
// namespace app\controllers;
// use Yii;
use app\models\Users;
use app\assets\SiteAsset;
use yii\bootstrap\Tabs;
//SiteAsset::register($this);
//$this->registerJsFile('/fingers_server/js/views/websocket.js', ['depends' => [\yii\web\JqueryAsset::className()]]);
//$this->registerCssFile('/finger_cod/css/site.css');
/* @var $this yii\web\View */
$this->title = 'My Yii Application';
?>
<div class="view">
Главная страница
</div>
<?php
echo Tabs::widget(['items' => [['label' => 'Yii2', 'content' => '<h2>Фреймворк Yii 2 - один из самых быстрых, безопасных и "крутых" php-фреймворков.</h2>', 'active' => true], ['label' => 'jQuery', 'content' => '<h2>jQuery - один из самых популярных JavaScript фреймворков, который работает с объектами DOM.</h2>'], ['label' => 'Bootstrap', 'content' => '<h2>Twitter Bootstrap - супер фреймворк, объединяющий в себе html, css, и JavaScript для для верстки веб-интерфейсов и страниц.</h2>', 'headerOptions' => ['id' => 'headerOptions'], 'options' => ['id' => 'options']], ['label' => 'Еще табы', 'content' => '<h2>Вы можете добавить любое количество табов. Просто опишите их структуру в массиве.</h2>'], ['label' => 'Выпадающий список табов', 'items' => [['label' => 'Первый таб из выпадающего списка', 'content' => '<h2>Обновите свои познания в Yii 2 and Twitter Bootstrap. Все возможнсти уже обернуты в удобные интерфейсы.</h2>'], ['label' => 'Второй таб из выпадающего списка', 'content' => '<h2>Один в поле не воин, а двое - уже компания.</h2>'], ['label' => 'Это третий таб из выпадающего списка', 'content' => '<h2>Третий не лишний!</h2>']]]]]);
示例11:
<?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...']]]]]);
示例12:
<?php
use yii\helpers\Html;
use yii\bootstrap\Tabs;
use app\widgets\ActiveForm;
use app\widgets\ButtonsContatiner;
$form = ActiveForm::begin(['id' => 'partner_form', 'options' => ['enctype' => 'multipart/form-data']]);
$tab_items = [['label' => __('General'), 'content' => $this->render('form_general', ['form' => $form, 'model' => $model]), 'active' => true], ['label' => __('Address'), 'content' => $this->render('form_address', ['form' => $form, 'model' => $model])], ['label' => __('Images'), 'content' => $this->render('form_images', ['form' => $form, 'model' => $model])]];
if (!$model->isNewRecord) {
$tab_items[] = ['label' => __('Visits'), 'content' => $this->render('/visit/components/grid', ['dataProvider' => $extra['visitsDataProvider'], 'partnerId' => $model->id])];
$tab_items[] = ['label' => __('Donates'), 'content' => $this->render('/donate/components/grid', ['dataProvider' => $extra['donatesDataProvider'], 'partnerId' => $model->id])];
$tab_items[] = ['label' => __('Tasks'), 'content' => $this->render('/task/components/grid', ['dataProvider' => $extra['tasksDataProvider'], 'partnerId' => $model->id])];
$tab_items[] = ['label' => __('Contact persons'), 'headerOptions' => ['class' => 'app-dtoggle-type-n1', 'style' => $model->type == 3 ? 'display: none;' : ''], 'content' => $this->render('/partner/components/grid', ['dataProvider' => $extra['contactsDataProvider'], 'partnerId' => $model->id])];
}
echo Tabs::widget(['options' => ['id' => 'partner_tabs', 'class' => 'app-tabs-save'], 'items' => $tab_items]);
// echo ButtonsContatiner::widget(['model' => $model]);
ActiveForm::end();
示例13:
?>
<?php
echo $form->field($model, 'attribute_id')->hiddenInput()->label(false);
?>
<?php
$language_items = [];
foreach ($languages as $key => $language) {
$field = $form->field($model, "title_{$language->url}")->textInput(['maxlength' => true])->label('Title');
if ($languageDefault->url == $language->url) {
$field = $form->field($model, "title")->textInput(['maxlength' => true]);
}
$language_items[] = ['label' => Yii::t('backend', $language->name), 'content' => "<p>{$field}</p>", 'active' => $key == 0];
}
echo Tabs::widget(['items' => $language_items]);
?>
<?php
echo $form->field($model, 'order')->textInput();
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();
?>
示例14:
?>
<p>
<?php
echo $form->field($model, 'actor_id')->dropDownList(\yii\helpers\ArrayHelper::map(schmunk42\sakila\models\Actor::find()->all(), 'actor_id', 'label'), ['prompt' => 'Choose...']);
?>
<?php
echo $form->field($model, 'film_id')->dropDownList(\yii\helpers\ArrayHelper::map(schmunk42\sakila\models\Film::find()->all(), 'film_id', 'title'), ['prompt' => 'Choose...']);
?>
</p>
<?php
$this->endBlock();
?>
<?php
echo \yii\bootstrap\Tabs::widget(['encodeLabels' => false, 'items' => [['label' => 'FilmActor', 'content' => $this->blocks['main'], 'active' => true]]]);
?>
<hr/>
<?php
echo Html::submitButton('<span class="glyphicon glyphicon-check"></span> ' . ($model->isNewRecord ? 'Create' : 'Save'), ['class' => $model->isNewRecord ? 'btn btn-primary' : 'btn btn-primary']);
?>
<?php
ActiveForm::end();
?>
</div>
</div>
示例15:
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>