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


PHP Html::hiddenInput方法代码示例

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


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

示例1: settingField

 /**
  * @param $item
  * @return string
  */
 public static function settingField($key, $item, $traslateCategory)
 {
     $return = '';
     switch ($item['type']) {
         case 'checkbox':
             $return = parent::beginTag('div', ['class' => 'form-group']) . parent::beginTag('label', ['class' => 'col-md-3 control-label']) . \Yii::t($traslateCategory, $key) . parent::endTag('label') . parent::beginTag('div', ['class' => 'col-md-9']) . parent::hiddenInput('Settings[' . $key . ']', 0) . \oakcms\bootstrapswitch\Switcher::widget(['id' => 'wid' . uniqid(), 'name' => 'Settings[' . $key . ']', 'checked' => $item['value']]) . parent::endTag('div') . parent::endTag('div');
             break;
         case 'textInput':
             $return = parent::beginTag('div', ['class' => 'form-group']) . parent::beginTag('label', ['class' => 'col-md-3 control-label']) . \Yii::t($traslateCategory, $key) . parent::endTag('label') . parent::beginTag('div', ['class' => 'col-md-9']) . parent::textInput('Settings[' . $key . ']', $item['value'], ['class' => 'form-control']) . parent::endTag('div') . parent::endTag('div');
             break;
         case 'textarea':
             $return = parent::beginTag('div', ['class' => 'form-group']) . parent::beginTag('label', ['class' => 'col-md-3 control-label']) . \Yii::t($traslateCategory, $key) . parent::endTag('label') . parent::beginTag('div', ['class' => 'col-md-9']) . parent::textarea('Settings[' . $key . ']', $item['value'], ['class' => 'form-control']) . parent::endTag('div') . parent::endTag('div');
             break;
         case 'mediaInput':
             $return = parent::beginTag('div', ['class' => 'form-group']) . parent::beginTag('label', ['class' => 'col-md-3 control-label']) . \Yii::t($traslateCategory, $key) . parent::endTag('label') . parent::beginTag('div', ['class' => 'col-md-9']) . InputFile::widget(['id' => 'wid' . uniqid(), 'language' => \Yii::$app->language, 'filter' => 'image', 'name' => 'Settings[' . $key . ']', 'value' => $item['value']]) . parent::endTag('div') . parent::endTag('div');
             break;
         default:
             $return = '';
             break;
     }
     return $return;
 }
开发者ID:oakcms,项目名称:oakcms,代码行数:26,代码来源:Html.php

