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


PHP Html::error方法代码示例

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


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

示例1: render

 public function render($content = null)
 {
     $this->inputOptions['name'] = '';
     if ($content === null) {
         if (!isset($this->parts['{input}'])) {
             // $this->inputOptions['data-bind'] = sprintf('value: %s', $this->attribute);
             $this->parts['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->inputOptions);
         }
         if (!isset($this->parts['{hidden}'])) {
             $this->parts['{hidden}'] = Html::activeHiddenInput($this->model, $this->attribute, $this->hiddenOptions);
         }
         if (!isset($this->parts['{label}'])) {
             $this->parts['{label}'] = Html::activeLabel($this->model, $this->attribute, $this->labelOptions);
         }
         if (!isset($this->parts['{error}'])) {
             $this->parts['{error}'] = Html::error($this->model, $this->attribute, $this->errorOptions);
         }
         if (!isset($this->parts['{hint}'])) {
             $this->parts['{hint}'] = '';
         }
         $content = strtr($this->template, $this->parts);
     } elseif (!is_string($content)) {
         $content = call_user_func($content, $this);
     }
     return empty($content) ? '' : ($this->wrapper ? $this->begin() . "\n" . $content . "\n" . $this->end() : $content);
 }
开发者ID:e-frank,项目名称:yii2-knockout,代码行数:26,代码来源:FormField.php

示例2: actionUpload

 public function actionUpload($model, $primaryKey)
 {
     $results = [];
     $modelImage = new Image();
     $modelImage->model = $model;
     $modelImage->primaryKey = $primaryKey;
     if (Yii::$app->request->isPost) {
         $modelImage->file = UploadedFile::getInstance($modelImage, 'file');
         if ($modelImage->file && $modelImage->validate()) {
             /*
             {
                 "name": "picture1.jpg",
                 "size": 902604,
                 "url": "http:\/\/example.org\/files\/picture1.jpg",
                 "thumbnailUrl": "http:\/\/example.org\/files\/thumbnail\/picture1.jpg",
                 "deleteUrl": "http:\/\/example.org\/files\/picture1.jpg",
                 "deleteType": "DELETE"
               },
             */
             $filename = md5($model . $primaryKey . $modelImage->file->name) . '.' . $modelImage->file->extension;
             $modelImage->src = $filename;
             $modelImage->save();
             if ($modelImage->file->saveAs(Yii::getAlias(Image::FILE_DIROOT) . $filename)) {
                 $imagePath = Yii::getAlias(Image::FILE_DIR) . $filename;
                 $result = ['name' => $filename, 'size' => $modelImage->file->size, 'url' => $imagePath, 'thumbnailUrl' => $modelImage->resize(), 'deleteUrl' => Url::to(['/cms/admin/image/delete', 'id' => $modelImage->id]), 'deleteType' => "DELETE"];
                 $results[] = $result;
             }
         } else {
             $results[] = (object) [$modelImage->file->name => false, 'error' => strip_tags(Html::error($modelImage, 'file')), 'extension' => $modelImage->file->extension, 'type' => $modelImage->file->type];
         }
     }
     echo json_encode((object) ['files' => $results]);
 }
开发者ID:nurastana,项目名称:familyclinickz,代码行数:33,代码来源:ImageController.php

示例3: actionUpload

 public function actionUpload($model, $primaryKey)
 {
     $results = [];
     $modelImage = new Image();
     $modelImage->model = $model;
     $modelImage->primaryKey = $primaryKey;
     $filePath = $modelImage->getFilePath();
     if (Yii::$app->request->isPost) {
         $modelImage->file = UploadedFile::getInstance($modelImage, 'file');
         if ($modelImage->file && $modelImage->validate()) {
             $filename = $modelImage->file->name;
             $modelImage->src = $filename;
             $modelImage->position = $modelImage->nextPosition;
             $modelImage->save();
             $image = \Yii::$app->image->load($modelImage->file->tempName);
             $image->resize(2592, 1728, \yii\image\drivers\Image::AUTO);
             if ($image->save($filePath . '/' . $filename)) {
                 $imagePath = $filePath . '/' . $filename;
                 $result = ['name' => $filename, 'size' => filesize($filePath . '/' . $filename), 'url' => $imagePath, 'thumbnailUrl' => $modelImage->resize('100x100'), 'deleteUrl' => Url::to(['/core/image/delete', 'id' => $modelImage->id]), 'deleteType' => "DELETE"];
                 $results[] = $result;
             }
         } else {
             $results[] = (object) [$modelImage->file->name => false, 'error' => strip_tags(Html::error($modelImage, 'file')), 'extension' => $modelImage->file->extension, 'type' => $modelImage->file->type];
         }
     }
     echo json_encode((object) ['files' => $results]);
 }
开发者ID:ivphpan,项目名称:iris,代码行数:27,代码来源:ImageController.php

示例4: 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)) {
         if ($model->hasErrors($this->attribute)) {
             Html::addCssClass($this->filterOptions, 'has-error');
             $error = ' ' . Html::error($model, $this->attribute, $this->grid->filterErrorOptions);
         } else {
             $error = '';
         }
         if (is_array($this->filter)) {
             $filterItems = $this->filter;
             $filterItems[$this->filterAllValue] = Yii::t('yii2tech-admin', 'All records');
         } else {
             $filterItems = ['0' => Yii::t('yii2tech-admin', 'Deleted'), $this->filterAllValue => Yii::t('yii2tech-admin', 'All records')];
         }
         $options = array_merge(['prompt' => Yii::t('yii2tech-admin', 'Actual only')], $this->filterInputOptions);
         return Html::activeDropDownList($model, $this->attribute, $filterItems, $options) . $error;
     } else {
         return parent::renderFilterCellContent();
     }
 }
