当前位置: 首页>>代码示例>>PHP>>正文


PHP ButtonDropdown::widget方法代码示例

本文整理汇总了PHP中yii\bootstrap\ButtonDropdown::widget方法的典型用法代码示例。如果您正苦于以下问题:PHP ButtonDropdown::widget方法的具体用法?PHP ButtonDropdown::widget怎么用?PHP ButtonDropdown::widget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\bootstrap\ButtonDropdown的用法示例。


在下文中一共展示了ButtonDropdown::widget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testContainerOptions

 public function testContainerOptions()
 {
     $containerClass = "dropup";
     ButtonDropdown::$counter = 0;
     $out = ButtonDropdown::widget(['containerOptions' => ['class' => $containerClass], 'label' => 'Action', 'dropdown' => ['items' => [['label' => 'DropdownA', 'url' => '/'], ['label' => 'DropdownB', 'url' => '#']]]]);
     $this->assertContains("{$containerClass} btn-group", $out);
 }
开发者ID:glowdan,项目名称:yii2,代码行数:7,代码来源:ButtonDropdownTest.php

示例2: renderPerPageSelector

 public function renderPerPageSelector()
 {
     $page_count = $this->pagination->getPageCount();
     if ($page_count < 2 && $this->hideOnSinglePage) {
         return '';
     }
     $current_page_size = $this->pagination->getPageSize();
     list($min_page_size, $max_page_size) = $this->pagination->pageSizeLimit;
     if ($min_page_size < 10) {
         $min_page_size = 10;
     }
     $items = [];
     $_max_page_size = $max_page_size > 50 ? 50 : $max_page_size;
     $per_page_items = range($min_page_size, $_max_page_size, 10);
     if ($max_page_size >= 100) {
         $_max_page_size = $max_page_size > 500 ? 500 : $max_page_size;
         $_per_page_items = range(100, $_max_page_size, 100);
         $per_page_items = array_merge($per_page_items, $_per_page_items);
     }
     if ($max_page_size >= 1000) {
         $_per_page_items = range(1000, $max_page_size, 1000);
         $per_page_items = array_merge($per_page_items, $_per_page_items);
     }
     foreach ($per_page_items as $per_page_item) {
         $items[] = ['label' => $per_page_item, 'url' => $this->pagination->createUrl(0, $per_page_item), 'active' => $per_page_item == $current_page_size, 'linkOptions' => $this->linkOptions];
     }
     $dropdown = ButtonDropdown::widget(['options' => ['class' => 'btn-default'], 'label' => $current_page_size, 'dropdown' => ['items' => $items]]);
     $content = __('Total items: <b>{items}</b>', ['items' => $this->pagination->totalCount]);
     $content .= ' / ' . $dropdown;
     $content = Html::tag('div', $content);
     echo Html::tag('div', $content, ['class' => 'pagination-per-page']);
 }
开发者ID:vsguts,项目名称:crm,代码行数:32,代码来源:Pager.php

示例3: run

 public function run()
 {
     $languages = $this->languages;
     $current = $languages[Yii::$app->language];
     unset($languages[Yii::$app->language]);
     $items = [];
     foreach ($languages as $code => $language) {
         $temp = [];
         $temp['label'] = $language;
         $temp['url'] = Url::current(['language' => $code]);
         array_push($items, $temp);
     }
     echo ButtonDropdown::widget(['label' => $current, 'dropdown' => ['items' => $items], 'containerOptions' => $this->container, 'options' => ['class' => 'btn btn-xs btn-warning', 'style' => 'margin-top: 1px;'], 'tagName' => 'button']);
 }
开发者ID:baranov-nt,项目名称:setyes,代码行数:14,代码来源:LanguageSelect.php

示例4: run

 public function run()
 {
     $languages = $this->languages;
     $current = $languages[Yii::$app->language];
     unset($languages[Yii::$app->language]);
     $items = [];
     foreach ($languages as $code => $language) {
         $temp = [];
         $temp['label'] = $language;
         $temp['url'] = Url::current(['language' => $code]);
         array_push($items, $temp);
     }
     echo ButtonDropdown::widget(['label' => $current, 'dropdown' => ['items' => $items]]);
 }
