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


PHP Html::activeInput方法代码示例

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


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

示例1: 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

示例2: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     try {
         $this->_initAndValidate();
         $valueArray = [];
         $trees = [];
         $valueSingle = "";
         $select = "";
         $singleInput = "";
         if (in_array($this->mode, [self::MOD_COMBO, self::MOD_MULTI])) {
             $valueArray = Html::getAttributeValue($this->model, $this->attribute);
             $select = Html::activeListBox($this->model, $this->attribute, ['16' => "16"], ['multiple' => true, 'class' => 'sx-controll-element', 'style' => 'display: none;']);
             $trees = Tree::find()->where(['id' => $valueArray])->all();
         }
         if (in_array($this->mode, [self::MOD_COMBO, self::MOD_SINGLE])) {
             $singleInput = Html::activeInput("hidden", $this->model, $this->attributeSingle, ['class' => 'sx-single']);
             $valueSingle = Html::getAttributeValue($this->model, $this->attributeSingle);
         }
         $src = UrlHelper::construct('/cms/admin-tree')->set('mode', $this->mode)->set('s', $valueArray)->setSystemParam(Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->setSystemParam(Module::SYSTEM_QUERY_NO_ACTIONS_MODEL, 'true')->enableAdmin()->toString();
         $id = "sx-id-" . md5(serialize([$this->clientOptions, $this->mode, $this->attributeMulti, $this->attributeSingle]));
         $selected = [];
         foreach ($trees as $tree) {
             $selected[] = $tree->id;
         }
         return $this->render('widget', ['widget' => $this, 'id' => $id, 'select' => $select, 'src' => $src, 'valueSingle' => $valueSingle, 'singleInput' => $singleInput, 'clientOptions' => Json::encode(['src' => $src, 'name' => $id, 'id' => $id, 'selected' => $selected, 'valueSingle' => $valueSingle])]);
         //$this->registerClientScript();
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
开发者ID:Liv1020,项目名称:cms,代码行数:33,代码来源:SelectTree.php

示例3: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     $jsOptions = ['clientOptions' => $this->clientOptions];
     $this->options['id'] = 'input-id';
     if ($this->hasModel()) {
         echo Html::activeInput('file', $this->model, $this->attribute, $this->options);
         echo Html::img('#', ['id' => 'cropper-box']);
         echo Html::button('Crop', ['id' => 'cropImage']);
         $input_name = Html::getInputName($this->model, $this->attribute);
         $input_id = Html::getInputId($this->model, $this->attribute);
         echo Html::hiddenInput($input_name . '[file]', '', ['id' => $input_id . '_image']);
         $jsOptions['model'] = $this->model;
         $jsOptions['attribute'] = $this->attribute;
     } else {
         echo Html::fileInput($this->name, $this->value, $this->options);
         echo Html::img('#', ['id' => 'cropper-box']);
         echo Html::button('Crop', ['id' => 'cropImage']);
     }
     if ($this->uploadUrl) {
         $this->uploadUrl = \Yii::getAlias($this->uploadUrl);
     }
     $jsOptions['uploadUrl'] = $this->uploadUrl;
     $jsOptions['uploadCroppedUrl'] = $this->uploadCroppedUrl;
     $jsOptions['changeUrl'] = $this->changeUrl;
     $jsOptions['name'] = $this->name;
     $jsOptions['aspectRatio'] = $this->aspectRatio;
     $this->registerPlugin($jsOptions);
 }
开发者ID:servsol,项目名称:yii2-cropper,代码行数:31,代码来源:Cropper.php

示例4: 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

示例5: 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

示例6: renderTable

 public function renderTable()
 {
     $second_day = 24 * 60 * 60;
     $weekday = (int) date('N', time());
     $monday = time() - ($weekday - 1) * $second_day;
     $data = '';
     if ($this->model && $this->attribute) {
         $options = isset($this->options['inputOptions']) ? $this->options['inputOptions'] : [];
         $data = Html::activeInput('hidden', $this->model, $this->attribute, $options);
     }
     for ($i = 0; $i < 7; $i++) {
         $weekday = Yii::$app->getFormatter()->asDate($monday + $i * $second_day, 'php:D');
         $data .= Html::beginTag('tr', ['data' => ['day' => $i, 'title' => $weekday]]);
         $data .= Html::tag('td', $weekday, ['class' => 'weekday']);
         $data .= $this->renderTime($i, '-');
         $data .= Html::endTag('tr');
     }
     $data .= Html::beginTag('tr');
     $data .= Html::tag('td', '', ['class' => 'weekday']);
     for ($i = 0; $i < 24; $i++) {
         $data .= Html::tag('td', ($i <= 9 ? '&nbsp;' . $i : $i) . ':00 ' . ($i + 1 <= 9 ? '&nbsp;' . ($i + 1) : $i + 1) . ':00', ['class' => 'time']);
     }
     $data .= Html::endTag('tr');
     $return = Html::tag('div', '', ['class' => 'clearfix']);
     $return .= $this->renderButtons();
     $return .= Html::tag('div', Html::tag('table', $data, ['id' => 'schedule-week-time']), ['class' => 'col-sm-10']);
     unset($data);
     return $return;
 }
开发者ID:femike,项目名称:yii2-schedule-week-time-select,代码行数:29,代码来源:ScheduleWeekTimeSelect.php

示例7: 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

示例8: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->registerClientScript();
     if ($this->hasModel()) {
         echo Html::activeHiddenInput($this->model, $this->attribute, ['id' => null]) . Html::activeInput('file', $this->model, $this->attribute, $this->options);
     } else {
         echo Html::hiddenInput($this->name, $this->value, ['id' => null]) . Html::input('file', $this->name, $this->value, $this->options);
     }
 }
