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


PHP Html::label方法代码示例

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


在下文中一共展示了Html::label方法的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: renderDataCellContent

 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     $items = '';
     foreach ($this->buttons as $value => $label) {
         $items .= Html::label(Html::radio(null, $model->{$this->attribute} == $value, ['value' => $value]) . $label, $model->{$this->attribute} == $value, ['class' => 'btn ' . ($model->{$this->attribute} == $value ? 'btn-primary' : 'btn-default')]);
     }
     return Html::tag('div', $items, ['data-action' => 'toggle-column', 'data-attribute' => $this->attribute, 'data-id' => $model->id, 'data-model' => get_class($model), 'data-url' => Url::to($this->updateAction), 'data-toggle' => 'buttons', 'class' => 'btn-group-xs btn-group']);
 }
开发者ID:yiister,项目名称:yii2-advanced-grid,代码行数:11,代码来源:ToggleColumn.php

示例3: actionForm

 public function actionForm()
 {
     echo Html::beginForm();
     echo Html::checkboxList('test', ['value 1' => 'item 1', 'value 2' => 'item 2', 'value 3' => 'item 3'], isset($_POST['test']) ? $_POST['test'] : null, function ($index, $label, $name, $value, $checked) {
         return Html::label($label . ' ' . Html::checkbox($name, $value, $checked), null, ['class' => 'inline checkbox']);
     });
     echo Html::submitButton();
     echo Html::endForm();
     print_r($_POST);
 }
开发者ID:glcode,项目名称:yii2-2.0.3-annotated,代码行数:10,代码来源:SiteController.php

示例4: statusTipe1

 public function statusTipe1($field, $label, $format)
 {
     /**
      * @var $field=target field, $label=label grid, $format=tipe data output
      * 
      * ON VIEW
      * ============================================================================
      * GridView::widget([
      *    ...
      * '  columns' => [
      *       ...,
      *       Yii::$app->gridview->statusTipe1('namafield','namalabel','formatraw'),
      *        ...,
      *       ],
      * ]);
      *
      * akan memberikan nilai return :
      * 1. "Aktif" jika status = 1
      * 2. "Tidak aktif" jika status <> 1
      *
      **/
     $this->st = $field;
     $de_array = ['label' => $label, 'format' => $format, 'value' => function ($data) {
         $sts = $this->st;
         if ($data->{$sts} == 1) {
             $statusnya = Html::label('Aktif', null, ['class' => 'label label-info']);
         } else {
             $statusnya = Html::label('Tidak Aktif', null, ['class' => 'label label-danger']);
         }
         return $statusnya;
     }];
     return $de_array;
 }
开发者ID:ptrnov,项目名称:7erp,代码行数:33,代码来源:GridviewComponent.php

