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


PHP Html::input方法代码示例

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


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

示例1: launch

 protected function launch()
 {
     echo Html::beginForm($this->url, 'get');
     echo Html::input('text', $this->queryParam, $this->query);
     echo Html::submitButton(\Yii::t('gromver.platform', 'Find'));
     echo Html::endForm();
 }
开发者ID:gromver,项目名称:yii2-platform,代码行数:7,代码来源:SearchForm.php

示例2: renderFileContent

 public function renderFileContent()
 {
     $attribute = $this->attribute;
     $input = $thumb = '';
     $selectedFileOpt = ['class' => 'fm-browse-input'];
     if ($this->model->{$attribute}) {
         $filesModel = \Yii::$app->getModule('filemanager')->models['files'];
         $file = $filesModel::findOne(['file_identifier' => $this->model->{$attribute}]);
     }
     if (isset($file) && $file) {
         $fileType = $file->mime_type;
         if ($file->dimension) {
             $src = $file->object_url . $file->thumbnail_name;
             $fileType = 'image';
         } else {
             $src = $file->object_url . $file->src_file_name;
         }
         $gridBox = new \dpodium\filemanager\components\GridBox(['owner' => $this, 'src' => $src, 'fileType' => $fileType, 'toolArray' => [['tagType' => 'i', 'options' => ['class' => 'fa-icon fa fa-times fm-remove', 'title' => Yii::t('filemanager', 'Remove')]]], 'thumbnailSize' => \Yii::$app->getModule('filemanager')->thumbnailSize]);
         foreach ($this->fileData as $attribute) {
             $value = isset($file->{$attribute}) ? $file->{$attribute} : null;
             $input .= Html::input('input', "Filemanager[{$attribute}]", $value);
         }
         $thumb = $gridBox->renderGridBox();
     } else {
         $selectedFileOpt['value'] = '';
     }
     $fileView = Html::tag('div', $thumb, ['class' => 'fm-browse-selected-view']);
     $selectedFile = Html::activeInput('input', $this->model, $this->attribute, $selectedFileOpt);
     $buttonClass = empty($this->options['class']) ? 'btn btn-primary' : $this->options['class'];
     $browseButton = Html::label(Yii::t('filemanager', 'Browse'), Html::getInputId($this->model, $this->attribute), ['class' => 'fm-btn-browse btn-browse ' . $buttonClass, 'data-url' => Url::to(['/filemanager/files/browse']), 'data-backdrop' => 'static', 'data-toggle' => 'modal', 'data-target' => '#fm-modal']);
     return $fileView . $browseButton . $selectedFile . $input;
 }
开发者ID:dpodium,项目名称:yii2-filemanager-aws2,代码行数:32,代码来源:FileBrowse.php

示例3: run

 public function run()
 {
     $this->registerClientScript();
     Html::addCssClass($this->wrapperOptions, 'input-touchspin');
     echo Html::beginTag('div', $this->wrapperOptions);
     if ($this->hasModel()) {
         if ($this->default !== false) {
             $value = $this->model->{$this->attribute};
             if (!is_numeric($value) || $value < $this->min || $value > $this->max) {
                 $this->model->{$this->attribute} = $this->default;
             }
         }
         echo Html::activeInput($this->type, $this->model, $this->attribute, $this->options);
     } else {
         if ($this->default !== false) {
             if (!is_numeric($this->value) || $this->value < $this->min || $this->value > $this->max) {
                 $this->value = $this->default;
             }
         }
         echo Html::input($this->type, $this->name, $this->value, $this->options);
     }
     echo Html::tag('div', null, ['class' => 'caret step-up']);
     echo Html::tag('div', null, ['class' => 'caret step-down']);
     echo Html::endTag('div');
 }
开发者ID:novokshonovev,项目名称:touch-spin-input,代码行数:25,代码来源:TouchSpinInput.php

示例4: run

 /**
  * @return string
  */
 public function run()
 {
     $options = ArrayHelper::merge($this->defaultOptions, $this->options);
     if ($this->hasModel()) {
         return Html::activeInput($this->htmlTagType, $this->model, $this->attribute, $options);
     }
     return Html::input($this->htmlTagType, $this->name, $this->value, $options);
 }
开发者ID:borales,项目名称:yii2-phone-input,代码行数:11,代码来源:PhoneInput.php