示例2: registerAssets

    private function registerAssets()
    {
        GalleryAssets::register($this->getView());
        $this->getView()->registerJs('
            function insertImagePath(element){
                var data = $("#let_galleries").val();
                if (data == ""){
                    $("#let_galleries").val($(element).attr("id"));
                } else {
                    $("#let_galleries").val(data.concat("," + $(element).attr("id")));
                }
            }

            function addImageByGallery(type){
                var module = "' . $this->moduleName . '",
                    columns = \'' . \yii\helpers\Json::encode($this->columns) . '\',
                    image = $("#image").val();

                $.ajax({
                    url: "' . \yii\helpers\Url::to(['/gallery/ajax/additemimage']) . '",
                    type: "post",
                    data: {type: type, module: module, columns: columns, image: image},
                }).done(function (data) {
                    if (data.length > 0) {
                        $("#tableImage").append(data);
                        $("#sya_gallery").modal("hide");
                    }
                });
            }
            
            // Ham xoa anh
            function removeImage(element){
                var confirmAlert = confirm("' . Yii::t('yii', 'Are you sure you want to delete this item?') . '");
                if (confirmAlert == true){
                    $(element).parents("#imageItem").remove();
                    // Kiem tra co anh trong gallery hay khong
                    if ($("#tableImage").children().length == 0) {
                        $("#tableImage").append(\'' . Html::hiddenInput($this->moduleName . '[gallery]', '', ['class' => 'form-control']) . '\');
                    }
                }
            }
        ', \yii\web\View::POS_END);
        $this->getView()->registerJs('
            // Sap xep anh
            $("#tableImage").sortable({});

            // Dropzone drop and drag file
            Dropzone.options.myAwesomeDropzone = {
                uploadMultiple: true,
                parallelUploads: 100,
                maxFiles: 100,
                paramName: "image",
                params: {
                    type: "' . self::TYPE_UPLOAD . '",
                    module: "' . $this->moduleName . '",
                    columns: \'' . \yii\helpers\Json::encode($this->columns) . '\'
                },
                autoDiscover: false,
                url: "' . \yii\helpers\Url::to(['/gallery/ajax/additemimage']) . '",
                headers: {
                    "Accept": "*/*",
                    "' . \yii\web\Request::CSRF_HEADER . '": "' . Yii::$app->getRequest()->csrfToken . '",
                    "Access-Control-Allow-Origin": "*"
                },

                // Dropzone settings
                init: function() {
                    this.on("sendingmultiple", function(image, xhr, formData) {
                        formData.processData = false;
                        formData.contentType = false;
                        formData.enctype = "multipart/form-data";
                    });

                    this.on("successmultiple", function(files, responseText, e) {
                        $("#tableImage").append(responseText);
                    });
                }
            }

            // Forcus input
            $(".custom_modal_gallery a[data-toggle=\'tab\']").on("shown.bs.tab", function (e) {
                $("#insert_image").attr("data-type", $(e.target).attr("data-type"));
                $(e.target).parents(".tabs-container").find("#image").focus();
            })

            $("#image").on("input",function(e){
                $.ajax({
                    url: "' . \yii\helpers\Url::to(['/gallery/ajax/getimagepreview']) . '",
                    type: "post",
                    data: {image: $(this).val()},
                }).done(function (data) {
                    $("#embed_url_settings").html(data);
                });
            });

            $("#insert_image").click(function() {
                addImageByGallery($(this).attr("data-type"));
            });
        ', yii\web\View::POS_READY);
    }
开发者ID:heartshare,项目名称:yii2-gallery,代码行数:100,代码来源:Gallery.php

示例3: generateProductOrder

 /**
  * Function generate list product order
  * @param array $products list product [
  *      1 => [
  *          'id' => 1,
  *          'sku' => '123',
  *          'title' => 'sdsd',
  *          'price' => 50000,
  *          'quantity' => 1,
  *          'is_marketing' => '1',
  *      ]
  * ]
  * @return string
  */
 public function generateProductOrder($products = [], $shipping = 0)
 {
     if (!empty($products)) {
         // IF shipping is not number then assign value shipping = 0
         if (!is_integer(intval($shipping))) {
             $shipping = 0;
         }
         // Get model name of product
         $ecommerce = Ecommerce::module();
         $modelName = end(explode('\\', $ecommerce->itemModule));
         $columnProduct = ArrayHelper::getValue($ecommerce->productTable, 'fieldOrder');
         // Begin list product order
         $template = Html::beginTag('div', ['class' => 'table-responsive']);
         $template .= Html::beginTag('table', ['class' => 'table table-striped']);
         // Begin header table
         $template .= Html::beginTag('thead');
         $template .= Html::beginTag('tr');
         $template .= Html::beginTag('th');
         $template .= Yii::t('ecommerce', 'ID');
         $template .= Html::endTag('th');
         foreach ($columnProduct as $column => $item) {
             $template .= Html::beginTag('th');
             $template .= Yii::t('ecommerce', ucfirst($column));
             $template .= Html::endTag('th');
         }
         $template .= Html::beginTag('th');
         $template .= Yii::t('ecommerce', 'Quantity');
         $template .= Html::endTag('th');
         $template .= Html::beginTag('th', ['colspan' => 2]);
         $template .= Yii::t('ecommerce', 'Total Price');
         $template .= Html::endTag('th');
         if ($ecommerce->enableActivitionCode) {
             $template .= Html::beginTag('th');
             $template .= Yii::t('ecommerce', 'Activation Code');
             $template .= Html::endTag('th');
         }
         $template .= Html::endTag('tr');
         $template .= Html::endTag('thead');
         // End header table
         // Begin list product
         $template .= Html::beginTag('tbody');
         $sumTotal = 0;
         foreach ($products as $product) {
             // Get value in product
             $id = ArrayHelper::getValue($product, 'id', '');
             $sku = ArrayHelper::getValue($product, 'sku', '');
             $title = ArrayHelper::getValue($product, 'title', '');
             $price = ArrayHelper::getValue($product, 'price', 0);
             $quantity = ArrayHelper::getValue($product, 'quantity', 1);
             $is_marketing = ArrayHelper::getValue($product, 'is_marketing', '1');
             $activationCode = ActivationCode::find()->select(['code'])->where(['product_id' => $id, 'order_id' => Yii::$app->request->get('id')])->one();
             $total = $price * $quantity;
             $sumTotal += $total;
             $template .= Html::beginTag('tr');
             $template .= Html::beginTag('td', ['class' => 'text-vertical']);
             $template .= Html::tag('span', $id, ['class' => 'product_id']);
             $template .= Html::hiddenInput($modelName . '[product][' . $id . '][id]', $id, ['class' => 'form-control', 'readonly' => true]);
             $template .= Html::endTag('td');
             foreach ($columnProduct as $column => $item) {
                 $template .= Html::beginTag('td', ['class' => 'text-vertical']);
                 $value = $valueColumn = ArrayHelper::getValue($product, $column, '');
                 if ('price' == $column) {
                     $value = ArrayHelper::getValue($product, $column, 0);
                     $valueColumn = Yii::$app->formatter->asDecimal($value, 0) . ' VNĐ';
                 }
                 $template .= $valueColumn;
                 $template .= Html::hiddenInput($modelName . '[product][' . $id . '][' . $column . ']', $value, ['class' => 'form-control', 'readonly' => true]);
                 $template .= Html::endTag('td');
             }
             $template .= Html::beginTag('td', ['style' => 'width: 5%;']);
             if ($ecommerce->multiple) {
                 $template .= Html::textInput($modelName . '[product][' . $id . '][quantity]', $quantity, ['class' => 'form-control product_qty text-center', 'onkeyup' => 'return totalPriceProduct(this);']);
             } else {
                 $template .= $quantity;
                 $template .= Html::hiddenInput($modelName . '[product][' . $id . '][quantity]', $quantity, ['class' => 'form-control product_qty text-center', 'onkeyup' => 'return totalPriceProduct(this);']);
             }
             $template .= Html::endTag('td');
             $template .= Html::beginTag('td', ['class' => 'text-vertical', 'colspan' => 2]);
             $template .= Html::tag('span', Yii::$app->formatter->asDecimal($total, 0) . ' VNĐ', ['class' => 'product_total', 'data-total' => $total]);
             $template .= Html::endTag('td');
             if ($ecommerce->enableActivitionCode) {
                 $template .= Html::beginTag('td', ['class' => 'text-vertical']);
                 $template .= ArrayHelper::getValue($activationCode, 'code', null);
                 $template .= Html::endTag('td');
             }
             $template .= Html::endTag('tr');
//.........这里部分代码省略.........
开发者ID:sya0710,项目名称:yii2-ecommerce,代码行数:101,代码来源:Order.php

示例4:

                <div class="col-sm-5">
                </div>
                <div class="col-sm-3">
                    <?php 
echo $form->field($model, 'repetir_val')->textInput(['placeholder' => 'Valor']);
?>
                </div>
                <div class="col-sm-4">
                    <?php 
echo $form->field($model, 'repetir_termina')->textInput(['placeholder' => 'Data']);
?>
                </div>
            </div>

            <?php 
echo \yii\bootstrap\Html::hiddenInput('Atividades[condicional_dia_util]', 0);
?>
            <?php 
echo $form->field($model, 'condicional_dia_util')->dropDownList(Yii::$app->params['condicional_dia_util']);
?>
            <?php 
echo $form->field($model, 'procedimento')->textarea(['rows' => 6]);
?>
            <div class="form-group field-atividades-procedimento">
                <label class="control-label col-md-5" for="atividades-procedimento">Anexos</label>
                <div class="col-md-7">
                    <input type="file" id="atividades-anexos" name="Atividades[anexos][]">
                </div>
                <div class="col-md-offset-5 col-md-7"></div>
                <div class="col-md-offset-5 col-md-7"><div class="help-block"></div></div>
            </div>
开发者ID:brunofunny,项目名称:agob,代码行数:31,代码来源:_form.php

示例5: implode

    <div class="row m-b-sm">
        <div class="col-lg-12">
            <div id="msg" style="display: none;" class="alert alert-dismissable"></div>
            <?php 
if (!empty($role)) {
    echo Html::buttonInput(Yii::t('common', 'Save'), ['class' => 'btn btn-primary m-r-md', 'onclick' => 'addPermissionFromRole();']);
}
echo Html::dropDownList('choseRole', $role, ArrayHelper::map($auth->getRoles(), 'name', 'description'), ['prompt' => Yii::t('account', 'Select a role'), 'class' => 'chosen-select', 'id' => 'role', 'onchange' => 'changeUrlPermission()']);
?>
        </div>
    </div>
    <div id="message"></div>

    <?php 
if (!empty($role)) {
    echo Html::hiddenInput('allPermission', implode(',', \app\helpers\ArrayHelper::map($dataProvider->getModels(), '_id', 'name')), ['id' => 'allPermission']);
    echo GridView::widget(['panel' => ['heading' => Yii::t(Yii::$app->controller->module->id, 'Account'), 'tableOptions' => ['id' => 'listDefault']], 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'app\\modules\\account\\components\\SelectPermissionForRoleColumn'], 'name', 'description', 'rule_name'], 'responsive' => true, 'hover' => true]);
}
?>


</div>
<script type="text/javascript">
    function addPermissionFromRole() {
        var ids = $('input[name="selection[]"]:checked').serialize();
        var choseRole = $('#role option:selected').val();
        var allpermission = $('#allPermission').val();
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "<?php 
开发者ID:quynhvv,项目名称:stepup,代码行数:31,代码来源:permission.php

示例6:

    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><?php 
echo Yii::t('common', 'Information');
?>
</h5>
                </div>
                <div class="ibox-content">
                    <?php 
$form = ActiveForm::begin(['id' => 'formDefault', 'layout' => 'horizontal', 'options' => ['enctype' => 'multipart/form-data'], 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-2', 'wrapper' => 'col-sm-10', 'error' => 'help-block m-b-none', 'hint' => '']]]);
// Image
$imageConfig = ['options' => ['accept' => 'uploads/*'], 'pluginOptions' => ['previewFileType' => 'image', 'showCaption' => FALSE, 'showRemove' => FALSE, 'showUpload' => FALSE, 'browseClass' => 'btn btn-primary btn-block', 'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => 'Select Photo', 'removeClass' => 'btn btn-danger', 'removeLabel' => "Delete", 'removeIcon' => '<i class="glyphicon glyphicon-trash"></i>', 'allowedFileExtensions' => ['jpg', 'gif', 'png', 'jpeg']]];
if (!empty($model->image)) {
    $imageConfig['pluginOptions']['initialPreview'] = [Html::img(LetHelper::getFileUploaded($model->image), ['class' => 'file-preview-image'])];
}
// END Image
$tabs = [['label' => Yii::t('common', 'General information'), 'content' => $form->field($model, 'name')->textInput() . $form->field($model, 'class')->textInput() . $form->field($model, 'skin')->textInput() . $form->field($model, 'image')->widget(FileInput::classname(), $imageConfig) . $form->field($model, 'content')->widget(letyii\tinymce\Tinymce::className(), ['options' => ['style' => 'height: 400px;'], 'configs' => ['plugins' => 'moxiemanager advlist autolink lists link image charmap print preview hr anchor pagebreak ' . 'searchreplace wordcount visualblocks visualchars code fullscreen ' . 'insertdatetime media nonbreaking save table contextmenu directionality ' . 'emoticons template paste textcolor colorpicker textpattern', 'toolbar1' => 'insertfile undo redo | styleselect | fontselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image', 'toolbar2' => 'print preview media | forecolor backcolor emoticons', 'moxiemanager_image_settings' => ['moxiemanager_title' => 'Images', 'moxiemanager_extensions' => 'jpg,png,gif', 'moxiemanager_rootpath' => '/uploads/editor', 'moxiemanager_view' => 'thumbs'], 'external_plugins' => ['moxiemanager' => Url::base() . '/plugins/moxiemanager/plugin.min.js'], 'entity_encoding' => 'raw', 'force_p_newlines' => true, 'force_br_newlines' => false, 'auto_cleanup_word' => false, 'relative_urls' => true, 'convert_urls' => false, 'remove_script_host' => true, 'verify_html' => false, 'forced_root_block' => false, 'content_css' => 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css', 'templates' => Url::to(['template'])]]) . $form->field($model, 'description')->textarea() . $form->field($model, 'promotion')->widget(SwitchInput::className(['type' => SwitchInput::RADIO])) . $form->field($model, 'status')->widget(SwitchInput::className(['type' => SwitchInput::RADIO])), 'active' => true], ['label' => 'Seo', 'content' => $form->field($model, 'slug')->textInput() . $form->field($model, 'slug_prefix')->textInput() . $form->field($model, 'seo_url')->textInput() . $form->field($model, 'seo_title')->textInput() . $form->field($model, 'seo_desc')->textInput(), $form->field($model, 'seo_keyword')->textInput()]];
echo Html::hiddenInput('save_type', 'save');
echo yii\bootstrap\Tabs::widget(['items' => $tabs]);
ActiveForm::end();
?>
                </div>
            </div>
        </div>
    </div>
</div>


开发者ID:quynhvv,项目名称:stepup,代码行数:28,代码来源:form.php

示例7: function

     <div class="box-body">
         <?php 
 echo GridView::widget(['dataProvider' => $transferDataProvider, 'tableOptions' => ['class' => 'table table-hover'], 'layout' => "{items}\n{pager}", 'rowOptions' => function ($model) {
     return ['class' => $model->hasErrors('password') ? 'danger' : ''];
 }, 'columns' => [['attribute' => 'domain', 'format' => 'raw', 'value' => function ($model, $key, $i) {
     $html = Html::tag('span', $model->domain, ['class' => 'text-bold']);
     /** @var Domain $model */
     if (!$model->hasErrors('password')) {
         $html .= Html::hiddenInput("DomainTransferProduct[{$i}][name]", $model->domain);
     }
     return $html;
 }], ['attribute' => 'password', 'format' => 'raw', 'value' => function ($model, $key, $i) {
     $html = $model->password;
     /** @var Domain $model */
     if (!$model->hasErrors('password')) {
         $html .= Html::hiddenInput("DomainTransferProduct[{$i}][password]", $model->password);
     }
     return $html;
 }], ['label' => Yii::t('hipanel:domain', 'Additional message'), 'value' => function ($model) {
     /* @var Domain $model */
     return $model->hasErrors('password') ? $model->getFirstError('password') : '';
 }]]]);
 ?>
     </div>
     <div class="box-footer">
         <?php 
 echo Html::submitButton('<i class="fa fa-shopping-cart"></i> ' . Yii::t('hipanel:domain', 'Add to cart'), ['class' => 'btn btn-success']);
 ?>
         <?php 
 echo Html::a(Yii::t('hipanel:domain', 'Return to transfer form'), ['transfer'], ['class' => 'btn btn-default']);
 ?>
开发者ID:hiqdev,项目名称:hipanel-module-domain,代码行数:31,代码来源:index.php

示例8:

<div id="field-<?php 
echo $selector;
?>
" class="form-group uploader">
    <div class="fullinput">
        <div class="uploader-browse">
            <?php 
echo FileInput::widget(['model' => $model, 'attribute' => $attribute, 'options' => ['id' => $selector, 'onchange' => 'readFile(this, "' . $selector . '", ' . (int) $crop . ', ' . Json::encode($jcropSettings) . ')'], 'pluginOptions' => ['showRemove' => false, 'uploadAsync' => false, 'showUpload' => false, 'showUploadedThumbs' => false, 'showPreview' => false, 'previewFileType' => false]]);
?>
        </div>
    </div>
    <?php 
if ($crop) {
    ?>
        <?php 
    echo Html::hiddenInput($model->formName() . "[{$attribute}-coords][x]", null, ['id' => "{$selector}-coords-x"]);
    ?>
        <?php 
    echo Html::hiddenInput($model->formName() . "[{$attribute}-coords][w]", null, ['id' => "{$selector}-coords-w"]);
    ?>
        <?php 
    echo Html::hiddenInput($model->formName() . "[{$attribute}-coords][y]", null, ['id' => "{$selector}-coords-y"]);
    ?>
        <?php 
    echo Html::hiddenInput($model->formName() . "[{$attribute}-coords][h]", null, ['id' => "{$selector}-coords-h"]);
    ?>
    <?php 
}
?>
</div>
开发者ID:elgorm,项目名称:yii2-uploadable-cropable-image,代码行数:30,代码来源:view.php

示例9: getGalleryByPath

 /**
  * Ham lay ra hinh anh trong website theo duong dan
  * @param string $path duong dan chua anh
  * @param string $template hinh anh duoc lay ra tu thu muc upload
  * @return string
  */
 private function getGalleryByPath($path, $template = '')
 {
     // Duong dan chua anh
     $rootPath = Yii::getAlias(Yii::$app->getModule('gallery')->syaDirPath);
     // Thu muc upload
     $dirPath = Yii::$app->getModule('gallery')->syaDirUpload;
     if (!file_exists($path)) {
         return null;
     }
     $entrys = scandir($path);
     foreach ($entrys as $entry) {
         if (in_array($entry, ['.', '..', 'cache'])) {
             continue;
         }
         $entryPath = $path . DIRECTORY_SEPARATOR . $entry;
         if (is_dir($entryPath)) {
             $template .= self::getGalleryByPath($entryPath, $template);
         } else {
             if (in_array(end(explode('.', $entry)), self::$fileType)) {
                 $imgPath = str_replace($rootPath . $dirPath . DIRECTORY_SEPARATOR, '', $entryPath);
                 $template .= Html::beginTag('div', ['class' => 'col-md-3 text-center']);
                 // input chua cac image duoc chon
                 $template .= Html::hiddenInput('let_galleries', '', ['id' => 'let_galleries', 'class' => 'col-md-3 text-center input_image', 'data-type' => 'path']);
                 // View image
                 $template .= Html::beginTag('div', ['class' => 'letImgPreview', 'id' => $imgPath, 'onclick' => 'insertImagePath(this);']);
                 $template .= Html::img('@web/' . $dirPath . DIRECTORY_SEPARATOR . $imgPath, ['style' => 'max-width: 100%; height: 200px;']);
                 $template .= Html::endTag('div');
                 $template .= Html::endTag('div');
             }
         }
     }
     return $template;
 }
开发者ID:heartshare,项目名称:yii2-gallery,代码行数:39,代码来源:Gallery.php

示例10:

<div id="<?php 
echo $id;
?>
">
<ul class="file-manager-images">
    <?php 
foreach ($images as $image) {
    ?>
        <li>
            <?php 
    echo Html::button('<i class="glyphicon glyphicon-remove-circle"></i>', ['class' => 'btn-remove']);
    ?>
            <?php 
    echo Html::img($image->getThumbnail(300, 300));
    ?>
            <?php 
    echo Html::hiddenInput("{$options['name']}[{$image->id}]", $image->url);
    ?>
        </li>
    <?php 
}
?>
</ul>

<?php 
Modal::begin(['header' => Html::tag('h2', Yii::t('app', 'Image manager')), 'toggleButton' => ['label' => $buttonCaption, 'class' => 'btn btn-default'], 'size' => Modal::SIZE_LARGE]);
Modal::end();
?>
</div>
开发者ID:vetoni,项目名称:toko,代码行数:29,代码来源:attachments.php

示例11: getItem

 /**
  * @param null $options
  * @param null $pluginOptions
  *
  * @return string
  * @throws \Exception
  */
 public function getItem($options = null, $pluginOptions = null)
 {
     switch ($this->type) {
         case self::TYPE_TEXT:
             return Html::input('text', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_EMAIL:
             return Html::input('email', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_NUMBER:
             return Html::input('number', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_TEXTAREA:
             return Html::textarea('Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_COLOR:
             return ColorInput::widget(['value' => $this->value, 'name' => 'Setting[' . $this->code . ']', 'options' => $options != null ? $options : ['class' => 'form-control']]);
         case self::TYPE_DATE:
             return DatePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['format' => 'yyyy-mm-dd', 'todayHighlight' => true]]);
         case self::TYPE_TIME:
             return TimePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['minuteStep' => 1, 'showSeconds' => true, 'showMeridian' => false]]);
         case self::TYPE_DATETIME:
             return DateTimePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => ['format' => 'yyyy-mm-dd H:i:s', 'todayHighlight' => true]]);
         case self::TYPE_PASSWORD:
             return PasswordInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['showMeter' => true, 'toggleMask' => false]]);
         case self::TYPE_ROXYMCE:
             return RoxyMceWidget::widget(['id' => 'Setting_' . $this->code, 'name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'action' => Url::to(['roxymce/default']), 'options' => $options != null ? $options : ['title' => $this->getName()], 'clientOptions' => $pluginOptions != null ? $pluginOptions : []]);
         case self::TYPE_SELECT:
             return Select2::widget(['value' => $this->value, 'name' => 'Setting[' . $this->code . ']', 'data' => $this->getStoreRange(), 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => ['allowClear' => true]]);
         case self::TYPE_MULTI_SELECT:
             $options['multiple'] = true;
             if (!isset($options['class'])) {
                 $options['class'] = 'form-control';
             }
             return Select2::widget(['name' => 'Setting[' . $this->code . ']', 'value' => explode(",", $this->value), 'data' => $this->getStoreRange(), 'options' => $options, 'pluginOptions' => ['allowClear' => true]]);
         case self::TYPE_FILE_PATH:
             $value = Yii::getAlias($this->store_dir) . DIRECTORY_SEPARATOR . $this->value;
             return FileInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $value, 'options' => $options != null ? $options : ['class' => 'form-control', 'multiple' => false], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['previewFileType' => 'any', 'showRemove' => false, 'showUpload' => false, 'initialPreview' => !$this->isNewRecord ? [$this->value] : []]]);
         case self::TYPE_FILE_URL:
             $value = $this->store_url . '/' . $this->value;
             return FileInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['previewFileType' => 'any', 'showRemove' => false, 'showUpload' => false, 'initialPreviewAsData' => true, 'initialPreviewFileType' => self::fileType(pathinfo($this->value, PATHINFO_EXTENSION)), 'initialPreview' => !$this->isNewRecord ? $value : [], 'initialCaption' => $this->value]]);
         case self::TYPE_PERCENT:
             return RangeInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'html5Options' => ['min' => 0, 'max' => 100, 'step' => 1], 'options' => $options != null ? $options : ['class' => 'form-control'], 'addon' => ['append' => ['content' => '%']]]);
         case self::TYPE_SWITCH:
             $selector = explode(',', $this->store_range);
             if (count($selector) != 2) {
                 throw new ErrorException(Yii::t('setting', 'Switch Field should have store with 2 value, and negative is first. Example: no,yes'), 500);
             }
             return Html::hiddenInput('Setting[' . $this->code . ']', $selector[0]) . SwitchInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $selector[1], 'containerOptions' => ['class' => 'nv-switch-container'], 'options' => $options != null ? $options : [], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['state' => $this->value == $selector[1], 'size' => 'small', 'offText' => ucfirst($selector[0]), 'onText' => ucfirst($selector[1])]]);
         case self::TYPE_CHECKBOX:
             $random = rand(1000, 9999);
             return Html::checkboxList('Setting[' . $this->code . ']', explode(",", $this->value), $this->getStoreRange(), $options != null ? $options : ['class' => 'nv-checkbox-list checkbox', 'item' => function ($index, $label, $name, $checked, $value) use($random) {
                 $html = Html::beginTag('div');
                 $html .= Html::checkbox($name, $checked, ['id' => 'Setting_checkbox_' . $label . '_' . $index . '_' . $random, 'value' => $value]);
                 $html .= Html::label($label, 'Setting_checkbox_' . $label . '_' . $index . '_' . $random);
                 $html .= Html::endTag('div');
                 return $html;
             }]);
         case self::TYPE_RADIO:
             $random = rand(1000, 9999);
             return Html::radioList('Setting[' . $this->code . ']', $this->value, $this->getStoreRange(), $options != null ? $options : ['class' => 'nv-checkbox-list radio', 'item' => function ($index, $label, $name, $checked, $value) use($random) {
                 $html = Html::beginTag('div');
                 $html .= Html::radio($name, $checked, ['id' => 'Setting_radio_' . $label . '_' . $index . '_' . $random, 'value' => $value]);
                 $html .= Html::label($label, 'Setting_radio_' . $label . '_' . $index . '_' . $random);
                 $html .= Html::endTag('div');
                 return $html;
             }]);
         case self::TYPE_SEPARATOR:
             return '<hr>';
         default:
             return Html::input('text', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
     }
 }
开发者ID:navatech,项目名称:yii2-setting,代码行数:76,代码来源:Setting.php

示例12:

    echo Html::hiddenInput('getAll', $widget->getAll);
    echo Html::hiddenInput('title', $widget->title);
    echo Html::submitButton($widget->htmlButtonName, ['class' => $widget->buttonClass]);
    echo Html::endForm();
}
?>
</div>
<div class="<?php 
echo $widget->blockClass;
?>
" style="<?php 
echo $widget->blockStyle;
?>
">
    <?php 
//if ($widget->html) {
if ($widget->pdf) {
    echo Html::beginForm(['/export/pdf'], 'post');
    echo Html::hiddenInput('model', $widget->model);
    echo Html::hiddenInput('searchAttributes', $widget->searchAttributes);
    echo Html::hiddenInput('sort', $widget->sort);
    echo Html::hiddenInput('page', $widget->page);
    echo Html::hiddenInput('getAll', $widget->getAll);
    echo Html::hiddenInput('title', $widget->title);
    echo Html::submitButton($widget->pdfButtonName, ['class' => $widget->buttonClass]);
    echo Html::endForm();
}
?>
</div>

开发者ID:phpnt,项目名称:yii2-export,代码行数:29,代码来源:view.php

示例13: empty

<?php 
}
?>

<div id="sc-destination-new" style="margin-top: 20px;<?php 
if (is_null($model) && !empty($destinations)) {
    echo "display:none;";
}
?>
">
    <?php 
if (is_null($model)) {
    $model = new \app\models\UserShippingAddress();
}
$form = ActiveForm::begin(['action' => Url::to(['shopcart/destination-save']), 'layout' => 'horizontal']);
echo Html::hiddenInput('id', $model->id);
?>
    <h3>1. <?php 
echo empty($model->id) ? Yii::t('app', 'Add New Destination') : Yii::t('app', 'Update Destination');
?>
</h3>
    <?php 
echo $form->errorSummary([$model]);
?>

    <div class="row">
        <div class="col-sm-4">
            <div style="margin-bottom: 4px;"><?php 
echo Yii::t('app', 'First and Last Name');
?>
</div>
开发者ID:rcjusto,项目名称:simplestore,代码行数:31,代码来源:_sc_destination.php

示例14:

"><?php 
echo Yii::t('account', 'Action list');
?>
</a></li>
    </ul>

    <div class="wrapper wrapper-content  animated fadeInRight">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox ">
                    <div class="ibox-title">
                        <h5>Nestable custom theme list</h5>
                    </div>
                    <div class="ibox-content">
                        <?php 
echo Html::hiddenInput('user_id', Yii::$app->request->get('user_id', ''));
?>
                        <div class="dd" id="nestable2">
                            <?php 
echo $treeHtml;
?>
                        </div>

                    </div>

                </div>
            </div>
        </div>
    </div>

</div>
开发者ID:quynhvv,项目名称:stepup,代码行数:31,代码来源:assign.php

示例15:

            $bgClass = 'bg-danger';
            $radioClass = 'radio-danger';
            break;
    }
    $return = '<div class="radio ' . $radioClass . ' ' . $bgClass . '">';
    $return .= '<input id="AdRealEstate-style-' . $value . '" type="radio" name="' . $name . '" value="' . $value . '" style="outline: none;" ' . $checked . '>';
    $return .= '<label for="AdRealEstate-style-' . $value . '">' . $label . '</label>';
    $return .= '</div>';
    return $return;
}]);
?>

    </div>
    <div class="col-md-12 text-center">
        <?php 
echo Html::hiddenInput('cityString', $modelAdMain->getCity());
?>
        <?php 
if ($modelAdMain->adCategory->adMain->temp == 1) {
    ?>
            <?php 
    echo Html::submitButton(Yii::t('app', 'Publish ad'), ['class' => 'btn btn-success']);
    ?>
            <?php 
} else {
    ?>
            <?php 
    echo Html::submitButton(Yii::t('app', 'Edit ad'), ['class' => 'btn btn-primary']);
    ?>
            <?php 
}
开发者ID:baranov-nt,项目名称:setyes,代码行数:31,代码来源:complite.php


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