コード例 #1
3
 /**
  * Executes the widget.
  */
 public function run()
 {
     if ($this->hasModel()) {
         echo Html::activeDropDownList($this->model, $this->attribute, $this->data, $this->options);
     } else {
         echo Html::dropDownList($this->name, $this->value, $this->data, $this->options);
     }
     MultiSelectAsset::register($this->view);
     $this->registerPlugin('multiSelect');
 }
コード例 #2
2
ファイル: Select2.php プロジェクト: p0vidl0/yii2-select2
 public function run()
 {
     $this->registerPlugin('select2');
     Html::addCssClass($this->options, 'form-control');
     if ($this->hasModel()) {
         return Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
     } else {
         return Html::dropDownList($this->name, $this->selection, $this->items, $this->options);
     }
 }
コード例 #3
0
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     if (isset($this->htmlOptions['class'])) {
         $this->htmlOptions['class'] .= 'editableCell form-control';
     } else {
         $this->htmlOptions['class'] = 'editableCell form-control';
     }
     // We need to number the submit attributes because data attribute is not case sensitive
     $this->htmlOptions['data-submit-attributes'] = implode(',', $this->submitAttributes);
     $i = 0;
     foreach ($this->submitAttributes as $attribute) {
         $this->htmlOptions['data-attribute' . $i] = $model[$attribute];
         $i++;
     }
     $options = [];
     if (is_array($this->dropDownOptions)) {
         $options = $this->dropDownOptions;
     } else {
         $options = $model[$this->dropDownOptions];
     }
     $inputName = is_array($model) ? $this->attribute : Html::getInputName($model, $this->attribute);
     $readonly = $this->readonly;
     if (!is_bool($readonly)) {
         $readonly = call_user_func($this->readonly, $model, $key, $index, $this);
     }
     if ($readonly) {
         if (isset($options[$model[$this->attribute]])) {
             return $options[$model[$this->attribute]];
         }
         return $model[$this->attribute];
     }
     return Html::dropDownList($inputName, $model[$this->attribute], $options, $this->htmlOptions);
 }
コード例 #4
0
ファイル: Tags.php プロジェクト: enigmatix/yii2-widgets
    public function run()
    {
        $view = $this->getView();
        Select2Asset::register($view);
        if ($this->value === '') {
            $this->value = [];
        }
        if (!is_array($this->value)) {
            $this->value[$this->value] = $this->value;
        }
        $tags = json_encode($this->tags);
        echo Html::dropDownList($this->name, $this->value, $this->tags, ['class' => 'form-control', 'multiple' => true, 'id' => $this->options['id']]);
        $script = <<<SCRIPT
        \$("#{$this->options['id']}").select2({
            placeholder: "{$this->placeholder}",
            tags: {$tags},

        })

SCRIPT;
        if ($this->onChange) {
            $script .= '.on("change", function(e){ $.ajax("' . $this->onChange . '&" + $("#' . $this->options['id'] . '").serialize());})';
        }
        if ($this->disabled) {
            $script .= '.prop("disabled", true)';
        }
        $script .= ';';
        $view = $this->getView();
        $view->registerJs($script);
    }
コード例 #5
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $timeZones = [];
     $timeZonesOutput = [];
     $now = new \DateTime('now', new \DateTimeZone('UTC'));
     foreach (\DateTimeZone::listIdentifiers(\DateTimeZone::ALL) as $timeZone) {
         $now->setTimezone(new \DateTimeZone($timeZone));
         $timeZones[] = [$now->format('P'), $timeZone];
     }
     if ($this->sortBy == static::SORT_OFFSET) {
         array_multisort($timeZones);
     }
     foreach ($timeZones as $timeZone) {
         $content = preg_replace_callback("/{\\w+}/", function ($matches) use($timeZone) {
             switch ($matches[0]) {
                 case '{name}':
                     return $timeZone[1];
                 case '{offset}':
                     return $timeZone[0];
                 default:
                     return $matches[0];
             }
         }, $this->template);
         $timeZonesOutput[$timeZone[1]] = $content;
     }
     if ($this->hasModel()) {
         echo Html::activeDropDownList($this->model, $this->attribute, $timeZonesOutput, $this->options);
     } else {
         echo Html::dropDownList($this->name, $this->selection, $timeZonesOutput, $this->options);
     }
 }
コード例 #6
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     if ($this->hasModel()) {
         return Html::activeDropDownList($this->model, $this->attribute, $this->_getItems(), $this->options);
     } else {
         return Html::dropDownList($this->name, $this->value, $this->_getItems(), $this->options);
     }
 }