示例5: renderHtml

 /**
  * @inheritdoc
  */
 public function renderHtml()
 {
     if ($this->form !== null && $this->model !== null) {
         return $this->form->field($this->model, $this->attribute)->hint($this->hint)->passwordInput($this->htmlOptions);
     }
     if ($this->model !== null) {
         return Html::activePasswordInput($this->model, $this->attribute, $this->htmlOptions);
     }
     return Html::input('password', $this->name, $this->value, $this->htmlOptions);
 }
开发者ID:fengsmith1988,项目名称:qc-base,代码行数:13,代码来源:PasswordControl.php

示例6: init

 /**
  * Initializes the widget.
  * This method will register the bootstrap asset bundle. If you override this method,
  * make sure you call the parent implementation first.
  */
 public function init()
 {
     if (!isset($this->options['id'])) {
         $this->options['id'] = $this->getId();
     }
     echo Html::input($this->type, $this->name, $this->value, $this->options);
 }
开发者ID:fedemotta,项目名称:yii2-bootstrap-list-filter,代码行数:12,代码来源:BootstrapListFilter.php

示例7: run

 public function run()
 {
     $this->registerJs();
     switch ($this->style) {
         case self::STYLE_SLIDER:
             Html::addCssClass($this->options, self::STYLE_SLIDER);
             break;
         case self::STYLE_TOGGLE:
             Html::addCssClass($this->options, self::STYLE_TOGGLE);
             break;
     }
     if ($this->isDisabled) {
         Html::addCssClass($this->options, 'disabled');
         $this->inputOptions['disabled'] = 'disabled';
     }
     if ($this->isActive) {
         Html::addCssClass($this->options, 'checked');
         $this->inputOptions['checked'] = '';
     }
     if ($this->isReadOnly) {
         Html::addCssClass($this->options, 'read-only');
     }
     Html::addCssClass($this->options, 'ui checkbox');
     $body = Html::input('checkbox', $this->name, $this->value, $this->inputOptions);
     $body .= Html::tag('label', $this->label);
     echo Html::tag('div', $body, $this->options);
 }
开发者ID:he11d0g,项目名称:yii2-nuts,代码行数:27,代码来源:Checkbox.php

