For example, php a button group using Dropdown widget echo ButtonDropdown::widget([ 'label' => 'Action', 'dropdown' => [ 'items' => [ ['label' => 'DropdownA', 'url' => '/'], ['label' => 'DropdownB', 'url' => '#'], ], ], ]);
See also: http://getbootstrap.com/javascript/#buttons
See also: http://getbootstrap.com/components/#btn-dropdowns
Since: 2.0
Author: Antonio Ramirez (amigo.cobos@gmail.com)
Inheritance: extends yii\bootstrap\Widget
Exemple #1
18
 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);
 }
Exemple #2
0
 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']);
 }
 public function init()
 {
     parent::init();
     $this->dropdown['items'] = $this->items;
     $this->options['class'] = 'btn-' . $this->layout;
     if ($this->size) {
         $this->options['class'] .= ' btn-' . $this->size;
     }
 }
Exemple #4
0
 public function run()
 {
     $view = $this->getView();
     if ($this->clientOptions !== false) {
         $js = "\$.widget.bridge('uibutton', \$.ui.button);";
         $view->registerJs($js);
     }
     return parent::run();
 }
Exemple #5
0
 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']);
 }
 /**
  * Inits ButtonDropdown
  */
 public function init()
 {
     parent::init();
     $this->options['data-toggle'] = 'dropdown';
     if ($this->hover === true) {
         $this->options['data-hover'] = 'dropdown';
     }
     if ($this->encodeLabel) {
         $this->label = Html::encode($this->label);
     }
     $this->options['data-close-others'] = 'true';
     Html::addCssClass($this->options, 'btn');
     Html::addCssClass($this->options, 'dropdown-toggle');
 }
 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]]);
 }
Exemple #8
0
 /**
  * Renders the language drop down if there are currently more than one languages in the app.
  * If you pass an associative array of language names along with their code to the URL manager
  * those language names will be displayed in the drop down instead of their codes.
  */
 public function run()
 {
     $appLanguage = Yii::$app->language;
     if (count(Yii::$app->i18n->languages) > 1) {
         $items = [];
         foreach (Yii::$app->i18n->languages as $lang) {
             if ($lang === $appLanguage) {
                 $this->label = static::label($lang);
             }
             $item = ['label' => static::label($lang), 'url' => $this->getUrl($lang)];
             $items[] = $item;
         }
         $this->dropdown['items'] = $items;
         echo parent::run();
     }
 }
 public function init()
 {
     $route = Yii::$app->controller->route;
     $appLanguage = Yii::$app->language;
     $params = $_GET;
     $items = [];
     array_unshift($params, $route);
     foreach (Yii::$app->localeUrls->languages as $language) {
         if ($language === $appLanguage) {
             continue;
             // Exclude the current language
         }
         $params['language'] = $language;
         $items[] = ['label' => self::label($language), 'url' => Yii::$app->urlManager->createUrl($params)];
     }
     $this->dropdown['items'] = $items;
     parent::init();
 }
Exemple #10
0
 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]]);
 }
 /**
  * Renders the language drop down if there are currently more than one languages in the app.
  * If you pass an associative array of language names along with their code to the URL manager
  * those language names will be displayed in the drop down instead of their codes.
  */
 public function run()
 {
     $languages = isset(Yii::$app->getUrlManager()->languages) ? Yii::$app->getUrlManager()->languages : [];
     if (count($languages) > 1) {
         $items = [];
         $currentUrl = preg_replace('/' . Yii::$app->language . '\\//', '', Yii::$app->getRequest()->getUrl(), 1);
         $isAssociative = ArrayHelper::isAssociative($languages);
         foreach ($languages as $language => $code) {
             $url = $code . $currentUrl;
             if ($isAssociative) {
                 $item = ['label' => $language, 'url' => $url];
             } else {
                 $item = ['label' => $code, 'url' => $url];
             }
             if ($code === Yii::$app->language) {
                 $item['options']['class'] = 'disabled';
             }
             $items[] = $item;
         }
         $this->dropdown['items'] = $items;
         parent::run();
     }
 }
Exemple #12
0
 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;
 }