コード例 #7
0
ファイル: GridView.php プロジェクト: sanchezzzhak/kak-grid
 public function renderPageSize()
 {
     if (!$this->paginationPageSize || !count($this->paginationPageSize)) {
         return '';
     }
     $content = Html::dropDownList('', self::getPaginationSize(), array_combine(array_values($this->paginationPageSize), $this->paginationPageSize), ['class' => 'pagination-size form-control']);
     return $content;
 }
コード例 #8
0
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     $attribute = $this->attribute;
     $name = Html::getInputName($model, $attribute);
     $value = $model->{$attribute};
     $options = ArrayHelper::merge(['class' => $this->classPrefix . '-' . $attribute, 'data-id' => $key], $this->options);
     return Html::dropDownList($name, $value, $model::$enum_category, $options);
 }
コード例 #9
0
ファイル: Selectize.php プロジェクト: yii2mod/yii2-selectize
 /**
  * Render dropdown list
  */
 public function renderDropDown()
 {
     if ($this->hasModel()) {
         echo Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
     } else {
         echo Html::dropDownList($this->name, $this->value, $this->items, $this->options);
     }
 }
コード例 #10
0
 /**
  * @return string
  */
 protected function renderButtons()
 {
     $buttons = [self::ADD_ACTION => Html::button(Icon::show('plus') . ' ' . Yii::t('app', 'Add selected to:'), ['class' => isset($this->htmlOptions['add-class']) ? $this->htmlOptions['add-class'] : 'btn btn-default', 'disabled' => 'disabled', 'data-mc-action' => self::ADD_ACTION]), self::MOVE_ACTION => Html::button(Icon::show('arrows') . ' ' . Yii::t('app', 'Move selected to:'), ['class' => isset($this->htmlOptions['move-class']) ? $this->htmlOptions['move-class'] : 'btn btn-default', 'disabled' => 'disabled', 'data-mc-action' => self::MOVE_ACTION])];
     $group = '';
     foreach ($buttons as $id => $button) {
         $group .= Html::tag('div', Html::tag('div', $button . "\n\t" . Html::tag('div', Html::dropDownList(null, null, static::$categories, ['prompt' => Yii::t('app', 'Select category'), 'class' => 'form-control', 'id' => $id]), ['class' => 'input-group']), ['class' => 'btn-group']), ['class' => 'col-xs-12 col-sm-6']);
     }
     return Html::tag('div', $group, ['class' => 'row m-bottom-10']);
 }
コード例 #11
0
 public function run()
 {
     echo Html::beginForm(Url::to([$this->actionUrl]), 'post', []);
     if (!empty($this->returnUrl)) {
         echo Html::hiddenInput('returnUrl', $this->returnUrl);
     }
     echo Html::dropDownList('language', Yii::$app->language, Yii::$app->czaHelper->getEnabledLangs(), ['id' => $this->htmlId(), 'onchange' => 'this.form.submit()']);
     echo Html::endForm();
 }
コード例 #12
0
 protected function renderPageDropDownList()
 {
     $pageSizeList = [];
     foreach ($this->pageSizeList as $value) {
         $pageSizeList[$value] = $value;
     }
     //$linkurl =  $this->pagination->createUrl($page);
     return Html::dropDownList($this->pagination->pageSizeParam, $this->pagination->getPageSize(), $pageSizeList, $this->dropDownOptions);
 }
コード例 #13
0
ファイル: Select.php プロジェクト: tuyakhov/yii2-materialize
 public function run()
 {
     $this->registerJqueryPlugin('material_select');
     if ($this->hasModel()) {
         return Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
     } else {
         return Html::dropDownList($this->name, $this->value, $this->items, $this->options);
     }
 }
コード例 #14
0
 /**
  * Render chosen select
  * @return string|void
  */
 public function run()
 {
     if ($this->hasModel()) {
         echo Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
     } else {
         echo Html::dropDownList($this->name, $this->value, $this->items, $this->options);
     }
     $this->registerAssets();
 }
コード例 #15
0
ファイル: Widget.php プロジェクト: rychkov-evgeniy/yii2-base
 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->registerClientScript();
     if ($this->hasModel()) {
         return Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
     } else {
         return Html::dropDownList($this->name, $this->value, $this->items, $this->options);
     }
 }
コード例 #16
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     if (!$this->visible) {
         return "";
     }
     $str = Html::button($this->label, $this->options);
     $str .= "<span style='display: none;'>&nbsp;" . Html::dropDownList("parents", null, [], ["class" => "form-control"]) . "&nbsp;" . Html::button($this->labelOk, $this->optionsOk) . "</span>";
     return $str;
 }