开发者ID:asadovkamran,项目名称:etap_backup,代码行数:14,代码来源:languageSwitcher.php

示例5: run

 public function run()
 {
     $items = [];
     $currentUrl = preg_replace('/' . $this->currentLang->code . '+(\\/*)/', '', Yii::$app->getRequest()->getUrl(), 1);
     foreach ($this->allLanguages->code as $key => $language) {
         $temp = [];
         /* Добавление языковой приставки только к второстепенным языкам */
         if ($language !== Yii::$app->sourceLanguage || Yii::$app->getUrlManager()->displaySourceLanguage) {
             $url = '/' . $key . $currentUrl;
         } else {
             $url = $currentUrl;
         }
         if (Yii::$app->language !== $language) {
             $temp['label'] = $this->allLanguages->title[$key];
             $temp['url'] = $url;
             array_push($items, $temp);
             //$item = ['label' => $language['name'], 'url' => $url];
         }
     }
     echo ButtonDropdown::widget(['label' => $this->currentLang->title, 'dropdown' => ['items' => $items]]);
 }
开发者ID:Sywooch,项目名称:Bee-CMS,代码行数:21,代码来源:LanguageSwitcher.php

示例6: getLinks

 public function getLinks($parent)
 {
     $links = \common\models\main\Links::find()->innerJoinWith('category')->where(['categories_id' => $this->categories_id])->andWhere(['categories.visible' => 1])->andWhere(['parent' => $parent])->orderBy(['seq' => SORT_ASC])->all();
     if (!$links) {
         return '<em class="text-muted">Ссылки не добавлены</em>';
     }
     $html = Html::beginTag('ul', ['class' => 'list-unstyled']);
     /**
      * @var $i
      * @var $link \common\models\main\Links
      */
     foreach ($links as $i => $link) {
         $html .= Html::tag('li', Html::beginTag('div', ['class' => 'row']) . Html::tag('div', Html::a($link->anchor, ['/map/content', 'links_id' => $link->id], ['style' => ($link->state == 0 ? 'text-decoration: line-through; color: #aaa;' : '') . (Yii::$app->request->get('links_id') == $link->id || Yii::$app->request->get('parent_links_id') == $link->id ? 'font-weight: bold;' : '')]), ['class' => 'col-sm-9']) . Html::tag('div', ButtonDropdown::widget(['label' => '<i class="fa fa-cog"></i>', 'dropdown' => ['items' => [['label' => 'Параметры', 'url' => ['/map/links', 'categories_id' => Yii::$app->request->get('categories_id'), 'action' => 'ch', 'id' => $link->id]], ['label' => 'Ретактор контента', 'url' => ['/map/content', 'links_id' => $link->id]], ['label' => 'Добавить дочернюю ссылку', 'url' => ['/map/links', 'categories_id' => Yii::$app->request->get('categories_id'), 'parent' => $link->id, 'action' => 'add']]]], 'encodeLabel' => false, 'options' => ['class' => 'btn-default btn-xs']]), ['class' => 'col-sm-3 action text-right']) . Html::endTag('div'));
         if ($link->child_exist == '1') {
             $childs = \common\models\main\Links::find()->innerJoinWith('category')->where(['categories_id' => $this->categories_id])->andWhere(['categories.visible' => 1])->andWhere(['parent' => $link->id])->count();
             if ($childs > 0) {
                 $html .= $this->getLinks($link->id);
             }
         }
     }
     $html .= Html::endTag('ul');
     return $html;
 }
开发者ID:mark38,项目名称:yii2-site-mng,代码行数:23,代码来源:Links.php

示例7:

 * | | / // // ___//_  _//   ||  __||_   _|
 * | |/ // /(__  )  / / / /| || |     | |
 * |___//_//____/  /_/ /_/ |_||_|     |_|
 * @link http://vistart.name/
 * @copyright Copyright (c) 2016 vistart
 * @license http://vistart.name/license/
 */