示例5: actions

    /**
     * @inheritdoc
     */
    public function actions()
    {
        return ArrayHelper::merge(parent::actions(), ['index' => ["columns" => [['class' => CreatedAtColumn::className()], 'id', ['class' => DataColumn::className(), 'attribute' => 'status_code', 'format' => 'raw', 'filter' => ArrayHelper::map(ShopOrderStatus::find()->all(), 'code', 'name'), 'value' => function (ShopOrder $order) {
            return Html::label($order->status->name, null, ['style' => "background: {$order->status->color}", 'class' => "label"]) . "<br />" . Html::tag("small", \Yii::$app->formatter->asDatetime($order->status_at) . " (" . \Yii::$app->formatter->asRelativeTime($order->status_at) . ")");
        }], ['class' => BooleanColumn::className(), 'attribute' => 'payed', 'format' => 'raw'], ['class' => DataColumn::className(), 'attribute' => "canceled", 'format' => "raw", 'filter' => ['Y' => \Yii::t('app', 'Yes'), 'N' => \Yii::t('app', 'No')], 'value' => function (ShopOrder $shopOrder) {
            return $shopOrder->canceled == "Y" ? \Yii::t('app', 'Yes') : \Yii::t('app', 'No');
        }], ['class' => DataColumn::className(), 'attribute' => "user_id", 'label' => \skeeks\cms\shop\Module::t('app', 'Buyer'), 'format' => "raw", 'value' => function (ShopOrder $shopOrder) {
            return (new \skeeks\cms\shop\widgets\AdminBuyerUserWidget(['user' => $shopOrder->user]))->run();
        }], ['class' => DataColumn::className(), 'filter' => false, 'format' => 'raw', 'label' => \skeeks\cms\shop\Module::t('app', 'Good'), 'value' => function (ShopOrder $model) {
            if ($model->shopBaskets) {
                $result = [];
                foreach ($model->shopBaskets as $shopBasket) {
                    $money = \Yii::$app->money->intlFormatter()->format($shopBasket->money);
                    $result[] = Html::a($shopBasket->name, $shopBasket->product->cmsContentElement->url, ['target' => '_blank']) . <<<HTML
  — {$shopBasket->quantity} {$shopBasket->measure_name}
HTML;
                }
                return implode('<hr style="margin: 0px;"/>', $result);
            }
        }], ['class' => DataColumn::className(), 'format' => 'raw', 'attribute' => 'price', 'label' => \skeeks\cms\shop\Module::t('app', 'Sum'), 'value' => function (ShopOrder $model) {
            return \Yii::$app->money->intlFormatter()->format($model->money);
        }], ['class' => DataColumn::className(), 'filter' => ArrayHelper::map(CmsSite::find()->active()->all(), 'id', 'name'), 'attribute' => 'site_id', 'format' => 'raw', 'visible' => false, 'label' => \skeeks\cms\shop\Module::t('app', 'Site'), 'value' => function (ShopOrder $model) {
            return $model->site->name . " [{$model->site->code}]";
        }]]], "view" => ['class' => AdminOneModelEditAction::className(), "name" => \Yii::t('app', "Информация"), "icon" => "glyphicon glyphicon-eye-open", "priority" => 5, "callback" => [$this, 'view']]]);
    }
开发者ID:3737002,项目名称:cms-shop,代码行数:28,代码来源:AdminOrderController.php

示例6: renderLabel

 public function renderLabel()
 {
     if (!isset($this->labelOptions['for'])) {
         $this->labelOptions['for'] = $this->inputOptions['id'];
     }
     return $this->hasModel() ? Html::activeLabel($this->model, $this->attribute, $this->labelOptions) : Html::label($this->label, $this->labelOptions['for'], $this->labelOptions);
 }
开发者ID:fourteenmeister,项目名称:yii2-semantic-ui,代码行数:7,代码来源:Checkbox.php

示例7: init

 public function init()
 {
     parent::init();
     $this->_inputStr = '<div class="form-group">';
     if ($this->hasModel()) {
         $this->_inputStr .= Html::activeLabel($this->model, $this->attribute);
     } else {
         $this->_inputStr .= Html::label($this->name);
     }
     $this->_inputStr .= '<div id="' . Html::encode($this->name) . '" class="input-group date">';
     if ($this->hasModel()) {
         $value = Html::getAttributeValue($this->model, $this->attribute);
     } else {
         $value = $this->value;
     }
     if ($value !== null) {
         $value = Yii::$app->formatter->asDatetime($value);
     }
     $options = $this->options;
     $options['class'] = 'form-control';
     //$options['readonly'] = '';
     $options['value'] = $value;
     if ($this->hasModel()) {
         $this->_inputStr .= Html::activeTextInput($this->model, $this->attribute, $options);
     } else {
         $this->_inputStr .= Html::textInput($this->name, $this->value, $options);
     }
     $this->_inputStr .= '<span class="input-group-addon">
                                     <span class="glyphicon-calendar glyphicon"></span>
                                 </span>
                             </div>
                             </div>
                             ';
 }
