本文整理汇总了PHP中CActiveRecord::getAttributeLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP CActiveRecord::getAttributeLabel方法的具体用法?PHP CActiveRecord::getAttributeLabel怎么用?PHP CActiveRecord::getAttributeLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActiveRecord
的用法示例。
在下文中一共展示了CActiveRecord::getAttributeLabel方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getViewAttributesEntry
/**
* Renvoie une ligne à insérer dans le tableau 'attributes' d'un widget de type CDetailView, CGridView...
* Le formatage varie selon le type de la colonne $column
* @param CDbColumnSchema $column
* @param CActiveRecord $templateRecord
* @return string
*/
public static function getViewAttributesEntry(CDbColumnSchema $column, CActiveRecord $templateRecord)
{
switch ($column->dbType) {
case 'date':
$out = "{$column->name}:date:" . $templateRecord->getAttributeLabel($column->name);
break;
case 'datetime':
$out = "{$column->name}:datetime:" . $templateRecord->getAttributeLabel($column->name);
break;
default:
$out = $column->name;
}
return $out;
}
示例2: 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";
}
示例3: renderForm
public function renderForm()
{
echo '<br />';
echo '<br />';
echo CHtml::tag('h3', array(), $this->exoModel->getAttributeLabel($this->exoAttr));
echo '<hr />';
$this->renderInputs();
echo '<br />';
echo '<br />';
}
示例4: getAttributeLabel
/**
* This function internationalize the labels using Yii::t()
* @see CActiveRecord::getAttributeLabel()
*/
public function getAttributeLabel($attribute)
{
$baseLabel = parent::getAttributeLabel($attribute);
return Yii::t('waterrequest', $baseLabel);
}
示例5: getElements
/**
* @param CActiveRecord $model
* @param array $attributes
* @return array
*/
public static function getElements($model, $attributes = [])
{
$modelAttributes = $model->getAttributes();
$modelElements = [];
foreach ($modelAttributes as $attrName => $attrVal) {
if (!empty($attributes)) {
foreach ($attributes as $attr) {
if ($attrName === $attr) {
$modelElements[$attr] = ['label' => $model->getAttributeLabel($attr), 'required' => $model->isAttributeRequired($attr), 'type' => 'text'];
}
}
continue;
}
$modelElements[$attrName] = ['label' => $model->getAttributeLabel($attrName), 'required' => $model->isAttributeRequired($attrName), 'type' => 'text'];
// if ($field->inputType == 'dropdownlist') {
// $elements['elements']['contextFields']['elements'][$field->inputName . '-' . $field->id]['items'] =
// Options::model()->getContextFieldOptions($field->id);
// }
}
return $modelElements;
}
示例6: getAttributeLabel
public function getAttributeLabel($attribute)
{
if (!$this->eavEnable) {
return parent::getAttributeLabel($attribute);
}
if ($this->hasEavAttribute($attribute)) {
if (!is_null($this->eavAttributeInstances[$attribute]->label) && $this->eavAttributeInstances[$attribute]->label !== '') {
return $this->eavAttributeInstances[$attribute]->label;
}
}
return parent::getAttributeLabel($attribute);
}
示例7: attributeLabels
public function attributeLabels()
{
return array('email' => $this->_model->getAttributeLabel($this->emailAtt), 'username' => $this->_model->getAttributeLabel($this->nameAtt), 'password' => HOAuthAction::t('Password'));
}