コード例 #17
0
ファイル: EntityDropDown.php プロジェクト: vetoni/toko
 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->items = ArrayHelper::merge(['' => ''], $this->items);
     $this->htmlOptions = ArrayHelper::merge($this->htmlOptions, ['class' => 'form-control']);
     if (!is_null($this->model)) {
         echo Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->htmlOptions);
     } else {
         echo Html::dropDownList($this->attribute, $this->value, $this->items, $this->htmlOptions);
     }
 }
コード例 #18
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     if ($this->hasModel()) {
         $html = Html::activeHiddenInput($this->model, $this->attribute, ["id" => null]);
         $html .= Html::activeDropDownList($this->model, $this->attribute, $this->data, $this->options);
     } else {
         $html = Html::hiddenInput($this->name, $this->value, ["id" => null]);
         $html .= Html::dropDownList($this->name, $this->value, $this->options);
     }
     return $html;
 }
コード例 #19
0
 /**
  * run function.
  *
  * @access public
  * @return void
  */
 public function run()
 {
     $randomId = uniqid();
     $tagsArray = ArrayHelper::map(FileTag::find()->select(['id', 'name'])->orderBy('name')->all(), 'id', 'name');
     $selectOptions = ArrayHelper::merge(['' => 'Select a File Tag'], $tagsArray);
     if ($this->hasModel()) {
         echo Html::activeDropDownList($this->model, $this->attribute, $selectOptions, $this->options);
     } else {
         echo Html::dropDownList($this->name, $this->value, $selectOptions, $this->options);
     }
 }
コード例 #20
0
ファイル: DropdownSorter.php プロジェクト: roman444uk/yii2
 /**
  * @return string 
  */
 public function renderDropdownList()
 {
     $attributes = empty($this->attributes) ? array_keys($this->sort->attributes) : $this->attributes;
     $items = [];
     foreach ($attributes as $name) {
         $items[$this->sort->createSortParam($name)] = "{$name}";
         $items['-' . $this->sort->createSortParam($name)] = "{$name}";
     }
     $dropdownName = isset($this->options['name']) ? $this->options['name'] : $this->options['class'];
     return Html::dropDownList($dropdownName, null, $items, $this->options);
 }
コード例 #21
0
ファイル: IndexSorter.php プロジェクト: bokko79/servicemapp
 /**
  * Renders the sort links.
  * @return string the rendering result
  */
 protected function renderSortLinks()
 {
     $attributes = empty($this->attributes) ? array_keys($this->sort->attributes) : $this->attributes;
     $links = [];
     foreach ($attributes as $key => $name) {
         $links[$name] = $name;
     }
     echo Html::beginForm(null, 'get', []);
     echo Html::dropDownList('sort', null, $links, ['prompt' => 'Sortiraj po']);
     echo Html::submitButton('<i class="fa fa-sort"></i>', ['class' => 'btn btn-default margin-left-5']);
     echo Html::endForm();
 }
コード例 #22
0
ファイル: eavProp.php プロジェクト: chaimvaid/linet3
 /**
  * Display the widget
  * @see CWidget::run()
  */
 public function run()
 {
     //style="width:'.($this->width-$this->titlewidth-28).'px;"
     //$content = ob_get_clean();
     $models = EavFields::find()->All();
     //array('order' => 'name')
     $list = ArrayHelper::map($models, 'id', 'name');
     $htmlOptions = array('class' => 'eav');
     $select = Html::dropDownList($this->name . '_E_', 0, $list, $htmlOptions);
     $select = str_replace("\n", "", $select);
     $select = str_replace($this->name . '_E_', "propertiesE['+uid+']", $select);
     return $this->render("eavProp", ["name" => $this->name, "select" => $select, "attr" => $this->attr, "model" => $this->model]);
 }
コード例 #23
0
 protected function renderControls()
 {
     $html = '';
     $html .= '<div class="form-group">';
     if ($this->labelPostcode) {
         $html .= Html::label($this->labelPostcode, 'proxPostcode', ['class' => 'lbl-prox-postcode ' . $this->labelClass]);
     }
     $html .= Html::textInput('proxPostcode', isset($_GET['proxPostcode']) ? $_GET['proxPostcode'] : '', ['id' => 'proxPostcode', 'class' => 'form-control']);
     $html .= '</div>';
     $html .= '<div class="form-group">';
     $html .= Html::dropDownList('proxDistance', isset($_GET['proxDistance']) ? $_GET['proxDistance'] : '', $this->distanceValues, ['id' => 'proxDistance', 'class' => 'form-control']);
     $html .= '</div>';
     return $html;
 }