use yii\bootstrap\Button;
use yii\bootstrap\ButtonDropdown;
use rho_my\modules\v1\controllers\PhoneController;
?>
<div class="panel-heading">
    <strong><?php 
echo Yii::t('my', 'Phone');
?>
</strong>
    <div class="pull-right"><!--
        <?php 
echo ButtonDropdown::widget(['label' => 'Amount', 'dropdown' => ['items' => [['label' => 'All', 'url' => '#'], '<li role="separator" class="divider"></li>', ['label' => '10', 'url' => '#'], ['label' => '20', 'url' => '#'], ['label' => '50', 'url' => '#']]], 'options' => ['class' => 'btn-primary']]);
?>
        <?php 
echo ButtonDropdown::widget(['label' => 'Type', 'dropdown' => ['items' => [['label' => 'All', 'url' => '#'], '<li role="separator" class="divider"></li>', ['label' => 'Home', 'url' => '#']]], 'options' => ['class' => 'btn-primary']]);
?>
-->
        <?php 
echo Button::widget(['label' => '<span class="glyphicon glyphicon-plus"></span> ' . 'Add', 'encodeLabel' => false, 'options' => ['class' => 'btn-success', 'data-toggle' => 'modal', 'data-target' => '#modal-new']]);
?>
    </div>
</div>
<?php 
echo \rho_my\widgets\item\FormWidget::widget(['model' => $newModel, 'action' => PhoneController::getRouteNew()]);
开发者ID:rhosocial,项目名称:rho.social,代码行数:31,代码来源:_head.php

示例8:

    <?php 
//     echo $this->render('_search', ['model' =>$searchModel]);
?>

    <div class="clearfix">
        <p class="pull-left">
            <?php 
echo Html::a('<span class="glyphicon glyphicon-plus"></span> ' . Yii::t('app', 'New'), ['create'], ['class' => 'btn btn-success']);
?>
        </p>

        <div class="pull-right">

                                                                                
            <?php 
echo \yii\bootstrap\ButtonDropdown::widget(['id' => 'giiant-relations', 'encodeLabel' => false, 'label' => '<span class="glyphicon glyphicon-paperclip"></span> ' . Yii::t('app', 'Relations'), 'dropdown' => ['options' => ['class' => 'dropdown-menu-right'], 'encodeLabels' => false, 'items' => [['label' => '<i class="glyphicon glyphicon-arrow-left"> Vidmage</i>', 'url' => ['vidmage/index']], ['label' => '<i class="glyphicon glyphicon-arrow-left"> Category</i>', 'url' => ['category/index']]]], 'options' => ['class' => 'btn-default']]);
?>
        </div>
    </div>

    
        <?php 
\yii\widgets\Pjax::begin(['id' => 'pjax-main', 'enableReplaceState' => false, 'linkSelector' => '#pjax-main ul.pagination a, th a', 'clientOptions' => ['pjax:success' => 'function(){alert("yo")}']]);
?>

        <div class="panel panel-default">
            <div class="panel-heading">
                <h2>
                    <i>Vidmage Categories</i>
                </h2>
            </div>
开发者ID:RubenDjOn,项目名称:originofthememes,代码行数:31,代码来源:index.php

示例9: function

    <?php 
//     echo $this->render('_search', ['model' =>$searchModel]);
?>

    <div class="clearfix">
        <p class="pull-left">
            <?php 
echo Html::a('<span class="glyphicon glyphicon-plus"></span> ' . Yii::t('app', 'New'), ['create'], ['class' => 'btn btn-success']);
?>
        </p>

        <div class="pull-right">

                                                                                                                                                                                                
            <?php 