开发者ID:Penton,项目名称:MoBlog,代码行数:34,代码来源:BootstrapDatetimePicker.php

示例8: renderHtml

 /**
  * @inheritdoc
  */
 public function renderHtml()
 {
     if ($this->model !== null) {
         return Html::activeLabel($this->model, $this->attribute, $this->options);
     }
     return Html::label($this->text, null, $this->options);
 }
开发者ID:phpdn,项目名称:qc-base,代码行数:10,代码来源:LabelControl.php

示例9: honeypot

 protected function honeypot()
 {
     $field = Html::beginTag('div', ['class' => '', 'style' => 'display:none']);
     $field .= Html::label(Yii::t('app', 'Excuse me, but leave this field in blank'), "_email", ['class' => 'control-label']);
     $field .= Html::textInput("_email", null, ['id' => '_email', 'class' => 'form-control']);
     $field .= Html::endTag('div') . ' ';
     $field .= Html::endForm();
     return $field;
 }
开发者ID:ramialcheikh,项目名称:quickforms,代码行数:9,代码来源:Honeypot.php

示例10: variant

 private function variant($item)
 {
     $return = [];
     $checked = $this->model->checkedId($item->id);
     $return[] = Html::checkbox('variant', $checked, ['id' => 'filtervariant' . $item->id, 'data-id' => $item->id]);
     $return[] = ' ';
     $return[] = Html::label($item->value, 'filtervariant' . $item->id);
     return Html::tag('li', implode('', $return));
 }
开发者ID:oakcms,项目名称:oakcms,代码行数:9,代码来源:Checkbox.php

示例11: get_content

 protected function get_content($data, $isActiveForm = FALSE)
 {
     $res = array();
     // Ссылка добавления настройка для секции
     $res[] = Html::a('<i class="fa fa-cog"></i> add', [$this->add_set_link], ['class' => 'add_settings_in_section']);
     foreach ($data as $item) {
         $res[] = '<div class="row">' . '<div class="form-group">' . Html::label($item['key'], $item['key'], ['class' => 'col-sm-2 control-label']) . '<div class="col-sm-3">' . $this->set_input_type($item['type'], $item['key'], $item['value']) . Html::hiddenInput($item['key'] . '[type]', $item['type']) . '</div>' . '</div>' . '<div class="col-sm-4">' . Html::tag('span', $item['description']) . '</div>' . Html::label('active', 'active', ['class' => 'col-sm-2 control-label']) . '<div class="col-sm-1">' . Html::checkbox($item['key'] . '[active]', $this->has_checked($this->has_checked($item['active'])), ['data-atr' => 'icheck', 'class' => 'flat-red']) . '</div>';
     }
     return $res;
 }
开发者ID:kdes70,项目名称:hotel.lok,代码行数:10,代码来源:SettingsWidget.php

示例12: variant

 private function variant($item, $checked)
 {
     $return = [];
     if ($checked) {
         $checked = in_array($item->id, $checked);
     }
     $return[] = Html::checkbox('variant', $checked, ['autocomplete' => 'off', 'id' => 'fieldvariant' . $item->id, 'data-id' => $item->id]);
     $return[] = ' ';
     $return[] = Html::label($item->value, 'fieldvariant' . $item->id);
     return Html::tag('li', implode('', $return));
 }
开发者ID:pistol88,项目名称:yii2-field,代码行数:11,代码来源:Checkbox.php

