//echo'<pre>';var_dump($year_end);echo'</pre>';//die; $dd_list = []; $url_params_ = [$current_controller . '/' . $current_action, 'for' => $current_filter_for, 'year' => 'all', 'league' => $current_filter_league]; $url = Url::to($url_params_); $dd_list[$url] = 'Год'; for ($year = $year_start - 1; $year++ < $year_end;) { //$url_params_ = [$current_controller.'/'.$current_action] + $url_params + ['year'=>$year]; $url_params_ = [$current_controller . '/' . $current_action, 'for' => $current_filter_for, 'year' => $year, 'league' => $current_filter_league]; $url = Url::to($url_params_); $dd_list[$url] = $year; } //echo'<pre>';print_r($dd_list);echo'</pre>';//die; //$dd_list_active = Url::to([$current_controller.'/'.$current_action, 'for'=>$current_filter_for, 'year'=>$current_filter_year]); $dd_list_active = Url::to([$current_controller . '/' . $current_action] + $url_params); $filter_year_drop_down = Html::dropDownList('filter-year', $dd_list_active, $dd_list, ['id' => 'filter-year', 'class' => 'width-100 location-change']); $leagues_list = DotaLeague::getLeaguesListDropDown(); //echo'<pre>';print_r($leagues_list);echo'</pre>';//die; $dd_list = []; //$url_params = ['for'=>$current_filter_for]; $url_params_ = [$current_controller . '/' . $current_action, 'for' => $current_filter_for, 'year' => $current_filter_year, 'league' => 'all']; $url = Url::to($url_params_); $dd_list[$url] = 'Все турниры'; foreach ($leagues_list as $key => $league) { //$url_params_ = [$current_controller.'/'.$current_action] + $url_params + ['league'=>$key]; $url_params_ = [$current_controller . '/' . $current_action, 'for' => $current_filter_for, 'year' => $current_filter_year, 'league' => $key]; $url = Url::to($url_params_); $dd_list[$url] = $league; } //echo'<pre>';print_r($dd_list);echo'</pre>';//die; //$dd_list_active = Url::to([$current_controller.'/'.$current_action, 'for'=>$current_filter_for, 'league'=>$current_filter_league]); $filter_league_drop_down = Html::dropDownList('filter-league', $dd_list_active, $dd_list, ['id' => 'filter-league', 'class' => 'width-100 location-change']);
<?php use yii\web\View; use common\models\dota\DotaLeague; //use dosamigos\multiselect\MultiSelect; \common\assets\ChoosenSelectAsset::register($this); //русский язык подключаем $js = "jQuery('.chosen_select').chosen();"; $this->registerJs($js, View::POS_READY, 'form-league'); ?> <br> <div class="form-group"> <?php echo $form->field($model, 'league_ids')->dropDownList(DotaLeague::getLeaguesListDropDown(), [$model->league_ids, 'class' => 'chosen_select', 'multiple' => true, 'data-placeholder' => 'Укажите лиги и турниры', 'style' => 'width:100%;min-height:30px;']); ?> </div>