Exemple #13
0
 /**
  * Renders the export menu
  *
  * @return string
  */
 public function renderExport()
 {
     if ($this->export === false || !is_array($this->export) || empty($this->exportConfig) || !is_array($this->exportConfig)) {
         return '';
     }
     $title = $this->export['label'];
     $icon = $this->export['icon'];
     $options = $this->export['options'];
     $menuOptions = $this->export['menuOptions'];
     $title = $icon == '' ? $title : "<i class='glyphicon glyphicon-{$icon}'></i> {$title}";
     $action = $this->_module->downloadAction;
     if (!is_array($action)) {
         $action = [$action];
     }
     $encoding = ArrayHelper::getValue($this->export, 'encoding', 'utf-8');
     $target = ArrayHelper::getValue($this->export, 'target', self::TARGET_POPUP);
     $form = Html::beginForm($action, 'post', ['class' => 'kv-export-form', 'style' => 'display:none', 'target' => $target == self::TARGET_POPUP ? 'kvDownloadDialog' : $target]) . "\n" . Html::hiddenInput('export_filetype') . "\n" . Html::hiddenInput('export_filename') . "\n" . Html::hiddenInput('export_mime') . "\n" . Html::hiddenInput('export_config') . "\n" . Html::hiddenInput('export_encoding', $encoding) . "\n" . Html::textArea('export_content') . "\n</form>";
     $items = empty($this->export['header']) ? [] : [$this->export['header']];
     $iconPrefix = $this->export['fontAwesome'] ? 'fa fa-' : 'glyphicon glyphicon-';
     foreach ($this->exportConfig as $format => $setting) {
         $iconOptions = ArrayHelper::getValue($setting, 'iconOptions', []);
         Html::addCssClass($iconOptions, $iconPrefix . $setting['icon']);
         $label = empty($setting['icon']) || $setting['icon'] == '' ? $setting['label'] : Html::tag('i', '', $iconOptions) . ' ' . $setting['label'];
         $items[] = ['label' => $label, 'url' => '#', 'linkOptions' => ['class' => 'export-' . $format, 'data-format' => ArrayHelper::getValue($setting, 'mime', 'text/plain')], 'options' => $setting['options']];
     }
     $itemsBefore = ArrayHelper::getValue($this->export, 'itemsBefore', []);
     $itemsAfter = ArrayHelper::getValue($this->export, 'itemsAfter', []);
     $items = ArrayHelper::merge($itemsBefore, $items, $itemsAfter);
     return ButtonDropdown::widget(['label' => $title, 'dropdown' => ['items' => $items, 'encodeLabels' => false, 'options' => $menuOptions], 'options' => $options, 'containerOptions' => $this->exportContainer, 'encodeLabel' => false]) . $form;
 }
Exemple #14
0
?>

<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']);
Exemple #15
0
            <div class="form-group">

                <?php 
echo Html::dropDownList('bulk-action', null, ArrayHelper::merge($searchModel->getPostStatus(), ['delete' => 'Delete']), ['class' => 'bulk-action form-control', 'prompt' => 'Bulk Action']);
?>

                <?php 
echo Html::button(Yii::t('writesdown', 'Apply'), ['class' => 'btn btn-flat btn-warning bulk-button']);
?>

                <?php 
echo Html::a(Yii::t('writesdown', 'Add New {postType}', ['postType' => $postType->post_type_sn]), ['create', 'post_type' => $postType->id], ['class' => 'btn btn-flat btn-primary']);
?>

                <?php 
echo ButtonDropdown::widget(['label' => Html::tag('i', '', ['class' => 'fa fa-user']) . ' Author', 'dropdown' => ['items' => [['label' => 'My Posts', 'url' => ['/post/index', 'post_type' => $postType->id, 'user' => Yii::$app->user->id]], ['label' => 'All Posts', 'url' => ['/post/index', 'post_type' => $postType->id]]]], 'split' => true, 'encodeLabel' => false, 'options' => ['class' => 'btn btn-flat btn-danger']]);
?>

                <?php 
echo Html::button(Html::tag('i', '', ['class' => 'fa fa-search']), ['class' => 'btn btn-flat btn-info', "data-toggle" => "collapse", "data-target" => "#post-search"]);
?>

            </div>
        </div>

        <?php 
Pjax::begin();
?>

        <?php 
echo $this->render('_search', ['model' => $searchModel, 'postType' => $postType, 'user' => $user]);
Exemple #16
0
 * | | / // // ___//_  _//   ||  __||_   _|
 * | |/ // /(__  )  / / / /| || |     | |
 * |___//_//____/  /_/ /_/ |_||_|     |_|
 * @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()]);
Exemple #17
0
    <?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>
    <?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
Exemple #19
0
 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;
 }
//     echo $this->render('_search', ['model' =>$searchModel]);
?>

    <div class="clearfix">
        <p class="pull-left">
            <?php 