示例13: run

 public function run()
 {
     if (is_null($this->imageOptions)) {
         $this->imageOptions = ['class' => 'img-responsive'];
     }
     $this->imageOptions['id'] = Yii::$app->getSecurity()->generateRandomString(10);
     $inputField = Html::getInputId($this->model, $this->attribute);
     echo Html::beginTag('div', ['id' => $inputField . '-cutter']);
     echo Html::activeFileInput($this->model, $this->attribute, ['class' => 'hide']);
     echo Html::beginTag('div', ['class' => 'preview-pane', 'style' => $this->model->{$this->attribute} ? 'display:block' : 'display:none']);
     echo Html::beginTag('div', ['class' => 'preview-container']);
     echo Html::img($this->previewImgSrc ? $this->previewImgSrc : $this->model->{$this->attribute}, ['class' => 'preview-image ' . $this->previewImgClass]);
     echo Html::endTag('div');
     echo Html::endTag('div');
     echo Html::checkbox($this->attribute . '-remove', false, ['label' => Yii::t('davfervaz/cutter', 'Remove photo')]);
     Modal::begin(['header' => Html::tag('h4', Yii::t('davfervaz/cutter', 'Select the cut area')), 'closeButton' => [], 'footer' => $this->getModalFooter($inputField), 'size' => Modal::SIZE_LARGE]);
     echo Html::beginTag('div', ['class' => 'image-container']);
     echo Html::img(null, $this->imageOptions);
     echo Html::endTag('div');
     echo Html::tag('br');
     echo Html::beginTag('div', ['class' => 'row']);
     echo Html::beginTag('div', ['class' => 'col-md-2']);
     echo Html::label(Yii::t('davfervaz/cutter', 'ASPECT_RATIO'), $inputField . '-aspectRatio');
     echo Html::textInput($this->attribute . '-aspectRatio', isset($this->cropperOptions['aspectRatio']) ? $this->cropperOptions['aspectRatio'] : 0, ['id' => $inputField . '-aspectRatio', 'class' => 'form-control']);
     echo Html::endTag('div');
     echo Html::beginTag('div', ['class' => 'col-md-2']);
     echo Html::label(Yii::t('davfervaz/cutter', 'ANGLE'), $inputField . '-dataRotate');
     echo Html::textInput($this->attribute . '-cropping[dataRotate]', '', ['id' => $inputField . '-dataRotate', 'class' => 'form-control']);
     echo Html::endTag('div');
     echo Html::beginTag('div', ['class' => 'col-md-2']);
     echo Html::label(Yii::t('davfervaz/cutter', 'POSITION') . ' (X)', $inputField . '-dataX');
     echo Html::textInput($this->attribute . '-cropping[dataX]', '', ['id' => $inputField . '-dataX', 'class' => 'form-control']);
     echo Html::endTag('div');
     echo Html::beginTag('div', ['class' => 'col-md-2']);
     echo Html::label(Yii::t('davfervaz/cutter', 'POSITION') . ' (Y)', $inputField . '-dataY');
     echo Html::textInput($this->attribute . '-cropping[dataY]', '', ['id' => $inputField . '-dataY', 'class' => 'form-control']);
     echo Html::endTag('div');
     echo Html::beginTag('div', ['class' => 'col-md-2']);
     echo Html::label(Yii::t('davfervaz/cutter', 'WIDTH'), $inputField . '-dataWidth');
     echo Html::textInput($this->attribute . '-cropping[dataWidth]', '', ['id' => $inputField . '-dataWidth', 'class' => 'form-control']);
     echo Html::endTag('div');
     echo Html::beginTag('div', ['class' => 'col-md-2']);
     echo Html::label(Yii::t('davfervaz/cutter', 'HEIGHT'), $inputField . '-dataHeight');
     echo Html::textInput($this->attribute . '-cropping[dataHeight]', '', ['id' => $inputField . '-dataHeight', 'class' => 'form-control']);
     echo Html::endTag('div');
     echo Html::endTag('div');
     Modal::end();
     echo Html::endTag('div');
     $view = $this->getView();
     CutterAsset::register($view);
     $options = ['inputField' => $inputField, 'useWindowHeight' => $this->useWindowHeight, 'cropperOptions' => $this->cropperOptions];
     $options = Json::encode($options);
     $view->registerJs('jQuery("#' . $inputField . '").cutter(' . $options . ');');
 }