コード例 #24
0
 /**
  * Rendering the widget dropdown.
  * Default page size is 20.
  * @return string
  */
 public function run()
 {
     $size = 20;
     $saved = Yii::$app->session->get('per-page');
     if (in_array($saved, $this->pageSizes)) {
         $size = $saved;
     }
     $selected = Yii::$app->request->get('per-page');
     if (in_array($selected, $this->pageSizes)) {
         $size = $selected;
     }
     Yii::$app->session->set('per-page', $size);
     return Html::tag('div', Html::tag('div', Html::label(Yii::t('podium/view', 'Results per page'), 'per-page') . ' ' . Html::dropDownList('per-page', $size, $this->pageSizes, ['class' => 'form-control input-sm', 'id' => 'per-page']), ['class' => 'form-group']), ['class' => 'pull-right form-inline']) . '<br><br>';
 }
コード例 #25
0
 /**
  * 
  * @return string
  */
 public function run()
 {
     $active = null;
     if ($this->themes === null) {
         if (($theme = Yii::$app->getView()->theme) instanceof Theme) {
             $this->themes = array_combine(array_keys($theme->themes), array_keys($theme->themes));
             $active = $theme->active;
         } else {
             $this->themes = [];
         }
     }
     $this->registerScript();
     return Html::dropDownList('', $active, $this->themes, $this->options);
 }
コード例 #26
0
ファイル: DropDownControl.php プロジェクト: phpdn/qc-base
 /**
  * @inheritdoc
  */
 public function renderHtml()
 {
     if ($this->form !== null && $this->model !== null) {
         return $this->form->field($this->model, $this->attribute)->hint($this->hint)->dropDownList($this->items, $this->options);
     }
     if ($this->model !== null) {
         return Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
     }
     if (empty($this->options['multiple'])) {
         return Html::dropDownList($this->name, $this->value, $this->items, $this->options);
     } else {
         return Html::listBox($this->name, $this->value, $this->items, $this->options);
     }
 }
コード例 #27
0
ファイル: Select.php プロジェクト: utiuam/uamext
 public function run()
 {
     $view = $this->getView();
     $id = $this->options['id'];
     //Register DtGridViewAsset
     SelectAsset::register($view);
     if ($this->model) {
         $content = Html::activeDropDownList($this->model, $this->attribute, $this->data, $this->options);
     } else {
         $content = Html::dropDownList($this->options['id'], $this->attribute, $this->data, $this->options);
     }
     $clientOptions = Json::encode($this->clientOptions);
     $view->registerJs("var uam_select" . $this->getId() . "=jQuery('#{$id}').select2({$clientOptions});");
     return $content;
 }
コード例 #28
-1
 public function run()
 {
     echo Html::beginForm($this->getComponent()->paymentAction, 'post', $this->options);
     echo Html::hiddenInput('shopId', $this->getComponent()->shopId);
     echo Html::hiddenInput('scid', $this->getComponent()->scId);
     echo Html::hiddenInput('sum', $this->order->getTotalPrice());
     echo Html::hiddenInput('customerNumber', $this->userIdentity->getCustomerId());
     if (is_array($this->paymentType)) {
         echo Html::dropDownList('paymentType', array_keys($this->paymentType)[0], $this->paymentType);
     }
     if (is_array($this->data)) {
         foreach ($this->data as $key => $value) {
             echo Html::hiddenInput($key, $value);
         }
     }
     if ($phone = $this->userIdentity->getCustomerPhone()) {
         echo Html::hiddenInput('cps_phone', $phone);
     }
     if ($email = $this->userIdentity->getCustomerEmail()) {
         echo Html::hiddenInput('cps_email', $email);
     }
     if ($orderId = $this->order->getId()) {
         echo Html::hiddenInput('orderNumber', $orderId);
     }
     echo Html::submitButton(Yii::t($this->getComponent()->messagesCategory, $this->submitText));
     echo Html::endForm();
 }
コード例 #29
-1
ファイル: DropDownTreeList.php プロジェクト: roboapp/admin
 /**
  * @inheritdoc
  * @return string
  */
 public function run()
 {
     $this->prepareItems();
     if ($this->hasModel()) {
         return Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
     }
     return Html::dropDownList($this->name, $this->value, $this->items, $this->options);
 }
 /**
  * Renders a dropdown list for the helper
  */
 protected function dropDownList()
 {
     if (!$this->selectBox) {
         return $this->hasModel() ? Html::activeDropDownList($this->model, $this->attribute, [], $this->options) : Html::dropDownList($this->name, $this->value, [], $this->options);
     } else {
         return Select::widget(['model' => $this->model, 'attribute' => $this->attribute, 'name' => $this->name, 'value' => $this->value, 'options' => $this->options]);
     }
 }