echo Html::a('<span class="glyphicon glyphicon-plus"></span> 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> Relations', 'dropdown' => ['options' => ['class' => 'dropdown-menu-right'], 'encodeLabels' => false, 'items' => [['label' => '<i class="glyphicon glyphicon-arrow-left"> Language</i>', 'url' => ['language/index']], ['label' => '<i class="glyphicon glyphicon-arrow-left"> Language</i>', 'url' => ['language/index']], ['label' => '<i class="glyphicon glyphicon-random"> Film Actor</i>', 'url' => ['film-actor/index']], ['label' => '<i class="glyphicon glyphicon-arrow-right"> Actor</i>', 'url' => ['actor/index']], ['label' => '<i class="glyphicon glyphicon-random"> Film Category</i>', 'url' => ['film-category/index']], ['label' => '<i class="glyphicon glyphicon-arrow-right"> Category</i>', 'url' => ['category/index']], ['label' => '<i class="glyphicon glyphicon-arrow-right"> Inventory</i>', 'url' => ['inventory/index']]]]]);
?>
        </div>
    </div>

            <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['film_id', 'title', 'description:ntext', 'release_year', ["class" => yii\grid\DataColumn::className(), "attribute" => "language_id", "value" => function ($model) {
    if ($rel = $model->getLanguage()->one()) {
        return yii\helpers\Html::a($rel->name, ["language/view", "id" => $rel->language_id], ["data-pjax" => 0]);
    } else {
        return '';
    }
}, "format" => "raw"], ["class" => yii\grid\DataColumn::className(), "attribute" => "original_language_id", "value" => function ($model) {
    if ($rel = $model->getOriginalLanguage()->one()) {
        return yii\helpers\Html::a($rel->name, ["language/view", "id" => $rel->language_id], ["data-pjax" => 0]);
    } else {
//     echo $this->render('_search', ['model' =>$searchModel]);
?>

    <div class="clearfix">
        <p class="pull-left">
            <?php 
echo Html::a('<span class="glyphicon glyphicon-plus"></span> 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> Relations', 'dropdown' => ['options' => ['class' => 'dropdown-menu-right'], 'encodeLabels' => false, 'items' => [['label' => '<i class="glyphicon glyphicon-arrow-left"> City</i>', 'url' => ['city/index']], ['label' => '<i class="glyphicon glyphicon-arrow-right"> Customer</i>', 'url' => ['customer/index']], ['label' => '<i class="glyphicon glyphicon-arrow-right"> Staff</i>', 'url' => ['staff/index']], ['label' => '<i class="glyphicon glyphicon-arrow-right"> Store</i>', 'url' => ['store/index']]]]]);
?>
        </div>
    </div>

            <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['address_id', 'address', 'address2', 'district', ["class" => yii\grid\DataColumn::className(), "attribute" => "city_id", "value" => function ($model) {
    if ($rel = $model->getCity()->one()) {
        return yii\helpers\Html::a($rel->city_id, ["city/view", "id" => $rel->city_id], ["data-pjax" => 0]);
    } else {
        return '';
    }
}, "format" => "raw"], 'postal_code', 'phone', ['class' => 'yii\\grid\\ActionColumn']]]);
?>
    
</div>
Exemple #22
0
<?php

/**
 *  _   __ __ _____ _____ ___  ____  _____
 * | | / // // ___//_  _//   ||  __||_   _|
 * | |/ // /(__  )  / / / /| || |     | |
 * |___//_//____/  /_/ /_/ |_||_|     |_|
 * @link https://vistart.name/
 * @copyright Copyright (c) 2016 vistart
 * @license https://vistart.name/license/
 */
use yii\bootstrap\ButtonDropdown;
use yii\helpers\Html;
use common\models\user\relation\FollowGroup;
/* @var $groups FollowGroup[] */
/* @var $this yii\web\View */
$followGroups = [];
foreach ($groups as $group) {
    $followGroups[] = '<li>' . '<a><div style="width:10px; height:10px; border-radius:100%; box-shadow: 0px 0px 1px 1px #' . dechex($group->color) . '; background-color: #' . dechex($group->color) . '; display:inline-block"></div>   ' . Html::encode($group->content) . '</li></a>';
    //$followGroups[] = ['label' => Html::encode($group->content), 'url' => '#', 'options' => ['style' => 'border-left: 3px dotted #' . dechex($group->color) . ';']];
}
if (!empty($followGroups)) {
    $followGroups[] = '<li role="presentation" class="divider"></li>';
    $followGroups[] = ['label' => 'None', 'url' => '#'];
    $followGroups[] = ['label' => 'All', 'url' => '#'];
    $followGroups[] = '<li role="presentation" class="divider"></li>';
}
echo ButtonDropdown::widget(['label' => 'Group', 'encodeLabel' => false, 'options' => [], 'dropdown' => ['items' => array_merge($followGroups, [['label' => 'Manage', 'url' => '#']])]]);
Exemple #23
0
    <?php 
//     echo $this->render('_search', ['model' =>$searchModel]);
?>

    <div class="clearfix">
        <p class="pull-left">
            <?php 
echo Html::a('<span class="glyphicon glyphicon-plus"></span> ' . '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> ' . 'Relations', 'dropdown' => ['options' => ['class' => 'dropdown-menu-right'], 'encodeLabels' => false, 'items' => [['url' => ['result-from/index'], 'label' => '<i class="glyphicon glyphicon-arrow-right">&nbsp;' . 'Result From' . '</i>'], ['url' => ['results/index'], 'label' => '<i class="glyphicon glyphicon-arrow-right">&nbsp;' . 'Results' . '</i>']]], '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><?php 
echo 'Results Pages';
?>
Exemple #24
0
//     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') . ' Staff', ['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-right"> Payment</i>', 'url' => ['payment/index']], ['label' => '<i class="glyphicon glyphicon-arrow-right"> Rental</i>', 'url' => ['rental/index']], ['label' => '<i class="glyphicon glyphicon-arrow-left"> Address</i>', 'url' => ['address/index']], ['label' => '<i class="glyphicon glyphicon-arrow-left"> Store</i>', 'url' => ['store/index']], ['label' => '<i class="glyphicon glyphicon-arrow-right"> Store</i>', 'url' => ['store/index']]]]]);
?>
        </div>
    </div>

    
        <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
    $params = is_array($key) ? $key : [$model->primaryKey()[0] => (string) $key];
    $params[0] = \Yii::$app->controller->id ? \Yii::$app->controller->id . '/' . $action : $action;
    return Url::toRoute($params);
}, 'contentOptions' => ['nowrap' => 'nowrap']], 'staff_id', 'first_name', 'last_name', ["class" => yii\grid\DataColumn::className(), "attribute" => "address_id", "value" => function ($model) {
    if ($rel = $model->getAddress()->one()) {
        return yii\helpers\Html::a($rel->address_id, ["address/view", 'address_id' => $rel->address_id], ["data-pjax" => 0]);
Exemple #25
0
                <div class="callout <?php 
echo $calloutClass;
?>
 debug-call-out">
                    <?php 
$count = 0;
$items = [];
foreach ($manifest as $meta) {
    $label = ($meta['tag'] == $tag ? Html::tag('strong', '&#9654;&nbsp;' . $meta['tag']) : $meta['tag']) . ': ' . $meta['method'] . ' ' . $meta['url'] . ($meta['ajax'] ? ' (AJAX)' : '') . ', ' . date('Y-m-d h:i:s a', $meta['time']) . ', ' . $meta['ip'];
    $url = ['view', 'tag' => $meta['tag'], 'panel' => $activePanel->id];
    $items[] = ['label' => $label, 'url' => $url];
    if (++$count >= 10) {
        break;
    }
}
echo ButtonGroup::widget(['options' => ['class' => 'btn-group-sm'], 'buttons' => [Html::a('All', ['index'], ['class' => 'btn btn-default']), Html::a('Latest', ['view', 'panel' => $activePanel->id], ['class' => 'btn btn-default']), ButtonDropdown::widget(['label' => 'Last 10', 'options' => ['class' => 'btn-default btn-sm'], 'dropdown' => ['items' => $items, 'encodeLabels' => false]])]]);
echo '<BR><BR>';
$url = Html::a(Html::encode($summary['url']));
$url = str_replace("http://", "", $url);
$url = str_replace("https://", "", $url);
$url = substr($url, strpos($url, "/"));
if (strlen($url) > 60) {
    $url = substr($url, 0, 60) . '...';
}
echo $summary['method'] . ' ' . $url . '<BR>';
echo 'Tag: ' . $summary['tag'] . ' - ';
echo 'at ' . date('Y-m-d h:i:s a', $summary['time']) . ' - ';
echo 'with ip ' . $summary['ip'] . ' ';
?>
                </div>
                <?php 
Exemple #26
0
echo Html::encode($this->title);
?>
</title>
    <?php 
$this->head();
?>
</head>
<body>
<?php 
$this->beginBody();
?>
<div class="wrap">
    <?php 
NavBar::begin(['brandLabel' => 'На сайт', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
if (!Yii::$app->user->isGuest) {
    echo ButtonDropdown::widget(['label' => $BAdmins->name, 'options' => ['class' => 'btn-link', 'style' => 'margin: 8px']]);
    echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => [['label' => 'Выйти', 'url' => ['/admin/logout'], 'linkOptions' => ['data-method' => 'post']]]]);
}
NavBar::end();
?>
    <div class="container">
		<?php 
if (!Yii::$app->user->isGuest) {
    ?>
		<aside class="admin_panel">
			<?php 
    echo Nav::widget(['options' => ['class' => 'navbar-left'], 'items' => [['label' => 'Главная страница', 'url' => ['/admin/mainpage']], ['label' => 'Акции', 'url' => ['/admin/actions']], ['label' => 'Мастера', 'url' => ['/admin/masters']], ['label' => 'Для милых дам', 'url' => ['/admin/mastersforwomen']], ['label' => 'Программы', 'url' => ['/admin/programs']], ['label' => 'Интерьер', 'url' => ['/admin/interior']], ['label' => 'Правила', 'url' => ['/admin/rules']], ['label' => 'Вакансии', 'url' => ['/admin/vacancy']], ['label' => 'Подарочный сертификат', 'url' => ['/admin/sertificate']], ['label' => 'Отзывы', 'url' => ['/admin/reviews']], ['label' => 'Обратная связь', 'url' => ['/admin/feedback']], ['label' => 'Настройки сайта', 'url' => ['/admin/settings']], ['label' => 'Изменить данные входа', 'url' => ['/admin/userchange']]]]);
    ?>
		</aside>
		<?php 
}
Exemple #27
0
        <small>
            List
        </small>
    </h1>
    <div class="clearfix crud-navigation">
        <div class="pull-left">
            <?php 
echo Html::a('<span class="glyphicon glyphicon-plus"></span> ' . Yii::t('app', 'New'), ['create'], ['class' => 'btn btn-success']);
?>
        </div>

        <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' => [['url' => ['sensor/index'], 'label' => '<i class="glyphicon glyphicon-arrow-right">&nbsp;' . Yii::t('app', 'Sensor') . '</i>']]], 'options' => ['class' => 'btn-default']]);
?>
        </div>
    </div>


    <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, 'tableOptions' => ['class' => 'table table-striped table-bordered table-hover'], 'headerRowOptions' => ['class' => 'x'], '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
    $params = is_array($key) ? $key : [$model->primaryKey()[0] => (string) $key];
    $params[0] = \Yii::$app->controller->id ? \Yii::$app->controller->id . '/' . $action : $action;
    return Url::toRoute($params);
}, 'contentOptions' => ['nowrap' => 'nowrap']], 'startdate', 'enddate', ['class' => yii\grid\DataColumn::className(), 'attribute' => 'sensorid', 'value' => function ($model) {
    if ($rel = $model->getSensor()->one()) {
        return Html::a($rel->name, ['sensor/view', 'id' => $rel->id], ['data-pjax' => 0]);
Exemple #28
0
 /**
  * Renders the export menu
  *
  * @return string the export menu markup
  */
 public function renderExportMenu()
 {
     $items = $this->asDropdown ? [] : '';
     foreach ($this->exportConfig as $format => $settings) {
         if (empty($settings) || $settings === false) {
             continue;
         }
         $label = '';
         if (!empty($settings['icon'])) {
             $css = $this->fontAwesome ? 'fa fa-' : 'glyphicon glyphicon-';
             $iconOptions = ArrayHelper::getValue($settings, 'iconOptions', []);
             Html::addCssClass($iconOptions, $css . $settings['icon']);
             $label = Html::tag('i', '', $iconOptions) . ' ';
         }
         if (!empty($settings['label'])) {
             $label .= $settings['label'];
         }
         $fmt = strtolower($format);
         $linkOptions = ArrayHelper::getValue($settings, 'linkOptions', []);
         $linkOptions['id'] = $this->options['id'] . '-' . $fmt;
         $linkOptions['data-format'] = $format;
         $options = ArrayHelper::getValue($settings, 'options', []);
         Html::addCssClass($linkOptions, "export-full-{$fmt}");
         if ($this->asDropdown) {
             $items[] = ['label' => $label, 'url' => '#', 'linkOptions' => $linkOptions, 'options' => $options];
         } else {
             $tag = ArrayHelper::remove($options, 'tag', 'li');
             if ($tag !== false) {
                 $items .= Html::tag($tag, Html::a($label, '#', $linkOptions), $options);
             } else {
                 $items .= Html::a($label, '#', $linkOptions);
             }
         }
     }
     $form = $this->render($this->exportFormView, ['options' => $this->exportFormOptions, 'exportType' => $this->_exportType, 'columnSelectorEnabled' => $this->_columnSelectorEnabled, 'exportRequestParam' => $this->exportRequestParam, 'exportTypeParam' => self::PARAM_EXPORT_TYPE, 'exportColsParam' => self::PARAM_EXPORT_COLS, 'colselFlagParam' => self::PARAM_COLSEL_FLAG]);
     if ($this->asDropdown) {
         $icon = ArrayHelper::remove($this->dropdownOptions, 'icon', '<i class="glyphicon glyphicon-export"></i>');
         $label = ArrayHelper::remove($this->dropdownOptions, 'label', '');
         $label = empty($label) ? $icon : $icon . ' ' . $label;
         if (empty($this->dropdownOptions['title'])) {
             $this->dropdownOptions['title'] = Yii::t('kvexport', 'Export data in selected format');
         }
         $menuOptions = ArrayHelper::remove($this->dropdownOptions, 'menuOptions', []);
         $itemsBefore = ArrayHelper::remove($this->dropdownOptions, 'itemsBefore', []);
         $itemsAfter = ArrayHelper::remove($this->dropdownOptions, 'itemsAfter', []);
         $items = ArrayHelper::merge($itemsBefore, $items, $itemsAfter);
         $content = strtr($this->template, ['{menu}' => ButtonDropdown::widget(['label' => $label, 'dropdown' => ['items' => $items, 'encodeLabels' => false, 'options' => $menuOptions], 'options' => $this->dropdownOptions, 'encodeLabel' => false]), '{columns}' => $this->renderColumnSelector()]) . "\n" . $form;
         return Html::tag('div', $content, $this->container);
     } else {
         return $items . "\n" . $form;
     }
 }
Exemple #29
0
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
        </div>
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'title', ['addon' => ['append' => ['content' => Html::a(Yii::t('document', 'Повторить название'), '#', ['class' => ['btn btn-default repeat-name']]), 'asButton' => true], 'groupOptions' => ['id' => 'title-btn']]]);
?>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'alias', ['addon' => ['append' => ['content' => ButtonDropdown::widget(['label' => 'Сформировать', 'dropdown' => ['items' => [['label' => Yii::t('document', 'Из названия'), 'url' => '#', 'options' => ['class' => 'translate-name']], ['label' => Yii::t('document', 'Из заголовка'), 'url' => '#', 'options' => ['class' => 'translate-title']]]], 'options' => ['class' => 'btn-default']]), 'asButton' => true], 'groupOptions' => ['id' => 'alias-btn']]]);
?>
        </div>
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'status')->dropDownList(Document::getStatusArray());
?>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'parent_id')->widget(Select2::classname(), ['data' => Document::getAll(), 'options' => ['placeholder' => '', 'class' => 'parent_id'], 'pluginOptions' => ['allowClear' => true]]);
?>
        </div>
Exemple #30
0
    <?php 
//     echo $this->render('_search', ['model' =>$searchModel]);
?>

    <div class="clearfix">
        <p class="pull-left">
            <?php 
echo Html::a('<span class="glyphicon glyphicon-plus"></span> ' . '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> ' . 'Relations', 'dropdown' => ['options' => ['class' => 'dropdown-menu-right'], 'encodeLabels' => false, 'items' => [['label' => '<i class="glyphicon glyphicon-arrow-right"> Payment</i>', 'url' => ['payment/index']], ['label' => '<i class="glyphicon glyphicon-arrow-left"> User</i>', 'url' => ['user/index']], ['label' => '<i class="glyphicon glyphicon-arrow-left"> User</i>', 'url' => ['user/index']], ['label' => '<i class="glyphicon glyphicon-arrow-left"> User</i>', 'url' => ['user/index']]]]]);
?>
        </div>
    </div>

    
        <div class="panel panel-default">
            <div class="panel-heading">
                Students            </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' => 'First', 'lastPageLabel' => '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