echo \yii\bootstrap\ButtonDropdown::widget(['id' => 'giiant-relations', 'encodeLabel' => false, 'label' => '<span class="glyphicon glyphicon-paperclip"></span> ' . Yii::t('app', 'Relations'), 'dropdown' => ['options' => ['class' => 'dropdown-menu-right'], 'encodeLabels' => false, 'items' => [['label' => '<i class="glyphicon glyphicon-random"> Dept Emp</i>', 'url' => ['dept-emp/index']], ['label' => '<i class="glyphicon glyphicon-arrow-right"> Departments</i>', 'url' => ['departments/index']], ['label' => '<i class="glyphicon glyphicon-random"> Dept Manager</i>', 'url' => ['dept-manager/index']], ['label' => '<i class="glyphicon glyphicon-arrow-right"> Departments</i>', 'url' => ['departments/index']], ['label' => '<i class="glyphicon glyphicon-arrow-right"> Salaries</i>', 'url' => ['salaries/index']], ['label' => '<i class="glyphicon glyphicon-arrow-right"> Titles</i>', 'url' => ['titles/index']]]]]);
?>
        </div>
    </div>

    
        <div class="panel panel-default">
            <div class="panel-heading">
                Employees            </div>

            <div class="panel-body">

                <div class="table-responsive">
                <?php 