开发者ID:cliff363825,项目名称:yii2-uploadify,代码行数:12,代码来源:UploadifyWidget.php

示例9: run

 public function run()
 {
     $view = $this->getView();
     FileUploadAsset::register($view);
     $this->createUploaderOptions();
     $this->options['class'] = 'required';
     echo Html::hiddenInput(Html::getInputName($this->model, $this->attribute), '', ['id' => 'dwz-file-uploader']);
     echo Html::activeInput('file', $this->model, $this->attribute, $this->options);
 }
开发者ID:itzj86,项目名称:yii2-dwz,代码行数:9,代码来源:FileUpload.php

示例10: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->registerClientScript();
     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:mikk150,项目名称:yii2-combodate,代码行数:12,代码来源:CombodateWidget.php

示例11: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     if ($this->hasModel()) {
         $this->id = Html::getInputId($this->model, $this->attribute);
         $this->registerJs('#' . $this->htmlOptions['id'], $this->options, $this->callback);
         return Html::activeInput($this->type, $this->model, $this->attribute, $this->htmlOptions + ['class' => 'form-control']);
     } else {
         $this->registerJs('#' . $this->htmlOptions['id'], $this->options, $this->callback);
         return Html::input($this->type, $this->name, $this->value, $this->htmlOptions);
     }
 }
开发者ID:VEKsoftware,项目名称:daterangepicker,代码行数:14,代码来源:DateRangePicker.php

示例12: registerPlugin

 protected function registerPlugin()
 {
     if ($this->selector) {
         $this->registerJs($this->selector, $this->options, $this->callback);
     } else {
         $id = $this->htmlOptions['id'];
         echo Html::activeInput('text', $this->model, $this->attribute, $this->htmlOptions);
         // echo Html::tag('input', '', $this->htmlOptions);
         $this->registerJs("#{$id}", $this->options, $this->callback);
     }
 }
开发者ID:faravaghi,项目名称:yii2-jalali-daterangepicker,代码行数:11,代码来源:jalaliDateRangePicker.php

示例13: registerPlugin

 protected function registerPlugin()
 {
     if ($this->selector) {
         $this->registerJs($this->selector, $this->options, $this->callback);
     } else {
         $id = $this->options['id'];
         $input = $this->hasModel() ? Html::activeInput('text', $this->model, $this->attribute, $this->options) : Html::textInput($this->name, $this->value, $this->options);
         echo $input;
         $this->registerJs("#{$id}", $this->options, $this->callback);
     }
 }
开发者ID:faravaghi,项目名称:yii2-jalali-datepicker,代码行数:11,代码来源:jalaliDatePicker.php

示例14: run

 public function run()
 {
     $view = $this->getView();
     $id = $this->options['id'];
     //Register DtGridViewAsset
     DatepickerAsset::register($view);
     $content = Html::activeInput($this->type, $this->model, $this->attribute, $this->options);
     $clientOptions = Json::encode($this->clientOptions);
     $view->registerJs("jQuery('#{$id}').datepicker({$clientOptions});");
     return $content;
 }
开发者ID:utiuam,项目名称:uamext,代码行数:11,代码来源:Datepicker.php

示例15: run

 public function run()
 {
     //var_dump($this->attribute);exit();
     $view = $this->getView();
     $id = $this->options['id'];
     //Register DtGridViewAsset
     InputmaskAsset::register($view);
     $content = Html::activeInput($this->type, $this->model, $this->attribute, $this->options);
     $clientOptions = Json::encode($this->clientOptions);
     $alias = Json::encode($this->alias);
     $view->registerJs("jQuery('#{$id}').inputmask({$alias},{$clientOptions});");
     return $content;
 }
开发者ID:utiuam,项目名称:uamext,代码行数:13,代码来源:Inputmask.php


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