示例8: init

 public function init()
 {
     parent::init();
     Html::addCssClass($this->htmlOptions, 'custom-dz');
     /** @var Image[] $files */
     $files = Image::find()->where(['and', 'object_id = :objectId', 'object_model_id = :modelId'], [':objectId' => $this->objectId, ':modelId' => $this->modelId])->orderBy(['sort_order' => SORT_ASC])->all();
     /** Image $file */
     foreach ($files as $file) {
         $thumbnail_src = $file->getThumbnail('80x80');
         $this->storedFiles[] = ['id' => $file->id, 'name' => $file->filename, 'file' => $file->file, 'thumbnail' => $thumbnail_src, 'description' => $file->image_description];
     }
     $params = ArrayHelper::merge(isset($this->options['params']) ? $this->options['params'] : [], ['objectId' => $this->objectId, 'modelId' => $this->modelId]);
     $this->sortable = true;
     $this->options = ArrayHelper::merge($this->options, ['acceptedFiles' => 'image/*', 'params' => $params, 'previewTemplate' => '<div class="file-row">
                     ' . Html::input('hidden', 'id[]') . Html::input('hidden', 'file[]') . '
                     <!-- This is used as the file preview template -->
                     <div>
                         <span class="preview"><img style="width: 80px; height: 80px;" data-dz-thumbnail /></span>
                     </div>
                     <div>
                         <p class="name" data-dz-name></p>
                         <div class="dz-error-message"><span data-dz-errormessage></span></div>
                     </div>
                     <div class="description">
                         ' . Html::textarea('description', '', ['style' => 'width: 100%; min-width: 80px; height: 80px;']) . '
                     </div>
                     <div>
                         <p class="size" data-dz-size></p>
                         <div class="dz-progress progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
                           <div class="progress-bar progress-bar-success" style="width:0%;" data-dz-uploadprogress></div>
                         </div>
                         <div class="dz-success-mark"><span>✔</span> OK</div>
                         <div class="dz-error-mark"><span>✘</span> ERROR</div>
                     </div>
                     <div>
                       <button data-dz-remove class="btn btn-danger delete">
                         <i class="fa fa-trash-o"></i>
                         <span>' . Yii::t('app', 'Delete') . '</span>
                       </button>
                     </div>
                   </div>', 'thumbnailWidth' => '80', 'thumbnailHeight' => '80', 'previewsContainer' => "#{$this->id}"]);
     $this->eventHandlers = ['removedfile' => 'function(file) {
             jQuery.get(
                 "' . Url::toRoute($this->removeUrl) . '",
                 {
                     "id" : jQuery(file.previewElement).find("[name=\\"id[]\\"]").val(),
                     "filename" : jQuery(file.previewElement).data("filename")
                 }
             ).done(function (data) { return data });
         }', 'success' => 'function(file, response) {
             response = jQuery.parseJSON(response);
             jQuery(file.previewElement).find("[data-dz-name]").text(response.filename);
             jQuery(file.previewElement).data("filename", response.filename);
             jQuery(file.previewElement).find("[name=\\"id[]\\"]").val(response.afterUpload.id);
             jQuery(file.previewElement).find("[name=\\"file[]\\"]").val(response.afterUpload.file);
             jQuery(file.previewElement).find(".description textarea").attr("name", "description["+response.afterUpload.id+"]");
         }', 'complete' => 'function(file) {
             jQuery(file.previewElement).removeClass("dz-processing");
         }'];
 }
开发者ID:heartshare,项目名称:dotplant2,代码行数:60,代码来源:ImageDropzone.php

示例9: run

    public function run()
    {
        parent::run();
        $this->registerAssets();
        $view = $this->getView();
        $id = $this->getId();
        $output = '';
        $output .= Html::input('hidden', $this->inputName, null, ['id' => $this->inputId]);
        $output .= Html::beginTag('div', ['class' => 'row']);
        $output .= Html::beginTag('div', ['class' => 'col-xs-12']);
        $output .= Html::tag('canvas', '', ['class' => ['signature-input-canvas'], 'style' => ['border' => '1px solid black', 'width' => '100%']]);
        $output .= Html::endTag('div');
        $output .= Html::beginTag('div', ['class' => 'col-xs-12']);
        $output .= Html::button(\Yii::t('app', 'Clear'), ['class' => ['col-xs-12', 'btn', 'btn-default'], 'id' => $id . '-clear']);
        $output .= Html::endTag('div');
        $output .= Html::endTag('div');
        $view->registerJs(<<<JS
\$(function(){
    var canvas = \$("#{$id} .signature-input-canvas")[0];
    var signaturePad = new SignaturePad(canvas);
    
    signaturePad.onEnd = function(){
        var result = signaturePad.toDataURL();
        \$('#{$this->inputId}').val(result);
    };
    
    \$('#{$id}-clear').on('click', function(){
        \$('#{$this->inputId}').val('');
        signaturePad.clear();
    });
})
JS
);
        return Html::tag('div', $output, ['id' => $id, 'class' => ['signature-input']]);
    }
开发者ID:jc-it,项目名称:yii2-signature-input,代码行数:35,代码来源:SignatureInput.php

示例10: set_input_type

 protected function set_input_type($type, $name, $value)
 {
     if (isset($type) && isset($name) && isset($value)) {
         $input = NULL;
         $input_name = $name . '[value]';
         switch ($type) {
             case 'string':
                 $input = Html::input('text', $input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
             case 'integer':
                 $input = Html::input('number', $input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
             case 'text':
                 $input = Html::textarea($input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
             case 'boolean':
                 $input = Switchery::widget(['name' => $input_name, 'clientOptions' => ['color' => '#64bd63', 'secondaryColor' => '#dfdfdf', 'jackColor' => '#fff', 'jackSecondaryColor' => null, 'className' => 'switchery', 'disabled' => FALSE, 'disabledOpacity' => 0.5, 'speed' => '0.1s', 'size' => 'default'], 'options' => array_merge(['value' => '1'], $this->has_checked($value))]);
                 break;
             default:
                 $input = Html::input('text', $input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
         }
         return $input;
     }
     return FALSE;
 }
开发者ID:kdes70,项目名称:hotel.lok,代码行数:26,代码来源:SettingsWidget.php

示例11: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     echo Html::beginTag('div', ['class' => 'main-sidebar']);
     echo Html::beginTag('div', ['class' => 'sidebar']);
     if (isset($this->user) and count($this->user) > 0) {
         $image = isset($this->user['image']) ? $this->user['image'] : '';
         $username = isset($this->user['username']) ? $this->user['username'] : '';
         echo Html::beginTag('div', ['class' => 'user-panel']);
         echo Html::beginTag('div', ['class' => 'pull-left image']);
         echo '<img src="' . $image . '" class="img-circle" alt="user" />';
         echo Html::endTag('div');
         echo Html::beginTag('div', ['class' => 'pull-left info']);
         echo Html::tag('p', $username);
         echo Html::tag('a', '<i class="fa fa-circle text-success"></i> Online');
         echo Html::endTag('div');
         echo Html::endTag('div');
     }
     if (isset($this->search) and count($this->search) > 0) {
         $method = isset($this->search['method']) ? $this->search['method'] : 'get';
         $action = isset($this->search['action']) ? $this->search['action'] : '';
         echo Html::beginTag('form', ['method' => $method, 'action' => $action, 'class' => 'sidebar-form']);
         echo Html::beginTag('div', ['class' => 'input-group']);
         echo Html::input('text', 'q', '', ['class' => 'form-control', 'placeholder' => 'Search...']);
         echo Html::beginTag('span', ['class' => 'input-group-btn']);
         echo Html::submitButton(Html::tag('i', '', ['class' => 'fa fa-search']), ['id' => 'search-btn', 'class' => "btn btn-flat"]);
         echo Html::endTag('span');
         echo Html::endTag('div');
         echo Html::endTag('form');
     }
 }
开发者ID:hscstudio,项目名称:yii2-startup,代码行数:34,代码来源:SideNavBar.php

示例12: run

 public function run()
 {
     $input = Html::input('text', 'code', '', ['class' => 'form-control buy-by-code-input', 'placeholder' => yii::t('order', 'Code')]);
     $error = Html::tag('div', '', ['class' => 'error-block', 'style' => 'color: red; position: absolute; top: -17px;']);
     $button = Html::tag('button', '<i class="glyphicon glyphicon-plus"></i>', ['data-href' => Url::toRoute(['tools/buy-product-by-code']), 'type' => 'submit', 'class' => 'btn btn-success promo-code-enter-btn']);
     $button = Html::tag('span', $button, ['class' => 'input-group-btn']);
     return Html::tag('div', $error . $input . $button, ['class' => 'input-group buy-by-code']);
 }
开发者ID:pistol88,项目名称:yii2-order,代码行数:8,代码来源:BuyByCode.php

示例13: run

 public function run()
 {
     if ($this->hasModel()) {
         echo Html::activeInput('text', $this->model, $this->attribute, $this->options);
     } else {
         echo Html::input('text', $this->name, $this->value, $this->options);
     }
 }
开发者ID:asofter,项目名称:yii2-tagsinput,代码行数:8,代码来源:TagsInput.php

示例14: run

 public function run()
 {
     $model = $this->model;
     $input = Html::input('text', 'code', '', ['class' => 'input buy']);
     //$button = Html::submitButton('В корзину', ['class' => 'btn btn-lg ', 'name' => 'buy-button']);
     $button = Html::submitInput('В корзину', ['class' => 'btn btn-primary', 'name' => 'buy-button']);
     return Html::tag('div', $input . ' ' . $button, ['class' => 'buy-button']);
 }
开发者ID:slam-mt,项目名称:yii2-shop,代码行数:8,代码来源:Buy.php

示例15: renderNavItem

 /**
  * @return string
  */
 public function renderNavItem()
 {
     $output = '<li>' . Html::beginForm($this->action, $this->method, $this->formOptions) . '<div class="input-group">';
     $output .= Html::input('text', $this->name, $this->value, $this->inputOptions);
     $output .= '<div class="input-group-btn">';
     $output .= Html::button('<i class="glyphicon glyphicon-search"></i>', $this->buttonOptions);
     $output .= '</div></div>' . Html::endForm() . '</li>';
     return $output;
 }
开发者ID:hauntd,项目名称:help-center,代码行数:12,代码来源:NavSearchItem.php


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