开发者ID:ASP96,项目名称:admin,代码行数:28,代码来源:DeleteStatusColumn.php

示例5: render

 public function render($content = null)
 {
     if ($content === null) {
         if (!isset($this->parts['{input}'])) {
             $this->parts['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->inputOptions);
         }
         if (!isset($this->parts['{label}'])) {
             $labelsHelp = $this->model->attributeHints();
             if (isset($labelsHelp[$this->attribute])) {
                 $this->labelOptions['label'] = '<span data-toggle="tooltip" title="" data-original-title="';
                 $this->labelOptions['label'] .= Html::encode($labelsHelp[$this->attribute]);
                 $this->labelOptions['label'] .= '">';
                 $this->labelOptions['label'] .= Html::encode($this->model->getAttributeLabel($this->attribute));
                 $this->labelOptions['label'] .= ' <span class="glyphicon glyphicon-question-sign" style="font-size: 8pt;" aria-hidden="true"></span>';
                 $this->labelOptions['label'] .= '</span>';
             } else {
                 $this->labelOptions['label'] = Html::encode($this->model->getAttributeLabel($this->attribute));
             }
             $this->parts['{label}'] = Html::activeLabel($this->model, $this->attribute, $this->labelOptions);
         }
         if (!isset($this->parts['{error}'])) {
             $this->parts['{error}'] = Html::error($this->model, $this->attribute, $this->errorOptions);
         }
         if (!isset($this->parts['{hint}'])) {
             $this->parts['{hint}'] = '';
         }
         $content = strtr($this->template, $this->parts);
     } elseif (!is_string($content)) {
         $content = call_user_func($content, $this);
     }
     return $this->begin() . "\n" . $content . "\n" . $this->end();
 }
开发者ID:andreosoft,项目名称:andreocms,代码行数:32,代码来源:ActiveField.php

示例6: getError

 /**
  * Returns error message if one's exist
  * @return string
  */
 protected function getError()
 {
     if ($this->column->grid->filterModel->hasErrors($this->column->attribute)) {
         Html::addCssClass($this->column->filterOptions, 'has-error');
         return Html::error($this->column->grid->filterModel, $this->column->attribute, $this->column->grid->filterErrorOptions);
     }
     return '';
 }
开发者ID:GAMITG,项目名称:yz2-admin,代码行数:12,代码来源:BaseFilter.php

示例7: renderInput

 /**
  * Renders the input
  *
  * @return string
  */
 protected function renderInput()
 {
     $this->options = array_merge($this->options, ['style' => $this->inputStyle]);
     if (!$this->hideInput) {
         return Html::activeLabel($this->model, $this->attribute, ['class' => 'control-label']) . '<div class="input-group drp-container form-drp-input" style="' . $this->wrapperStyle . '">' . $this->getInput('textInput') . Html::submitButton('<span class="glyphicon glyphicon-floppy-save"></span> ' . \Yii::t('admin', 'Export'), ['class' => 'btn btn-info']) . '</div>' . '<div class="help-block ">' . Html::error($this->model, $this->attribute, ['class' => 'help-block help-block-error']) . '</div>';
     }
     $tag = ArrayHelper::remove($this->containerOptions, 'tag', 'div');
     $content = str_replace('{input}', $this->getInput('hiddenInput'), $this->containerTemplate);
     $content = str_replace('{error}', '<div class="help-block ">' . Html::error($this->model, $this->attribute, ['class' => 'help-block help-block-error']) . '</div>', $content);
     return Html::tag($tag, $content, $this->containerOptions);
 }
开发者ID:mistim,项目名称:yii2-theme-adminlte,代码行数:16,代码来源:DateRangePicker.php

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

示例9: renderFilterCellContent

 /**
  * Renders the filter cell content.
  * The default implementation simply renders a space.
  * This method may be overridden to customize the rendering of the filter cell (if any).
  * @return string the rendering result
  */
 protected function renderFilterCellContent()
 {
     if (is_string($this->filter)) {
         return $this->filter;
     }
     $model = $this->grid->filterModel;
     if ($this->filter !== false && $this->attribute !== null && $model->isAttributeActive($this->attribute)) {
         if ($model->hasErrors($this->attribute)) {
             Html::addCssClass($this->filterOptions, 'has-error');
             $error = ' ' . Html::error($model, $this->attribute, $this->grid->filterErrorOptions);
         } else {
             $error = '';
         }
         $filterOptions = ['=' => '=', '>' => '>', '<' => '<'];
         Html::addCssClass($this->filterInputOptions, 'date-filter-input');
         $dropDown = Html::activeDropDownList($model, $this->attribute . '_operand', $filterOptions, ['class' => 'form-control pull-left', 'style' => 'width: 32px; appearance: none; -moz-appearance: none; -webkit-appearance: none;']);
         $field = DatePicker::widget(['model' => $model, 'attribute' => $this->attribute, 'options' => $this->filterInputOptions, 'dateFormat' => 'yyyy-MM-dd']);
         return $dropDown . $field . $error;
     } else {
         return parent::renderFilterCellContent();
     }
 }
开发者ID:yeesoft,项目名称:yii2-yee-core,代码行数:28,代码来源:DateFilterColumn.php

示例10: render

 public function render($content = null)
 {
     if ($content === null) {
         if (!isset($this->parts['{input}'])) {
             $this->parts['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->inputOptions);
         }
         if (!isset($this->parts['{label}'])) {
             $this->parts['{label}'] = Html::activeLabel($this->model, $this->attribute, $this->labelOptions);
         }
         if (!isset($this->parts['{error}'])) {
             $this->parts['{error}'] = Html::error($this->model, $this->attribute, $this->errorOptions);
         }
         if (!isset($this->parts['{hint}'])) {
             $this->parts['{hint}'] = '';
         }
         $this->parts['{size}'] = $this->size;
         $content = strtr($this->template, $this->parts);
     } elseif (!is_string($content)) {
         $content = call_user_func($content, $this);
     }
     return $this->begin() . "\n" . $content . "\n" . $this->end();
 }
开发者ID:shunzi250,项目名称:lulucms2,代码行数:22,代码来源:ActiveField.php

示例11: render

 /** @inheritdoc */
 public function render($content = null)
 {
     if ($content === null) {
         if (!isset($this->parts['{input}'])) {
             $this->parts['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->inputOptions);
         }
         if (!isset($this->parts['{label}'])) {
             $this->parts['{label}'] = Html::activeLabel($this->model, $this->attribute, $this->labelOptions);
         }
         if (!isset($this->parts['{error}'])) {
             $this->parts['{error}'] = Html::error($this->model, $this->attribute, $this->errorOptions);
         }
         if (!isset($this->parts['{hint}'])) {
             $this->parts['{hint}'] = '';
         }
         $containerTag = ArrayHelper::remove($this->containerOptions, 'tag', 'div');
         $this->parts['{input}'] = Html::tag($containerTag, "{$this->parts['{input}']}\n" . ArrayHelper::remove($this->parts, '{error}') . "\n" . ArrayHelper::remove($this->parts, '{hint}'), $this->containerOptions);
         $content = strtr($this->template, $this->parts);
     } elseif (!is_string($content)) {
         $content = call_user_func($content, $this);
     }
     return $this->begin() . "\n" . $content . "\n" . $this->end();
 }
开发者ID:sjoorm,项目名称:yii2-components,代码行数:24,代码来源:HorizontalActiveField.php

示例12: renderFilterCellContent

 protected function renderFilterCellContent()
 {
     if (is_string($this->filter)) {
         return $this->filter;
     }
     $model = $this->grid->filterModel;
     if ($this->filter !== false && $this->attribute !== null && $model->isAttributeActive($this->attribute)) {
         if ($model->hasErrors($this->attribute)) {
             Html::addCssClass($this->filterOptions, 'error-state');
             $error = Html::error($model, $this->attribute, $this->grid->filterErrorOptions);
         } else {
             $error = '';
         }
         if (is_array($this->filter)) {
             $options = array_merge(['prompt' => ''], $this->filterInputOptions);
             return Html::beginTag('div', ['class' => 'input-control select']) . Html::activeDropDownList($model, $this->attribute, $this->filter, $options) . ' ' . $error . Html::endTag('div');
         } else {
             return Html::beginTag('div', ['class' => 'input-control text']) . Html::activeTextInput($model, $this->attribute, $this->filterInputOptions) . ' ' . $error . Html::endTag('div');
         }
     } else {
         return parent::renderFilterCellContent();
     }
 }
开发者ID:creators,项目名称:yii2-metroui,代码行数:23,代码来源:DataColumn.php

示例13:

<?php 
echo $form->field($model, 'text')->textarea(['rows' => 6]);
?>

<div class="form-group">
    <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>

<?php 
ActiveForm::end();
?>

<?php 
echo Html::beginForm(['/post/create2'], 'POST', ['class' => 'form-horizontal', 'data-comment' => 'form', 'data-comment-action' => 'create']);
?>
<div class="form-group" data-comment="form-group">
    <div class="col-sm-12">
        <?php 
echo Html::activeTextarea($model, 'text', ['class' => 'form-control']);
?>
        <?php 
echo Html::error($model, 'content', ['data-comment' => 'form-summary', 'class' => 'help-block hidden']);
?>
    </div>
</div>
<?php 
echo Html::submitButton('submit', ['class' => 'btn btn-danger btn-lg']);
echo Html::endForm();
开发者ID:hawk56,项目名称:ymam,代码行数:30,代码来源:comment.php

示例14: empty

                <?php 
echo DateTimePicker::widget(['model' => $model, 'attribute' => 'next_at', 'type' => DateTimePicker::TYPE_COMPONENT_PREPEND, 'pluginOptions' => ['autoclose' => true]]);
?>
            <?php 
echo Html::error($model, 'next_at', ['data-activity' => 'form-summary', 'class' => 'help-block hidden']);
?>
        </div>
        <div class="col-sm-8"><?php 
echo \Yii::t('net_frenzel_activity', 'Next');
?>
:
            <?php 
echo $form->field($model, 'next_type')->radioButtonGroup($model->NextTypeArray, ['id' => 'next_type-create', 'itemOptions' => ['labelOptions' => ['class' => 'btn btn-primary btn-sm']]])->label(false);
?>
            <?php 
echo Html::error($model, 'next_type', ['data-activity' => 'form-summary', 'class' => 'help-block hidden']);
?>
        </div>    
    </div>

    <div class="row">
        <div class="col-md-12">
            <div class="col-md-9">
                <?php 
$userDesc = empty($model->next_by) ? '' : $model->responsible->username;
$url = \yii\helpers\Url::to(['/activity/default/responsible-list']);
echo $form->field($model, 'next_by')->widget(Select2::classname(), ['initValueText' => $userDesc, 'options' => ['placeholder' => 'responsible ...'], 'pluginOptions' => ['allowClear' => true, 'minimumInputLength' => 3, 'ajax' => ['url' => $url, 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {q:params.term}; }')], 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), 'templateResult' => new JsExpression('function(user) { return user.text; }'), 'templateSelection' => new JsExpression('function (user) { return user.text; }')]])->label(false);
?>
            </div>
            <div class="col-md-3">
                <?php 
开发者ID:frenzelgmbh,项目名称:cm-activity,代码行数:31,代码来源:_form.php

示例15:

            انتخاب عکس
            <?php 
echo Html::activeFileInput($fileObject, "[{$uniqueId}]resource", ['id' => 'file-input-' . $uniqueId]);
?>
        </span>
        <img
            id="uploaded-image-<?php 
echo $uniqueId;
?>
"
            src="#"
            alt=""
            style="display:none"
            class="thumbnail image-preview" />
        <?php 
echo Html::error($fileObject, 'resource', ['class' => 'help-block']);
?>
    </div>
    <div class="uploaded-images">
        <ul class="list-group">
            <?php 
foreach ($uploadedImages as $image) {
    ?>
                <li class="list-group-item">
                    <div class="image-thumb">
                        <?php 
    echo Html::img($image->getUrl('form-upload'));
    ?>
                        <i
                            class="fa fa-times-circle fa-lg text-danger file-delete"
                            data-id="<?php 
开发者ID:ahb360,项目名称:kalpok,代码行数:31,代码来源:singleImage.php


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