echo GridView::widget(['layout' => '{summary}{pager}{items}{pager}', 'dataProvider' => $dataProvider, 'pager' => ['class' => yii\widgets\LinkPager::className(), 'firstPageLabel' => Yii::t('app', 'First'), 'lastPageLabel' => Yii::t('app', 'Last')], 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\ActionColumn', 'urlCreator' => function ($action, $model, $key, $index) {
    // using the column name as key, not mapping to 'id' like the standard generator
开发者ID:schmunk42,项目名称:giiant-crud-examples,代码行数:31,代码来源:index.php

示例10: getAsAddon

 public function getAsAddon()
 {
     $ret_val = '';
     $items = [];
     $itemsLabels = [];
     $form = $this->form;
     $attribute = $this->attribute;
     $this->model->{$attribute} = !$this->model->{$attribute} || !array_key_exists($this->model->{$attribute}, $this->priorities) ? 'normal' : $this->model->{$attribute};
     foreach ($this->priorities as $name => $priority) {
         $text = isset($priority['text']) ? $priority['text'] : ucfirst($name);
         $priorityOptions = isset($this->_defaultPriorities[$name]) ? $this->_defaultPriorities[$name] : $this->defaultPriorities['normal'];
         $options = isset($priority['options']) ? array_merge($priorityOptions, $priority['options']) : $priorityOptions;
         switch ($this->addonType) {
             case 'buttons':
             case 'checkboxlist':
             case 'radiolist':
                 $btnQualifier = 'btn';
                 break;
             default:
                 $btnQualifier = 'bg';
                 break;
         }
         $options['class'] = "{$btnQualifier} {$btnQualifier}-" . $options['class'];
         switch ($this->size) {
             case 'tiny':
                 $options['class'] .= " {$btnQualifier}-xs";
                 break;
             case 'small':
                 $options['class'] .= " {$btnQualifier}-sm";
                 break;
             case 'large':
                 $options['class'] .= " {$btnQualifier}-lg";
                 break;
         }
         $options['value'] = $name;
         $items[$name] = $text;
         $itemsLabels[$name] = ['label' => $text, 'options' => $options, 'url' => '#'];
     }
     $itemsLabels[$this->model->{$attribute}]['options']['class'] .= ' active';
     $this->options['inline'] = $this->inputsInline;
     switch ($this->addonType) {
         case 'dropdown':
             $ret_val = \yii\bootstrap\ButtonDropdown::widget(['label' => 'Priority', 'dropdown' => ['items' => $itemsLabels], 'options' => ['class' => 'btn-primary']]);
             break;
         case 'radiolist':
             $this->options['data-toggle'] = 'buttons';
             $this->options['class'] = 'btn-group';
             $this->options['item'] = function ($index, $label, $name, $checked, $value) use($itemsLabels) {
                 $itemOptions = ['value' => $value];
                 return Html::label(Html::radio($name, $checked, $itemOptions) . ' ' . $label['label'], null, $itemsLabels[$value]['options']);
             };
             $ret_val = $this->form->field($this->model, $this->attribute)->radioList($itemsLabels, $this->options)->label("Priority", ['class' => 'sr-only']);
             break;
         case 'checkboxlist':
             $this->options['itemOptions'] = ['labelOptions' => ['class' => 'btn']];
             $ret_val = $this->form->field($this->model, $this->attribute, ['options' => ['class' => 'btn-group', 'data-toggle' => 'buttons']])->checkBoxList($items, $this->options);
             break;
         default:
             //Return as buttons by default
             $model = $this->model;
             $ret_val = implode(PHP_EOL, array_map(function ($item) use($model, $form, $attribute) {
                 //$item['options']['name'] = $model::formName()."[$attribute]";
                 $item['options']['id'] = strtolower($model::formName() . "-{$attribute}");
                 return Html::tag('button', $item['label'], $item['options']);
             }, $itemsLabels));
             break;
     }
     return $ret_val;
 }
开发者ID:nhatvuvan,项目名称:yii2-widgets,代码行数:69,代码来源:Priority.php

示例11:

?>

<div class="form-group" data-activity="form-group">
    <div class="col-sm-9">
        <?php 
echo net\frenzel\textareaautosize\yii2textareaautosize::widget(['model' => $model, 'attribute' => 'text']);
?>
        <?php 
echo Html::error($model, 'text', ['data-activity' => 'form-summary', 'class' => 'help-block hidden']);
?>
    </div>
    <div class="col-sm-3">
        <label class="control-label" for="net_frenzel_activity_quick_action">&nbsp;&nbsp;&nbsp;</label>
        <?php 
// a button group using Dropdown widget
echo ButtonDropdown::widget(['options' => ['id' => 'net_frenzel_activity_quick_action', 'class' => 'btn btn-info'], 'label' => 'Quick Actions', 'dropdown' => ['items' => [['label' => 'Not reached, call again', 'url' => '/'], ['label' => 'No time, pls. call back', 'url' => '#']]]]);
?>
    </div>
</div>

<div id="container_activity_input" style="display:none">
    <div class="col-md-12" data-activity="form-group">
        <label class="control-label" for="activity-text"><?php 
echo \Yii::t('net_frenzel_activity', 'Now');
?>
</label>        
        <?php 
echo $form->field($model, 'type')->radioButtonGroup($model->TypeArray, ['id' => 'type-create', 'itemOptions' => ['labelOptions' => ['class' => 'btn btn-warning btn-sm']]])->label(false);
?>
         <?php 
echo Html::error($model, 'type', ['data-activity' => 'form-summary', 'class' => 'help-block hidden']);
开发者ID:frenzelgmbh,项目名称:cm-activity,代码行数:31,代码来源:_form.php

示例12: renderFullExport

 /**
  * Renders the server side export menu
  *
  * @return string
  */
 public function renderFullExport()
 {
     if ($this->fullExport === false || !is_array($this->fullExport)) {
         return '';
     }
     $formats = $this->fullExportConfig;
     if (empty($formats) || !is_array($formats)) {
         return '';
     }
     $title = $this->fullExport['label'];
     $icon = $this->fullExport['icon'];
     $options = $this->fullExport['options'];
     $items = [];
     $queryParams = Yii::$app->request->queryParams;
     if (array_key_exists('exportType', $queryParams)) {
         unset($queryParams['exportType']);
     }
     if (array_key_exists($this->grid_mode_var, $queryParams)) {
         unset($queryParams[$this->grid_mode_var]);
     }
     foreach ($formats as $format => $setting) {
         if (array_key_exists('query', $queryParams)) {
             $url = Url::to(ArrayHelper::merge([Yii::$app->request->pathInfo, 'query' => $queryParams['query'], 'exportType' => $format, $this->grid_mode_var => 'export'], $queryParams));
         } else {
             $url = Url::to(ArrayHelper::merge([Yii::$app->request->pathInfo, 'exportType' => $format, $this->grid_mode_var => 'export'], $queryParams));
         }
         $label = empty($setting['icon']) || $setting['icon'] == '' ? $setting['label'] : '<i class="glyphicon glyphicon-' . $setting['icon'] . '"></i> ' . $setting['label'];
         $items[] = ['label' => $label, 'url' => $url, 'linkOptions' => ['data-pjax' => 0]];
     }
     $title = $icon == '' ? $title : "<i class='glyphicon glyphicon-{$icon}'></i> {$title}";
     return ButtonDropdown::widget(['label' => $title, 'dropdown' => ['items' => $items, 'encodeLabels' => false], 'options' => $options, 'encodeLabel' => false]);
 }
开发者ID:Bladefidz,项目名称:ocfa_yii,代码行数:37,代码来源:ExcelView.php

示例13: foreach

<?php

/**
 * User: Alexander Sazanovich <alexander@uniq.by>
 * Date: 27.11.2014
 * Time: 11:47
 */
$items = [];
foreach ($langs as $lang) {
    if ($lang != $current) {
        $items[] = ['label' => $lang->name, 'url' => '/' . $lang->url . Yii::$app->getRequest()->getLangUrl()];
    }
}
?>
<div id="languageSelector">
    <?php 
echo \yii\bootstrap\ButtonDropdown::widget(['label' => $current->name, 'options' => ['class' => 'btn-default'], 'dropdown' => ['items' => $items]]);
?>
</div>
开发者ID:uniqby,项目名称:yii2-ar-translatable,代码行数:19,代码来源:default.php

示例14:

        array_push($downloadItems, ['label' => Yii::t('ycm', 'Excel'), 'url' => ['download/excel', 'name' => $name]]);
    }
    ?>

        <h3><?php 
    echo $module->getAdminName($name);
    ?>
</h3>

        <?php 
    echo Html::a(Yii::t('ycm', 'List {name}', ['name' => $module->getPluralName($name)]), ['list', 'name' => $name], ['class' => 'btn btn-primary']);
    ?>

        <?php 
    if ($module->getHideCreate($name) === false) {
        echo Html::a(Yii::t('ycm', 'Create {name}', ['name' => $module->getSingularName($name)]), ['create', 'name' => $name], ['class' => 'btn btn-success']);
    }
    ?>

        <?php 
    if ($download === true) {
        echo ButtonDropdown::widget(['split' => true, 'label' => Yii::t('ycm', 'Download {name}', ['name' => $module->getPluralName($name)]), 'dropdown' => ['items' => $downloadItems], 'options' => ['class' => 'btn btn-default']]);
    }
    ?>

    <?php 
}
?>

