本文整理汇总了PHP中TbHtml::errorSummary方法的典型用法代码示例。如果您正苦于以下问题:PHP TbHtml::errorSummary方法的具体用法?PHP TbHtml::errorSummary怎么用?PHP TbHtml::errorSummary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TbHtml
的用法示例。
在下文中一共展示了TbHtml::errorSummary方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<title>Installation</title>
<link rel="stylesheet" type="text/css" href="<?php
echo Bootstrap::getBooster()->getAssetsUrl();
?>
/bootstrap/css/bootstrap.min.css" />
</head>
<body>
<div class="span6 offset3">
<h1 class="offset1">Installation</h1>
<h2 class="offset1"><small>Enter admin credentials</small></h2>
<?php
if ($model->hasErrors()) {
?>
<?php
echo TbHtml::errorSummary($model);
?>
<?php
}
?>
<form method="post" class="form-horizontal">
<?php
echo TbHtml::activeTextFieldControlGroup($model, 'username');
?>
<?php
echo TbHtml::activePasswordFieldControlGroup($model, 'password');
?>
<?php
echo TbHtml::activePasswordFieldControlGroup($model, 'password_verify');
示例2:
<div class="success">
<?php
echo Yii::app()->user->getFlash('recoveryMessage');
?>
</div>
<?php
} else {
?>
<div class="form">
<?php
echo TbHtml::beginForm();
?>
<?php
echo TbHtml::errorSummary($form);
?>
<div class="row-fluid">
<?php
echo TbHtml::activeLabel($form, 'login_or_email');
?>
<?php
echo TbHtml::activeTextField($form, 'login_or_email');
?>
<p class="hint"><?php
echo UserModule::t("Please enter your login or email addres.");
?>
</p>
</div>
示例3: errorSummary
/**
* Displays a summary of validation errors for one or several models.
* @param mixed $models the models whose input errors are to be displayed.
* @param string $header a piece of HTML code that appears in front of the errors
* @param string $footer a piece of HTML code that appears at the end of the errors
* @param array $htmlOptions additional HTML attributes to be rendered in the container div tag.
* @return string the error summary. Empty if no errors are found.
*/
public function errorSummary($models, $header = null, $footer = null, $htmlOptions = array())
{
if (!$this->enableAjaxValidation && !$this->enableClientValidation) {
return TbHtml::errorSummary($models, $header, $footer, $htmlOptions);
}
TbArray::defaultValue('id', $this->id . '_es_', $htmlOptions);
$html = TbHtml::errorSummary($models, $header, $footer, $htmlOptions);
if ($html === '') {
if ($header === null) {
$header = '<p>' . Yii::t('yii', 'Please fix the following input errors:') . '</p>';
}
TbHtml::addCssClass(TbHtml::$errorSummaryCss, $htmlOptions);
TbHtml::addCssStyle('display:none', $htmlOptions);
$html = CHtml::tag('div', $htmlOptions, $header . '<ul><li>dummy</li></ul>' . $footer);
}
$this->summaryID = $htmlOptions['id'];
return $html;
}
示例4: testErrorSummary
public function testErrorSummary()
{
$I = $this->codeGuy;
$model = new Dummy();
$model->addError('text', 'Error text');
$html = TbHtml::errorSummary($model, 'Header text', 'Footer text', array('class' => 'summary'));
$div = $I->createNode($html, 'div.alert');
$I->seeNodeCssClass($div, 'alert-block alert-error summary');
$I->seeNodePattern($div, '/^Header text/');
$I->seeNodePattern($div, '/Footer text$/');
$li = $div->filter('ul > li')->first();
$I->seeNodeText($li, 'Error text');
}