Toggle navigation
Hot Examples
JP
EN
RU
DE
FR
ES
PT
IT
JP
ZH
KO
PHP
PHP
C#
Java
Go
C++
Python
JS
TS
検索
PHP CHtml::activeDropDownListの例
プログラミング言語:
PHP
クラス/型:
CHtml
メソッド/関数:
activeDropDownList
hotexamples.comのコード掲載数:
30
CHtml.activeDropDownListは、PHPのフォーム作成ファンクションの一つであり、アクティブなドロップダウンリスト(選択肢のプルダウンメニュー)を生成するために使用されます。このファンクションは、HTMLの
要素を作成し、指定されたデータ配列から選択肢を動的に生成することができます。これにより、PHPで動的な選択肢リストを作成することができ、ユーザーはその中から選択することが可能です。 PHP CHtml::activeDropDownList - 30件のコード例が見つかりました。すべてオープンソースプロジェクトから抽出されたPHPのCHtml::activeDropDownListの実例で、最も評価が高いものを厳選しています。コード例の評価を行っていただくことで、より質の高いコード例が表示されるようになります。 よく使われるメソッド 表示 非表示 value(30) htmlButton(30) checkBoxList(30) activeLabel(30) checkbox(30) activeId(30) hiddenField(30) activeHiddenField(30) activeFileField(30) activeName(30) image(30) activeDropDownList(30) dropDownList(30) label(30) link(30) linkButton(30) activeCheckBox(30) activeLabelEx(30) activePasswordField(30) listData(30) error(30) ajaxLink(30) ajaxButton(30) ajax(30) asset(30) beginForm(30) encode(30) endForm(30) errorSummary(30) activeRadioButtonList(30) button(30) fileField(30) form(30) activeTextField(30) activeTextArea(30) getIdByName(30) checkBox(30) listBox(30) ajaxSubmitButton(30) resolveName(30) openTag(30) decode(30) textField(30) resetButton(30) radioButtonList(30) radioButton(30) textArea(30) passwordField(30) closeTag(30) tag(30) よく使われるメソッド value (30) htmlButton (30) checkBoxList (30) activeLabel (30) checkbox (30) activeId (30) hiddenField (30) activeHiddenField (30) activeFileField (30) activeName (30) よく使われるメソッド image (30) activeDropDownList (30) dropDownList (30) label (30) link (30) linkButton (30) activeCheckBox (30) activeLabelEx (30) activePasswordField (30) listData (30) error (30) ajaxLink (30) ajaxButton (30) ajax (30) asset (30) beginForm (30) encode (30) endForm (30) errorSummary (30) activeRadioButtonList (30) よく使われるメソッド error (30) ajaxLink (30) ajaxButton (30) ajax (30) asset (30) beginForm (30) encode (30) endForm (30) errorSummary (30) activeRadioButtonList (30) button (30) fileField (30) form (30) activeTextField (30) activeTextArea (30) getIdByName (30) checkBox (30) listBox (30) ajaxSubmitButton (30) resolveName (30) openTag (30) decode (30) textField (30) resetButton (30) radioButtonList (30) radioButton (30) textArea (30) passwordField (30) closeTag (30) tag (30) Related in langs EventRecorder (C#) VIR_DIV_UP (C++) MSG_WriteLong (C++) PauseCommand (Go) App (Go) TypeDescription (Java) Groovesquid (Java) setup_index (Python) LastUpdateSet (Python) よく使われるメソッド button (30) fileField (30) form (30) activeTextField (30) activeTextArea (30) getIdByName (30) checkBox (30) listBox (30) ajaxSubmitButton (30) resolveName (30) openTag (30) decode (30) textField (30) resetButton (30) radioButtonList (30) radioButton (30) textArea (30) passwordField (30) closeTag (30) tag (30) Link (30) normalizeUrl (30) submitButton (30) modelName (30) script (30) mailto (30) Button (30) scriptFile (29) cssFile (28) imageButton (26) activeListBox (24) resolveNameID (24) encodeArray (22) activeCheckBoxList (21) css (20) resolveValue (19) activeRadioButton (18) renderAttributes (18) DropDownList (16) activeNumberField (15) 関連情報 stat_script_generate org_openpsa_sales_viewer NodeStrategyRead IDriver BufferFactory grve_print_media_button_target_selection Helper HubService GooglePlugin Bitrix\Im\Color コード例 #1 2 ファイルを表示 ファイル: Select2.php プロジェクト: intersvyaz/yii-select2 /** * @inheritdoc */ public function run() { list($name, $id) = $this->resolveNameID(); if (isset($this->htmlOptions['id'])) { $id = $this->htmlOptions['id']; } else { $this->htmlOptions['id'] = $id; } if (isset($this->htmlOptions['name'])) { $name = $this->htmlOptions['name']; } if ($this->type == static::TYPE_TEXT) { if ($this->hasModel()) { echo \CHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions); } else { echo \CHtml::textField($name, $this->value, $this->htmlOptions); } } elseif ($this->type == static::TYPE_SELECT) { if ($this->hasModel()) { echo \CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions); } else { echo \CHtml::dropDownList($name, $this->value, $this->data, $this->htmlOptions); } } else { throw new \CException("Invalid field type '{$this->type}'"); } $options = !empty($this->options) ? \CJavaScript::encode($this->options) : ''; $script = "jQuery('#{$id}').select2({$options})"; foreach ($this->events as $event => $handler) { $script .= ".on('{$event}'," . \CJavaScript::encode($handler) . ")"; } $script .= ';'; \Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $this->getId(), $script); $this->registerAssets(); } コード例 #2 0 ファイルを表示 ファイル: ESelect2.php プロジェクト: rusli-nasir/ERP_Accounting_Indonesia public function run() { list($this->name, $this->id) = $this->resolveNameId(); if (isset($this->htmlOptions['placeholder'])) { $this->options['placeholder'] = $this->htmlOptions['placeholder']; } $data = array(); if (isset($this->options['placeholder'])) { $data[''] = ''; } $this->data = $data + $this->data; if ($this->hasModel()) { echo CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions); } else { $this->htmlOptions['id'] = $this->id; echo CHtml::dropDownList($this->name, $this->value, $this->data, $this->htmlOptions); } $bu = Yii::app()->assetManager->publish(dirname(__FILE__) . '/assets/'); $cs = Yii::app()->clientScript; $cs->registerCssFile($bu . '/select2.css'); if ($this->scriptPosition === null) { $this->scriptPosition = $cs->coreScriptPosition; } $cs->registerScriptFile($bu . '/select2.js', $this->scriptPosition); $options = $this->options ? CJavaScript::encode($this->options) : ''; $cs->registerScript(__CLASS__ . '#' . $this->id, "\$('#{$this->id}').select2({$options});"); } コード例 #3 0 ファイルを表示 ファイル: LanguageSelect.php プロジェクト: rosko/Tempo-CMS public function run() { list($name, $id) = $this->resolveNameID(); if (isset($this->htmlOptions['id'])) { $id = $this->htmlOptions['id']; } else { $this->htmlOptions['id'] = $id; } if (isset($this->htmlOptions['name'])) { $name = $this->htmlOptions['name']; } else { $this->htmlOptions['name'] = $name; } $l = Language::loadConfig(); $data = array(); foreach ($l['languages'] as $k => $v) { $data[$k] = Yii::t('languages', $v); } if ($this->empty) { $data = array_merge(array('' => Yii::t('cms', $this->empty)), $data); } if ($this->hasModel()) { echo CHtml::activeDropDownList($this->model, $this->attribute, $data, $this->htmlOptions); } else { echo CHtml::dropDownList($name, $this->value, $data, $this->htmlOptions); } } コード例 #4 0 ファイルを表示 ファイル: TbDataColumn.php プロジェクト: jackycgq/advanced /** * Renders the filter cell content. Here we can provide HTML options for actual filter input */ protected function renderFilterCellContent() { if (is_string($this->filter)) { echo $this->filter; } else { if ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strpos($this->name, '.') === false) { if ($this->filterInputOptions) { $filterInputOptions = $this->filterInputOptions; if (empty($filterInputOptions['id'])) { $filterInputOptions['id'] = false; } } else { $filterInputOptions = array(); } if (is_array($this->filter)) { $filterInputOptions['prompt'] = ''; echo CHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, $filterInputOptions); } else { if ($this->filter === null) { echo CHtml::activeTextField($this->grid->filter, $this->name, $filterInputOptions); } } } else { parent::renderFilterCellContent(); } } } コード例 #5 0 ファイルを表示 ファイル: EchMultiSelect.php プロジェクト: branJakJak/lidsRipowrt /** * Run this widget. * This method registers necessary javascript and renders the needed HTML code. */ public function run() { list($name, $id) = $this->resolveDropDownNameID(); // Render drop-down element and hide it with javascript if ($this->hasModel()) { echo CHtml::activeDropDownList($this->model, $this->dropDownAttribute, $this->data, $this->dropDownHtmlOptions); } else { echo CHtml::dropDownList($name, $this->value, $this->data, $this->dropDownHtmlOptions); } // Put the script to hide the select-element directly after the element itself, so it is hidden directly after it is rendered // Resource: http://www.electrictoolbox.com/jquery-hide-text-page-load-show-later/ // Note: You can also hide the select-element by adding the css-style 'display:none' to the dropDownHtmlOptions. // We prefer the following JS-Code because of backward compatibility: if the user has JS disabled, // multiselect will not work, but the original select-element will stay visible. echo '<script type="text/javascript"> $("#' . $id . '").hide(); </script>'; $joptions = CJavaScript::encode($this->options); $jfilterOptions = CJavaScript::encode($this->filterOptions); if ($this->options['filter'] === true) { $jscode = "jQuery('#{$id}').multiselect({$joptions}).multiselectfilter({$jfilterOptions});"; unset($this->options['filter']); } else { $jscode = "jQuery('#{$id}').multiselect({$joptions});"; } // start - by jeremy@Yii if ($this->options['ajaxRefresh'] == true) { $jscode .= "jQuery('body').ajaxComplete(function() {jQuery('#" . $id . "').multiselect(" . $joptions . "); });"; } // end - by jeremy@Yii Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $id, $jscode); } コード例 #6 0 ファイルを表示 ファイル: Select2.php プロジェクト: abudayah/yiiwheels-custom /** * Renders the select2 field */ public function renderField() { if ($this->hasModel()) { echo $this->asDropDownList ? \CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->options) : \CHtml::activeHiddenField($this->model, $this->attribute); } else { echo $this->asDropDownList ? \CHtml::dropDownList($this->options['name'], $this->value, $this->data, $this->options) : \CHtml::hiddenField($this->options['name'], $this->value); } } コード例 #7 0 ファイルを表示 ファイル: MultiSelect.php プロジェクト: abudayah/yiiwheels-custom /** * Renders the multiselect field */ public function renderField() { if ($this->hasModel()) { echo \CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->options); } else { echo \CHtml::dropDownList($this->name, $this->value, $this->data, $this->options); } } コード例 #8 0 ファイルを表示 ファイル: EMultiSelect.php プロジェクト: nizsheanez/blog.ru public function run() { echo CHtml::activeDropDownList($this->model, $this->attribute, $this->input_element->items, array( 'multiple' => 'multiple', 'key' => isset($this->key) ? $this->key : 'id', 'class' => 'multiselect' )); } コード例 #9 0 ファイルを表示 ファイル: UWrelBelongsTo.php プロジェクト: nizsheanez/PolymorphCMS /** * @param $model - profile model * @param $field - profile fields model item * @param $params - htmlOptions * @return string */ public function editAttribute($model,$field,$htmlOptions=array()) { $list = array(); if ($this->params['emptyField']) $list[0] = $this->params['emptyField']; $models = CActiveRecord::model($this->params['modelName'])->findAll(); foreach ($models as $m) $list[$m->id] = (($this->params['optionName'])?$m->getAttribute($this->params['optionName']):$m->id); return CHtml::activeDropDownList($model,$field->varname,$list,$htmlOptions=array()); } コード例 #10 0 ファイルを表示 ファイル: TbSelect.php プロジェクト: BrunoCheble/novopedido public function renderField() { list($name, $id) = $this->resolveNameID(); if ($this->hasModel()) { echo CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions); } else { echo CHtml::dropDownList($name, $this->value, $this->data, $this->htmlOptions); } } コード例 #11 0 ファイルを表示 ファイル: ESelect2.php プロジェクト: EurekaSolutions/sistemanc public function run() { if ($this->selector == null) { list($this->name, $this->id) = $this->resolveNameId(); $this->selector = '#' . $this->id; if (isset($this->htmlOptions['placeholder'])) { $this->options['placeholder'] = $this->htmlOptions['placeholder']; } if (!isset($this->htmlOptions['multiple'])) { $data = array(); if (isset($this->options['placeholder'])) { $data[''] = ''; } $this->data = $data + $this->data; } if ($this->hasModel()) { if (isset($this->options['ajax'])) { echo CHtml::activeHiddenField($this->model, $this->attribute, $this->htmlOptions); } else { echo CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions); } } elseif (!isset($this->options['ajax'])) { $this->htmlOptions['id'] = $this->id; echo CHtml::dropDownList($this->name, $this->value, $this->data, $this->htmlOptions); } else { echo CHtml::hiddenField($this->name, $this->value, $this->htmlOptions); } } $bu = Yii::app()->assetManager->publish(dirname(__FILE__) . '/assets/'); $cs = Yii::app()->clientScript; //$cs->registerCssFile($bu . '/select2.css'); if (YII_DEBUG) { $cs->registerScriptFile($bu . '/select2.js'); } else { $cs->registerScriptFile($bu . '/select2.min.js'); } if ($this->sortable) { $cs->registerCoreScript('jquery.ui'); } $options = CJavaScript::encode(CMap::mergeArray($this->defaultOptions, $this->options)); ob_start(); echo "jQuery('{$this->selector}').select2({$options})"; foreach ($this->events as $event => $handler) { echo ".on('{$event}', " . CJavaScript::encode($handler) . ")"; } echo ';'; if ($this->sortable) { echo <<<JavaScript jQuery('{$this->selector}').select2("container").find("ul.select2-choices").sortable({ \tcontainment: 'parent', \tstart: function() { jQuery('{$this->selector}').select2("onSortStart"); }, \tupdate: function() { jQuery('{$this->selector}').select2("onSortEnd"); } }); JavaScript; } $cs->registerScript(__CLASS__ . '#' . $this->id, ob_get_clean()); } コード例 #12 0 ファイルを表示 ファイル: TbMultiSelect.php プロジェクト: khenam/yii-bootstrap-multiselect public function renderField() { $this->htmlOptions['multiple'] = 'multiple'; if ($this->hasModel()) { echo CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions); } else { echo CHtml::dropDownList($this->name, $this->value, $this->data, $this->htmlOptions); } } コード例 #13 0 ファイルを表示 ファイル: ZHtml.php プロジェクト: emircado/pamgmt public static function enumDropDownList($model, $attribute, $htmlOptions = array(), $default = NULL) { $enumValues = self::enumItem($model, $attribute); if (!empty($default)) { // This will return a <option value="defaul"></option> $enumValues = array($default['value'] => (string) $default['label']) + $enumValues; } // echo var_export($enumValues, TRUE); return CHtml::activeDropDownList($model, $attribute, $enumValues, $htmlOptions); } コード例 #14 0 ファイルを表示 ファイル: InputField.php プロジェクト: cebe/chive public function run() { $type = DataType::getInputType($this->column->dbType); $this->htmlOptions += $this->fixedHtmlOptions[$type]; $column = $this->column->name; $name = isset($this->htmlOptions['name']) ? $this->htmlOptions['name'] : 'Row[' . $column . ']'; switch ($type) { case 'number': echo CHtml::activeTextField($this->row, $column, $this->htmlOptions); break; case 'select': echo CHtml::activeDropDownList($this->row, $column, $this->getEnumValues(), $this->htmlOptions); break; case 'select-multiple': #echo CHtml::activeListBox($this->row, $column, $this->getSetValues(), $this->htmlOptions); echo CHtml::listBox($name, $this->row->getAttributeAsArray($column), $this->getSetValues(), $this->htmlOptions); break; case 'text': echo CHtml::activeTextArea($this->row, $column, $this->htmlOptions); break; case 'file': echo '<script type="text/javascript"> $(document).ready(function() { $("# echo CHtml::$idPrefix; ?>").submit(function() { alert("ok1"); }); }); </script>'; echo CHtml::activeFileField($this->row, $column, $this->htmlOptions); break; case 'date': $this->SetDateTimeHtmlOptions($column); echo CHtml::activeTextField($this->row, $column, $this->htmlOptions); echo '<script type="text/javascript"> $(document).ready(function() { $("#' . $this->htmlOptions['id'] . '").datepicker({showOn: "button", dateFormat: "yy-mm-dd", buttonImage: "' . ICONPATH . '/16/calendar.png' . '", buttonImageOnly: true, buttonText: "' . Yii::t('core', 'showCalendar') . '"}); }); </script>'; break; case 'datetime': $this->SetDateTimeHtmlOptions($column); echo CHtml::activeTextField($this->row, $column, $this->htmlOptions); echo '<script type="text/javascript"> $(document).ready(function() { now = new Date(); $("#' . $this->htmlOptions['id'] . '").datepicker({showOn: "button", dateFormat: "yy-mm-dd " + now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds(), buttonImage: "' . ICONPATH . '/16/calendar.png' . '", buttonImageOnly: true, buttonText: "' . Yii::t('core', 'showCalendar') . '"}); }); </script>'; break; default: echo CHtml::activeTextField($this->row, $column, $this->htmlOptions); break; } } コード例 #15 0 ファイルを表示 ファイル: WhSelect2.php プロジェクト: nicovicz/reward-point /** * Renders the select2 field */ public function renderField() { list($name, $id) = $this->resolveNameID(); TbArray::defaultValue('id', $id, $this->htmlOptions); TbArray::defaultValue('name', $name, $this->htmlOptions); if ($this->hasModel()) { echo $this->asDropDownList ? CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions) : CHtml::activeHiddenField($this->model, $this->attribute); } else { echo $this->asDropDownList ? CHtml::dropDownList($this->name, $this->value, $this->data, $this->htmlOptions) : CHtml::hiddenField($this->name, $this->value); } } コード例 #16 0 ファイルを表示 ファイル: AuthAssignmentItemsColumn.php プロジェクト: pvsaintpe/yii-auth /** * Renders the filter cell content. */ protected function renderFilterCellContent() { $options = array(); /* @var $am CAuthManager|AuthBehavior */ $am = Yii::app()->authManager; /* @var $authItems CAuthItem[] */ $authItems = $am->getAuthItems(); foreach ($authItems as $itemName => $item) { $options[Yii::app()->controller->capitalize(Yii::app()->controller->getItemTypeText($item->type, true))][$itemName] = $item->description; } echo CHtml::activeDropDownList($this->grid->filter, 'authItem', $options, ['prompt' => '']); } コード例 #17 0 ファイルを表示 ファイル: TemplateSelectField.php プロジェクト: dev-lav/htdocs public function getField($widgetId, $rowGroupName = '', $rowIndex, $model, $attribute, $name, $value = '', $fieldClassName = '', $htmlOptions = array(), $hasError = false, $data = '', $params = '') { if ($hasError) { $fieldClassName = $fieldClassName . ' ' . CHtml::$errorCss; } $htmlOptions = ClonnableFields::addClass($htmlOptions, $fieldClassName); if (ClonnableFields::isModel($model)) { return CHtml::activeDropDownList($model, $attribute, $data, $htmlOptions); } else { return CHtml::dropDownList($name, $value, $data, $htmlOptions); } } コード例 #18 0 ファイルを表示 ファイル: SESAccount.php プロジェクト: dsyman2/X2CRM public function renderInput($attr) { switch ($attr) { case 'password': echo X2Html::x2ActivePasswordField($this, $attr, $this->htmlOptions($attr), true); break; case 'server': echo CHtml::activeDropDownList($this, 'server', $this->sesEndpoints, $this->htmlOptions($attr)); break; default: parent::renderInput($attr); } } コード例 #19 0 ファイルを表示 ファイル: WhMultiSelect.php プロジェクト: 2amigos/yiiwheels /** * Renders the multiselect field */ public function renderField() { list($name, $id) = $this->resolveNameID(); TbArray::defaultValue('id', $id, $this->htmlOptions); TbArray::defaultValue('name', $name, $this->htmlOptions); // fixes #32: 'multiple' will be forced later in jQuery plugin $this->htmlOptions['multiple'] = 'multiple'; if ($this->hasModel()) { echo CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions); } else { echo CHtml::dropDownList($this->name, $this->value, $this->data, $this->htmlOptions); } } コード例 #20 0 ファイルを表示 ファイル: UWrelBelongsTo.php プロジェクト: vangogogo/justsns /** * @param $model - profile model * @param $field - profile fields model item * @param $params - htmlOptions * @return string */ public function editAttribute($model, $field, $htmlOptions = array()) { $list = array(); if ($this->params['emptyField']) { $list[0] = $this->params['emptyField']; } $models = CActiveRecord::model($this->params['modelName'])->findAll(); foreach ($models as $m) { $attr = $this->params['optionName'] ? $this->params['optionName'] : 'id'; $list[$m->{$attr}] = $m->getAttribute($this->params['relationName']); } return CHtml::activeDropDownList($model, $field->varname, $list, $htmlOptions = array()); } コード例 #21 0 ファイルを表示 ファイル: DataColumn.php プロジェクト: buildshop/bs-common public function getFilterCellContent() { if (is_string($this->filter)) { return $this->filter; } elseif ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strpos($this->name, '.') === false) { if (is_array($this->filter)) { return CHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, array('id' => false, 'prompt' => '', 'class' => 'form-control')); } elseif ($this->filter === null) { return CHtml::activeTextField($this->grid->filter, $this->name, array('id' => false, 'class' => 'form-control')); } } else { return parent::getFilterCellContent(); } } コード例 #22 0 ファイルを表示 ファイル: TbSelect2.php プロジェクト: jwerd/coupon /** * Runs the widget. */ public function run() { list($name, $id) = $this->resolveNameID(); if ($this->hasModel()) { if ($this->form) { echo $this->asDropDownList ? $this->form->dropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions) : $this->form->hiddenField($this->model, $this->attribute); } else { echo $this->asDropDownList ? CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions) : CHtml::activeHiddenField($this->model, $this->attribute); } } else { echo $this->asDropDownList ? CHtml::dropDownList($name, $this->value, $this->data, $this->htmlOptions) : CHtml::hiddenField($name, $this->value); } $this->registerClientScript($id); } コード例 #23 0 ファイルを表示 ファイル: Chosen.php プロジェクト: blindest/Yii-CMS-2.0 public function run() { if (!isset($this->htmlOptions['id'])) { $this->htmlOptions['id'] = $this->id; } if (!isset($this->htmlOptions['empty'])) { $this->htmlOptions['empty'] = $this->empty; } if ($this->model) { echo CHtml::activeDropDownList($this->model, $this->attribute, $this->options, $this->htmlOptions); } else { echo CHtml::dropDownList($this->name, $this->current, $this->input_element->items, $this->input_element->attributes); } } コード例 #24 0 ファイルを表示 ファイル: CEditableColumn.php プロジェクト: buildshop/bs-common /** * Renders the filter cell content. * This method will render the {@link filter} as is if it is a string. * If {@link filter} is an array, it is assumed to be a list of options, and a dropdown selector will be rendered. * Otherwise if {@link filter} is not false, a text field is rendered. * @since 1.1.1 */ protected function renderFilterCellContent() { if (is_string($this->filter)) { echo $this->filter; } elseif ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strpos($this->name, '.') === false) { if (is_array($this->filter)) { echo CHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, array('id' => false, 'prompt' => '')); } elseif ($this->filter === null) { echo CHtml::activeTextField($this->grid->filter, $this->name, array('id' => false)); } } else { parent::renderFilterCellContent(); } } コード例 #25 0 ファイルを表示 ファイル: DivDataColumn.php プロジェクト: Aplay/anetika_site /** * Renders the filter cell content. * This method will render the {@link filter} as is if it is a string. * If {@link filter} is an array, it is assumed to be a list of options, and a dropdown selector will be rendered. * Otherwise if {@link filter} is not false, a text field is rendered. * @since 1.1.1 */ protected function renderFilterCellContent() { if (is_string($this->filter)) { echo $this->filter; } elseif ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strpos($this->name, '.') === false) { if (is_array($this->filter)) { echo CHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, array('id' => false, 'prompt' => '')); } elseif ($this->filter === null) { echo CHtml::activeTextField($this->grid->filter, $this->name, array('id' => false)); } } else { $this->filterHtmlOptions['class'] = 'divtd'; echo CHtml::openTag('div', $this->filterHtmlOptions); $this->renderFilterCellContent(); echo "</div>"; } } コード例 #26 0 ファイルを表示 ファイル: FWdropDownDep.php プロジェクト: anjanababu/Asset-Management /** * @param $model - profile model * @param $field - profile fields model item * @param $params - htmlOptions * @return string */ public function editAttribute($model, $field, $htmlOptions = array()) { $list = array(); if ($this->params['emptyField']) { $list[0] = $this->params['emptyField']; } $models = CActiveRecord::model($this->params['modelName'])->findAll(); foreach ($models as $m) { $list[$m->getAttribute($m->tableSchema->primaryKey)] = $this->params['optionName'] ? $m->getAttribute($this->params['optionName']) : $m->getAttribute($m->tableSchema->primaryKey); } return CHtml::activeDropDownList($model, $field->varname, $list, $htmlOptions = array('ajax' => array('type' => 'POST', 'url' => CController::createUrl('/fm/fields/getDroDownDepValues'), 'data' => array('model' => $this->params['modelDestName'], 'field_dest' => $this->params['destField'], 'varname' => $field->VARNAME, $field->varname => 'js:this.value', 'optionDestName' => $this->params['optionDestName']), 'success' => 'function(data){ $("#ajax_loader").hide(); $("#Profile_' . $this->params['destField'] . '").html(data) }', 'beforeSend' => 'function(){ $("#ajax_loader").fadeIn(); }'))); } コード例 #27 0 ファイルを表示 ファイル: WhFonts.php プロジェクト: 2amigos/yiiwheels /** * Renders the input file field */ public function renderField() { list($name, $id) = $this->resolveNameID(); TbArray::defaultValue('id', $id, $this->htmlOptions); TbArray::defaultValue('name', $name, $this->htmlOptions); if ($this->useHelperSelectBox) { $select = Yii::createComponent(CMap::mergeArray($this->helperOptions, array('class' => 'yiiwheels.widgets.formhelpers.WhSelectBox', 'htmlOptions' => $this->htmlOptions, 'model' => $this->model, 'attribute' => $this->attribute, 'name' => $this->name, 'value' => $this->value, 'wrapperOptions' => array('class' => 'bfh-fonts', 'data-family' => $this->hasModel() ? $this->model->{$this->attribute} : $this->value)))); $select->init(); $select->run(); } else { $this->htmlOptions['data-family'] = $this->hasModel() ? $this->model->{$this->attribute} : $this->value; if ($this->hasModel()) { echo CHtml::activeDropDownList($this->model, $this->attribute, array(), $this->htmlOptions); } else { echo CHtml::dropDownList($name, $this->value, array(), $this->htmlOptions); } } } コード例 #28 0 ファイルを表示 ファイル: WhDropDownInputWidget.php プロジェクト: mfavetti/LimeSurvey /** * Renders a dropdown list for the helper */ protected function dropDownList() { if (!$this->useHelperSelectBox) { return $this->hasModel() ? CHtml::activeDropDownList($this->model, $this->attribute, array(), $this->htmlOptions) : CHtml::dropDownList($this->name, $this->value, array(), $this->htmlOptions); } else { ob_start(); ob_implicit_flush(false); try { $widget = Yii::createComponent(array('class' => 'yiiwheels.widgets.formhelpers.WhSelectBox', 'model' => $this->model, 'attribute' => $this->attribute, 'name' => $this->name, 'value' => $this->value, 'htmlOptions' => $this->htmlOptions)); $widget->init(); $widget->run(); } catch (Exception $e) { ob_end_clean(); throw $e; } return ob_get_clean(); } } コード例 #29 0 ファイルを表示 ファイル: BDataColumn.php プロジェクト: AbuMuhammad/ap3 protected function renderFilterCellContent() { if (is_string($this->filter)) { echo $this->filter; } elseif ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strpos($this->name, '.') === false) { if (is_array($this->filter)) { echo CHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, array('id' => false, 'prompt' => '')); } elseif ($this->filter === null) { $hOptions = array('id' => false, 'accesskey' => $this->accesskey); if ($this->autoFocus) { $hOptions = array_merge($hOptions, array('autofocus' => 'autofocus')); } echo CHtml::activeTextField($this->grid->filter, $this->name, $hOptions); // 'placeholder' => '[Alt]+['.$this->accesskey.']')); } } else { parent::renderFilterCellContent(); } } コード例 #30 0 ファイルを表示 ファイル: SDropdown.php プロジェクト: narwold/Small-Potatoes /** * Run this widget. * This method renders the needed HTML code. */ public function run() { list($name, $id) = $this->resolveNameID(); if (isset($this->htmlOptions['id'])) { $id = $this->htmlOptions['id']; } else { $this->htmlOptions['id'] = $id; } if (isset($this->htmlOptions['name'])) { $name = $this->htmlOptions['name']; } if (isset($this->htmlOptions['multiple'])) { unset($this->htmlOptions['multiple']); } if ($this->hasModel()) { echo CHtml::activeDropDownList($this->model, $this->attribute, $this->value, $this->htmlOptions); } else { echo CHtml::dropDownList($name, $this->value, $this->data, $this->htmlOptions); } } 上位の関数 | 上位のクラス | ドキュメント | 個人情報保護方針 | Advertise with us PHP | C# (CSharp) | Java | Golang | C++ (Cpp) | Python | JavaScript | TypeScript EN | RU | DE | FR | ES | PT | IT | JP | ZH | KO