</div>
开发者ID:vladdnepr,项目名称:yii2-ycm,代码行数:30,代码来源:index.php

示例15: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     $input = $this->hasModel() ? Html::activeTextInput($this->model, $this->attribute, $this->options) : Html::textInput($this->name, $this->value, $this->options);
     if ($this->addon) {
         if (!empty($this->dropdownItems)) {
             foreach ($this->dropdownItems as &$item) {
                 if ($value = ArrayHelper::remove($item, 'value')) {
                     $item['linkOptions']['data-value'] = $value;
                 }
             }
             $dropdown = ButtonDropdown::widget(['label' => '', 'containerOptions' => ['class' => ['widget' => 'input-group-btn']], 'options' => ['class' => 'btn-default', 'type' => 'button'], 'dropdown' => ['items' => $this->dropdownItems]]);
         } else {
             $dropdown = null;
         }
         $input = strtr($this->template, ['{input}' => $input, '{addon}' => $this->addon, '{dropdown}' => $dropdown]);
         $input = Html::tag('div', $input, $this->containerOptions);
     }
     $this->registerClientScript();
     return $input;
 }
开发者ID:Bladefidz,项目名称:ocfa_yii,代码行数:23,代码来源:DatePicker.php


注:本文中的yii\bootstrap\ButtonDropdown::widget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。