本文整理汇总了PHP中CHtml::activeLabelEx方法的典型用法代码示例。如果您正苦于以下问题:PHP CHtml::activeLabelEx方法的具体用法?PHP CHtml::activeLabelEx怎么用?PHP CHtml::activeLabelEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHtml
的用法示例。
在下文中一共展示了CHtml::activeLabelEx方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: capturePosition
/**
* Capture the latitude and longitude of the marker to a model.
*
* @param CModel $model Model object
* @param string $lat Attribute name for latitude
* @param string $lng Attribute name for longitude
* @param array $options Options to set :<ul>
* <li>'visible' - show the input fields
* <li>'nocallback' - do not update on callback
* <li>'nodragend' - do not update on dragend
* <li>'drag' - update on drag
* </ul>
*/
public function capturePosition(CModel $model, $lat, $lng, array $options = array())
{
// field options
if (in_array('visible', $options)) {
echo CHtml::activeLabelEx($model, $lat), CHtml::activeTextField($model, $lat);
echo '<br>';
echo CHtml::activeLabelEx($model, $lng), CHtml::activeTextField($model, $lng);
} else {
echo CHtml::activeHiddenField($model, $lat), CHtml::activeHiddenField($model, $lng);
}
$latId = CHtml::activeId($model, $lat);
$lngId = CHtml::activeId($model, $lng);
// update function
$jsFunction = "function captureMarkerPosition(marker){\$('#{$latId}').val(marker.getPosition().lat());\$('#{$lngId}').val(marker.getPosition().lng());}";
Yii::app()->getClientScript()->registerScript(__CLASS__ . '#capturePosition', $jsFunction, CClientScript::POS_END);
// event options
if (!in_array('nocallback', $options)) {
$this->addCallback('function(result){captureMarkerPosition(result);}');
}
if (!in_array('nodragend', $options)) {
$this->addEvent('dragend', 'function(result){captureMarkerPosition(result);}');
}
if (in_array('drag', $options)) {
$this->addEvent('drag', 'function(result){captureMarkerPosition(result);}');
}
$this->addEvent('position_changed', 'function(result){captureMarkerPosition(result);}');
}
示例2: editAttribute
/**
* @param $value
* @return string
*/
public function editAttribute($model, $field, $params = array())
{
if (!isset($params['options'])) {
$params['options'] = array();
}
$options = $params['options'];
unset($params['options']);
return CHtml::activeFileField($model, $field->varname, $params) . ($model->getAttribute($field->varname) ? '<br/>' . CHtml::activeCheckBox($model, '[uwfdel]' . $field->varname, $params) . ' ' . CHtml::activeLabelEx($model, '[uwfdel]' . $field->varname, array('label' => UserModule::t('Delete file'), 'style' => 'display:inline;')) : '');
}
示例3: run
/**
* Run widget.
*/
public function run()
{
if ($this->hasModel()) {
echo CHtml::activeLabelEx($this->model, $this->attribute);
echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
} else {
echo CHtml::textArea($this->name, $this->value, $this->htmlOptions);
}
}
示例4: run
public function run()
{
$idFrom = EHtml::resolveId($this->model, $this->attributeName);
$idTo = EHtml::resolveId($this->model, $this->attributeDateTo);
Yii::app()->clientScript->registerScript('datePickerInitialize', '
$.datepicker.setDefaults( $.datepicker.regional["ru"] );
$("#' . $idFrom . '").datepicker({
onSelect: function( selectedDate ) {
$( "#' . $idTo . '" ).datepicker( "option", "minDate", selectedDate );
}
});
$("#' . $idTo . '").datepicker({
onSelect: function( selectedDate ) {
$( "#' . $idFrom . '" ).datepicker( "option", "maxDate", selectedDate );
}
});
');
echo "\n<style type='text/css'>\n.controls-line {\n\tmargin-bottom: 5px;\n}\n</style>\n<div class='control-group'>\n\t" . CHtml::activeLabelEx($this->model, $this->attributeName, array('class' => 'control-label')) . "\n\t<div class='controls controls-line'>\n\t\t<div class='input-append'>\n\t\t\t{$this->form->textField($this->model, $this->attributeName)}<span class='add-on'><i class='icon-calendar'></i></span>\n\t\t</div>\n\t\t<div class='input-append'>\n\t\t\t<label style='margin: 0 20px; display:inline;' for='" . $idTo . "'>\n\t\t\t\t{$this->model->getAttributeLabel($this->attributeDateTo)}\n\t\t\t</label>\n\t\t\t{$this->form->textField($this->model, $this->attributeDateTo)}<span class='add-on'><i class='icon-calendar'></i></span>\n\t\t</div>\n\t</div>\n\t<div class='controls'>\n\t\t{$this->form->error($this->model, $this->attributeName)}\n\t\t{$this->form->error($this->model, $this->attributeDateTo)}\n\t</div>\n</div>\n";
}
示例5: array
<?php
echo CHtml::beginForm();
?>
<?php
if (CHtml::errorSummary($tag)) {
?>
<?php
echo CHtml::errorSummary($tag);
?>
<?php
}
?>
<p class="help_hint">Star marked fields are required.</p>
<p>
<?php
echo CHtml::activeLabelEx($tag, 'name');
?>
<br />
<?php
echo CHtml::activeTextField($tag, 'name', array('maxlength' => 255, 'class' => 'small'));
?>
</p>
<?php
echo CHtml::submitButton($create ? 'Add' : 'Update', array('class' => 'button'));
echo CHtml::endForm();
示例6: array
echo Html::form('/admin/cart/history/', 'GET', array('id' => 'filter_form', 'class' => 'floatR'));
?>
<div class="row-form">
<?php
echo Html::activeLabelEx($form, 'from_date');
?>
<?php
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => CHtml::activeName($form, 'from_date'), 'value' => $form->from_date, 'options' => array('dateFormat' => "yy-mm-dd")));
?>
</div>
<div class="row-form">
<?php
echo CHtml::activeLabelEx($form, 'to_date');
?>
<?php
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => CHtml::activeName($form, 'to_date'), 'value' => $form->to_date, 'options' => array('dateFormat' => "yy-mm-dd")));
?>
</div>
<div class="row-form">
<?php
echo Html::link('<span class="icon-medium icon-arrow-right-2 colorWhite"></span>', 'javascript:void(0)', array('class' => 'btn bBlue ', 'onClick' => '$("#filter_form").submit()'));
?>
</div> <div class="clear"></div>
<?php
echo Html::endForm();
?>
示例7: array
?>
</div>
</div>
<div class="form-group">
<?php
echo CHtml::activeLabelEx($model, 'padding_left', array('class' => 'control-label col-md-3'));
?>
<div class="col-md-9">
<?php
echo CHtml::activeTextField($model, 'padding_left', array('class' => 'form-control input-large'));
?>
</div>
</div>
<div class="form-group">
<?php
echo CHtml::activeLabelEx($model, 'width', array('class' => 'control-label col-md-3'));
?>
<div class="col-md-9">
<?php
echo CHtml::activeTextField($model, 'width', array('class' => 'form-control input-large'));
?>
</div>
</div>
</div>
<div class="form-actions">
<?php
echo CHtml::submitButton($model->isNewRecord ? Yii::t('app', 'Сохранить') : Yii::t('app', 'Изменить'), array('class' => 'btn green', 'name' => 'btn_send'));
?>
<?php
echo CHtml::link(Yii::t('app', 'Назад'), $this->createUrl('active'), array('class' => 'btn grey'));
?>
示例8:
<?php
echo CHtml::beginForm();
?>
<p class="note"><?php
echo UserModule::t('Fields with <span class="required">*</span> are required.');
?>
</p>
<?php
echo CHtml::errorSummary($form);
?>
<div class="row">
<?php
echo CHtml::activeLabelEx($form, 'password');
?>
<?php
echo CHtml::activePasswordField($form, 'password');
?>
<p class="hint">
<?php
echo UserModule::t("Minimal password length 4 symbols.");
?>
</p>
</div>
<div class="row">
<?php
echo CHtml::activeLabelEx($form, 'verifyPassword');
?>
<?php
示例9: array
<?php
echo CHtml::activeTextField($post, 'title', array('size' => 65, 'maxlength' => 128));
?>
</div>
<div class="row">
<?php
echo CHtml::activeLabelEx($post, 'categoryId');
?>
<?php
$categories = Category::getListData();
echo CHtml::activeDropDownList($post, 'categoryId', CHtml::listData($categories, 'id', 'name'));
?>
</div>
<div class="row">
<?php
echo CHtml::activeLabelEx($post, 'publishTime');
?>
<?php
$post->publishTime = date('Y-m-d H:s', $post->publishTime == null ? time() : $post->publishTime);
//specific for my97DatePicker
$this->widget('application.extensions.my97DatePicker.JMy97DatePicker', array('model' => $post, 'attribute' => 'publishTime', 'options' => array('dateFmt' => Yii::app()->params['dateformatpicker'])));
?>
</div>
<div class="row">
<?php
echo CHtml::activeLabel($post, 'content');
?>
<?php
// Editor
$this->widget('application.extensions.fckeditor.FCKEditorWidget', array("model" => $post, "attribute" => 'content', "height" => '400px', "width" => '100%', "toolbarSet" => 'Default', "fckeditor" => Yii::app()->basePath . "/../js/fckeditor/fckeditor.php", "fckBasePath" => Yii::app()->baseUrl . "/js/fckeditor/", "config" => array("EditorAreaCSS" => Yii::app()->baseUrl . '/css/index.css')));
示例10: array
<?php
echo CHtml::activeTextField($model, 'break_out', array('class' => 'validate[required] form-control timepicker24', 'disabled' => 'true', 'id' => 'break_out', 'value' => '00:00:00'));
?>
<span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
</div>
<?php
echo CHtml::error($model, 'break_out');
?>
</div>
</div>
<div class="form-group">
<?php
echo CHtml::activeLabelEx($model, 'break_in', array('class' => $label_class));
?>
<div class="col-md-6 col-xs-12">
<div class="input-group bootstrap-timepicker">
<span class="input-group-addon">
<span class="checkbox"><label><input type="checkbox" id="check_break_in"></label></span>
</span>
<?php
echo CHtml::activeTextField($model, 'break_in', array('class' => 'validate[required] form-control timepicker24', 'disabled' => 'true', 'id' => 'break_in', 'value' => '00:00:00'));
?>
<span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
</div>
<?php
echo CHtml::error($model, 'break_in');
示例11: array
<?php
echo $form->textFieldRow($model, 'email', array('class' => 'span5', 'maxlength' => 128));
?>
<?php
echo $form->textAreaRow($model, 'content', array('rows' => 6, 'cols' => 50, 'class' => 'span8'));
?>
<?php
if (extension_loaded('gd')) {
?>
<div>
<?php
echo CHtml::activeLabelEx($model, 'Kode Verifikasi');
?>
<div>
<?php
echo $form->textFieldRow($model, 'verifyCode', array('class' => 'input-small'));
?>
<?php
$this->widget('CCaptcha');
?>
</div>
<div class="hint">Ketik tulisan yang ada pada gambar.</div>
</div>
<?php
}
?>
示例12: activeControlGroup
/**
* Generates an active form row.
* @param string $type the input type.
* @param CModel $model the data model.
* @param string $attribute the attribute.
* @param array $htmlOptions additional HTML attributes.
* @param array $data data for multiple select inputs.
* @return string the generated control group.
*/
public static function activeControlGroup($type, $model, $attribute, $htmlOptions = array(), $data = array())
{
$color = TbArray::popValue('color', $htmlOptions);
$groupOptions = TbArray::popValue('groupOptions', $htmlOptions, array());
$controlOptions = TbArray::popValue('controlOptions', $htmlOptions, array());
$label = TbArray::popValue('label', $htmlOptions);
$labelOptions = TbArray::popValue('labelOptions', $htmlOptions, array());
if (in_array($type, array(self::INPUT_TYPE_CHECKBOX, self::INPUT_TYPE_RADIOBUTTON))) {
$htmlOptions['label'] = isset($label) ? $label : $model->getAttributeLabel($attribute);
$htmlOptions['labelOptions'] = $labelOptions;
$label = false;
}
if (isset($label) && $label !== false) {
$labelOptions['label'] = $label;
}
$help = TbArray::popValue('help', $htmlOptions, '');
$helpOptions = TbArray::popValue('helpOptions', $htmlOptions, array());
if (!empty($help)) {
$help = self::inputHelp($help, $helpOptions);
}
$error = TbArray::popValue('error', $htmlOptions, '');
$input = isset($htmlOptions['input']) ? $htmlOptions['input'] : self::createActiveInput($type, $model, $attribute, $htmlOptions, $data);
self::addCssClass('control-group', $groupOptions);
if (!empty($color)) {
self::addCssClass($color, $groupOptions);
}
self::addCssClass('control-label', $labelOptions);
$output = self::openTag('div', $groupOptions);
if ($label !== false) {
$output .= parent::activeLabelEx($model, $attribute, $labelOptions);
}
$output .= self::controls($input . $error . $help, $controlOptions);
$output .= '</div>';
return $output;
}
示例13: array
?>
<div class="row">
<?php
echo CHtml::activeLabelEx($model, 'username');
?>
<?php
echo CHtml::activeTextField($model, 'username', array('size' => 20, 'maxlength' => 20));
?>
<?php
echo CHtml::error($model, 'username');
?>
</div>
<div class="row">
<?php
echo CHtml::activeLabelEx($model, 'email');
?>
<?php
echo CHtml::activeTextField($model, 'email', array('size' => 60, 'maxlength' => 128));
?>
<?php
echo CHtml::error($model, 'email');
?>
</div>
<div class="row buttons">
<?php
echo CHtml::submitButton($model->isNewRecord ? UserModule::t('Create') : UserModule::t('Save'));
?>
</div>
示例14: array
<div class="simple">
<?php
echo CHtml::activeLabelEx($model, 'desc', array('class' => 'help', 'title' => Yii::t('lazy8', 'contexthelp.desc'), 'onclick' => 'alert(this.title)'));
echo CHtml::activeTextField($model, 'desc', array('size' => 35, 'maxlength' => 255));
?>
</div>
<div class="simple">
<?php
echo CHtml::activeLabelEx($model, 'changedBy', array('class' => 'help', 'title' => Yii::t('lazy8', 'contexthelp.changedBy'), 'onclick' => 'alert(this.title)'));
echo CHtml::label($model->changedBy, false);
?>
</div>
<div class="simple">
<?php
echo CHtml::activeLabelEx($model, 'dateChanged', array('class' => 'help', 'title' => Yii::t('lazy8', 'contexthelp.dateChanged'), 'onclick' => 'alert(this.title)'));
echo CHtml::label(User::getDateFormatted($model->dateChanged, $cLoc, $dateformatter), false);
?>
</div>
<div class="action">
<?php
echo CHtml::submitButton($update ? Yii::t('lazy8', 'Save') : Yii::t('lazy8', 'Create'), array('title' => $update ? Yii::t('lazy8', 'contexthelp.Save') : Yii::t('lazy8', 'contexthelp.Create')));
?>
</div>
<?php
echo CHtml::endForm();
?>
</div><!-- yiiForm -->
示例15: getFieldsCheckbox
function getFieldsCheckbox($model, $fields, $setFields = array(), $ulId = 'tree')
{
$cs = Yii::app()->getClientScript();
$cs->registerCoreScript('jquery');
$css = '
/* Catalog Tree */
#tree {
list-style: none;
padding-left:1em;
}
#tree ul {
list-style: none;
padding-left: 2em;
}
#tree input {
margin-right: .5em;
}
div.form li label {
display:inline;
}
';
$js = '
$(document).ready(function(){
$("#check_all").click(function(){
$("#tree input").attr("checked", "checked");
return false;
});
$("#uncheck_all").click(function(){
$("#tree input").removeAttr("checked");
return false;
});
});
';
$cs->registerCss(__CLASS__ . '#form', $css);
$cs->registerScript(__CLASS__ . '#form', $js);
$content = "<div class=\"row fields\"><p><a href=\"#\" id=\"check_all\">" . CartModule::t('Check All') . "</a> | <a href=\"#\" id=\"uncheck_all\">" . CartModule::t('Uncheck All') . "</a></p><ul id=\"{$ulId}\">";
//echo '<pre>'; print_r($model); die();
if (isset($_POST[get_class($model)]['fields'])) {
$setFields = $_POST[get_class($model)]['fields'];
} elseif (count($setFields)) {
$new = array();
foreach ($setFields as $item) {
$new[$item->id] = 1;
}
$setFields = $new;
}
foreach ($fields as $item) {
$htmlOptions = array();
if (count($setFields)) {
if (isset($setFields[$item->id]) && $setFields[$item->id]) {
$htmlOptions['checked'] = 'checked';
}
}
/*
$htmlOptions['value'] = $item->id;
if ($model->isNewRecord) {
if (isset($setCat[$item->id])&&$setCat[$item->id])
$htmlOptions['checked'] = 'checked';
} else {
if (isset($setCat[$item->id]->id))
$htmlOptions['checked'] = 'checked';
}//*/
$content .= '<li>' . CHtml::activeCheckBox($model, "fields[" . $item->id . "]", $htmlOptions) . '' . CHtml::activeLabelEx($model, "fields[" . $item->id . "]", array('label' => $item->title)) . ' </li>';
}
$content .= '</ul></div>';
return $content;
}