开发者ID:davfervaz,项目名称:yii2-image-cutter,代码行数:54,代码来源:Cutter.php

示例14: run

 public function run()
 {
     $list = [];
     $selectedValue = $this->model->{$this->attribute};
     $_index = 0;
     foreach ($this->items as $k => $v) {
         $list[] = Html::tag('li', Html::checkbox($this->name, $k == $selectedValue, ['id' => $this->id . '_' . $_index, 'hidden' => 'hidden']) . Html::label($v, $this->id . '_' . $_index));
         $_index++;
     }
     $this->options['class'] .= ' m00nk_b3w_checkboxlist';
     echo Html::tag('ul', implode('', $list), $this->options);
 }
开发者ID:m00nk,项目名称:yii2-b3w,代码行数:12,代码来源:CheckBoxList.php

示例15: renderFilterCellContent

 /**
  * @inheritdoc
  */
 protected function renderFilterCellContent()
 {
     if (is_string($this->filter)) {
         return $this->filter;
     }
     $model = $this->grid->filterModel;
     if ($this->filter !== false && $model instanceof Model && $this->attribute !== null && $model->isAttributeActive($this->attribute)) {
         $dateParts = explode('-', $model->{$this->attribute});
         Html::addCssClass($this->btnOptions, 'btn btn-container-open');
         $content = Html::beginTag('div', ['class' => 'column-filter']);
         $content .= Html::beginTag('div', ['class' => 'col-md-12 input-group']);
         $content .= Html::beginTag('span', ['class' => 'input-group-btn']);
         $content .= Html::button('...', $this->btnOptions);
         $content .= Html::endTag('span');
         $content .= Html::activeTextInput($model, $this->attribute, ['class' => 'form-control date-filter-range-input']);
         $content .= Html::endTag('div');
         $content .= Html::beginTag('div', ['class' => 'column-filter-container date-filter-range']);
         $content .= Html::beginTag('div', ['class' => 'row']);
         $content .= Html::beginTag('div', ['class' => 'dateFrom col-md-12']);
         $content .= Html::button($this->labelBtnApply, ['class' => 'btn-apply btn btn-success']);
         $content .= Html::endTag('div');
         $content .= Html::endTag('div');
         $content .= Html::beginTag('div', ['class' => 'row']);
         $content .= Html::beginTag('div', ['class' => 'dateFrom col-md-6']);
         $content .= Html::label($this->labelDateFrom);
         $content .= \kak\widgets\datetimepicker\DateTimePicker::widget(['name' => '', 'value' => isset($dateParts[0]) ? trim($dateParts[0]) : '', 'clientOptions' => $this->clientOptions, 'showInputIcon' => false]);
         $content .= Html::endTag('div');
         $content .= Html::beginTag('div', ['class' => 'dateTo col-md-6']);
         $content .= Html::label($this->labelDateTo);
         $content .= \kak\widgets\datetimepicker\DateTimePicker::widget(['name' => '', 'value' => isset($dateParts[1]) ? trim($dateParts[1]) : '', 'clientOptions' => $this->clientOptions, 'showInputIcon' => false]);
         $content .= Html::endTag('div');
         $content .= Html::endTag('div');
         $content .= Html::endTag('div');
         $content .= Html::endTag('div');
         $error = '';
         if ($model->hasErrors($this->attribute)) {
             $error = ' ' . Html::error($model, $this->attribute, $this->grid->filterErrorOptions);
         }
         /*
         
         if (is_array($this->filter)) {
             $options = array_merge(['prompt' => ''], $this->filterInputOptions);
             return Html::activeDropDownList($model, $this->attribute, $this->filter, $options) . $error;
         } else {
         
         }
         */
         return $content . $error;
     }
     return $this->grid->emptyCell;
     /*parent::renderFilterCellContent();*/
 }
开发者ID:sanchezzzhak,项目名称:kak-grid,代码行数:55,代码来源:DateRangeColumn.php


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