本文整理汇总了PHP中BsHtml::label方法的典型用法代码示例。如果您正苦于以下问题:PHP BsHtml::label方法的具体用法?PHP BsHtml::label怎么用?PHP BsHtml::label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BsHtml
的用法示例。
在下文中一共展示了BsHtml::label方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
$this->breadcrumbs = array('Box-O-Matic' => array('/snapcms/boxomatic/index'), 'Suppliers' => array('supplier/admin'), 'Orders' => array('supplierPurchase/admin'), 'Reports');
$this->menu = array();
$this->page_heading = 'Reports';
$form = $this->beginWidget('application.widgets.SnapActiveForm', array('id' => 'login-form', 'enableClientValidation' => false, 'layout' => BsHtml::FORM_LAYOUT_HORIZONTAL, 'clientOptions' => array('validateOnSubmit' => false)));
?>
<div class="form-group">
<?php
echo BsHtml::label('Date From', 'date_from', array('class' => 'col-lg-2'));
?>
<div class="col-lg-10 ">
<?php
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'date_from', 'value' => Yii::app()->request->getPost('date_from', ''), 'options' => array('dateFormat' => 'yy-mm-dd'), 'htmlOptions' => array('class' => 'form-control')));
?>
</div>
</div>
<div class="form-group">
<?php
echo CHtml::label('Date To', 'date_to', array('class' => 'col-lg-2'));
?>
<div class="col-lg-10 ">
<?php
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'date_to', 'value' => Yii::app()->request->getPost('date_to', ''), 'options' => array('dateFormat' => 'yy-mm-dd'), 'htmlOptions' => array('class' => 'form-control')));
?>
</div>
</div>
<div class="form-group">
<?php
echo CHtml::label('Supplier', 'Supplier', array('class' => 'col-lg-2'));
?>
示例2: empty
$cartEmpty = empty($BoxoCart->userBoxes) && empty($BoxoCart->products);
?>
<h1 class="sr-only">Shop</h1>
<?php
if (!$BoxoCart->location_id) {
$form = $this->beginWidget('bootstrap.widgets.BsActiveForm', array('id' => 'location-form', 'enableAjaxValidation' => false));
?>
<div class="alert alert-warning form-inline">
<div class="row">
<div class="col-md-5">
<div class="form-group">
<h3>Set Location</h3>
<?php
echo BsHtml::label('Set Location', 'BoxoCart_location_id', array('class' => 'sr-only'));
?>
<?php
echo BsHtml::dropDownList('BoxoCart[location_id]', $BoxoCart->location_id, Location::getDeliveryAndPickupList(), array('name' => 'BoxoCart[location_id]', 'prompt' => '- Select -'));
?>
<?php
echo BsHtml::submitButton('Set Location');
?>
<p class="hint">
<small>This is required to determine which products are available.</small>
</p>
</div>
</div>
<div class="col-md-1 text-center">
<p> </p>
<h3> - Or - </h3>
示例3: array
$form = $this->beginWidget('application.widgets.SnapActiveForm', array('id' => 'login-form', 'enableClientValidation' => false, 'clientOptions' => array('validateOnSubmit' => false), 'layout' => BsHtml::FORM_LAYOUT_HORIZONTAL, 'htmlOptions' => array('class' => 'row')));
?>
<div class="col-lg-9 clearfix">
<div class="form-group">
<?php
echo BsHtml::label('Date From', 'date_from', array('class' => BsHtml::$formLayoutHorizontalLabelClass));
?>
<div class="col-lg-10">
<?php
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'date_from', 'options' => array('dateFormat' => 'yy-mm-dd'), 'htmlOptions' => array('class' => 'form-control')));
?>
</div>
</div>
<div class="form-group">
<?php
echo BsHtml::label('Date To', 'date_to', array('class' => BsHtml::$formLayoutHorizontalLabelClass));
?>
<div class="col-lg-10">
<?php
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'date_to', 'options' => array('dateFormat' => 'yy-mm-dd'), 'htmlOptions' => array('class' => 'form-control')));
?>
</div>
</div>
<button class="btn btn-primary pull-right" name="yt0" type="submit">
<span class="glyphicon glyphicon-search"></span> Search
</button>
</div>
<?php
$this->endWidget();
?>
</div>
示例4: datetimeFieldControlGroup
/**
* Generates a control group with a text field using a juidatepicker for a model attribute.
* @param CModel $model the data model.
* @param string $attribute the attribute name.
* @param array $htmlOptions additional HTML attributes.
* @return string the generated row.
* @see BsHtml::activeDateFieldControlGroup
*/
public function datetimeFieldControlGroup($model, $attribute, $htmlOptions = array())
{
$allowEmpty = false;
$validators = $model->getValidators($attribute);
foreach ($validators as $validator) {
if ($validator instanceof CDateValidator && $validator->allowEmpty === true) {
$allowEmpty = true;
break;
}
}
//I would have liked to have used the i18n date format, but the Jui Datepicker
//doesn't support the unicode date format
//$dateFormat = Yii::app()->locale->getDateFormat('full');
$htmlOptions = BsHtml::addClassName('form-control', $htmlOptions);
$htmlOptions['displaySize'] = isset($htmlOptions['displaySize']) ? $htmlOptions['displaySize'] : 1;
$dateWidget = $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => $attribute . '_widget', 'htmlOptions' => $htmlOptions, 'options' => array('dateFormat' => 'DD, d MM yy', 'altFormat' => 'yy-mm-dd', 'altField' => '#' . CHtml::activeId($model, $attribute), 'changeYear' => true, 'changeMonth' => true), 'value' => date('l, j F Y', strtotime($model->{$attribute}))), true);
$hourOptions = array();
$minuteOptions = array();
for ($i = 0; $i < 24; $i++) {
$val = str_pad($i, 2, "0", STR_PAD_LEFT);
$hourOptions[$val] = $val;
}
for ($i = 0; $i < 60; $i += 5) {
$val = str_pad($i, 2, "0", STR_PAD_LEFT);
$minuteOptions[$val] = $val;
}
$rowHtmlOptions = $htmlOptions;
$rowHtmlOptions['input'] = '<div class="row">';
if ($allowEmpty) {
$rowHtmlOptions['input'] .= '<div class="col-lg-1">' . BsHtml::activeLabel($model, $attribute . '_set', array('class' => 'control-label')) . BsHtml::activeCheckBox($model, $attribute . '_set', array('class' => 'control-label')) . '</div>';
}
$rowHtmlOptions['input'] .= '<div class="col-lg-4">' . BsHtml::label('Date', $attribute . '_widget', array('class' => 'control-label')) . $dateWidget . '</div><div class="col-lg-2">' . BsHtml::activeLabel($model, $attribute . '_hour', array('class' => 'control-label')) . BsHtml::activeDropDownList($model, $attribute . '_hour', $hourOptions, $htmlOptions) . '</div><div class="col-lg-2">' . BsHtml::activeLabel($model, $attribute . '_minute', array('class' => 'control-label')) . BsHtml::activeDropDownList($model, $attribute . '_minute', $minuteOptions, $htmlOptions) . '</div></div>';
$rowHtmlOptions = $this->processRowOptions($model, $attribute, $rowHtmlOptions);
return BsHTML::activeDateFieldControlGroup($model, $attribute, $rowHtmlOptions) . BsHTML::activeHiddenField($model, $attribute);
}