本文整理汇总了PHP中X2Model::getDefaultAssignment方法的典型用法代码示例。如果您正苦于以下问题:PHP X2Model::getDefaultAssignment方法的具体用法?PHP X2Model::getDefaultAssignment怎么用?PHP X2Model::getDefaultAssignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X2Model
的用法示例。
在下文中一共展示了X2Model::getDefaultAssignment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderModelInput
//.........这里部分代码省略.........
label += "<span style=\\"font-size: 0.6em;\\">";
// add email if defined
if(item.subject) {
label += "<br>";
label += item.subject;
}
label += "</span>";
label += "</a>";
return $( "<li>" )
.data( "item.autocomplete", item )
.append( label )
.appendTo( ul );
};
}' : '')), 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions)), true);
if (isset($oldLinkFieldVal)) {
$model->{$fieldName} = $oldLinkFieldVal;
}
return $input;
case 'rating':
return Yii::app()->controller->widget('X2StarRating', array('model' => $model, 'attribute' => $field->fieldName, 'readOnly' => isset($htmlOptions['disabled']) && $htmlOptions['disabled'], 'minRating' => Fields::RATING_MIN, 'maxRating' => Fields::RATING_MAX, 'starCount' => Fields::RATING_MAX - Fields::RATING_MIN + 1, 'cssFile' => Yii::app()->theme->getBaseUrl() . '/css/rating/jquery.rating.css', 'htmlOptions' => $htmlOptions, 'callback' => 'function(value, link){
if (typeof x2 !== "undefined" &&
typeof x2.InlineEditor !== "undefined" &&
typeof x2.InlineEditor.ratingFields !== "undefined") {
x2.InlineEditor.ratingFields["' . $field->modelName . '[' . $field->fieldName . ']"] = value;
}
}'), true);
case 'boolean':
$checkbox = CHtml::openTag('div', X2Html::mergeHtmlOptions($htmlOptions, array('class' => 'checkboxWrapper')));
$checkbox .= CHtml::activeCheckBox($model, $field->fieldName, array_merge(array('unchecked' => 0, 'title' => $field->attributeLabel), $htmlOptions));
$checkbox .= CHtml::closeTag('div');
return $checkbox;
case 'assignment':
$oldAssignmentVal = $model->{$fieldName};
$model->{$fieldName} = !empty($model->{$fieldName}) ? $field->linkType == 'multiple' && !is_array($model->{$fieldName}) ? explode(', ', $model->{$fieldName}) : $model->{$fieldName} : X2Model::getDefaultAssignment();
$dropdownList = CHtml::activeDropDownList($model, $fieldName, X2Model::getAssignmentOptions(true, true), array_merge(array('title' => $field->attributeLabel, 'id' => $field->modelName . '_' . $fieldName . '_assignedToDropdown', 'multiple' => $field->linkType == 'multiple' ? 'multiple' : null), $htmlOptions));
$model->{$fieldName} = $oldAssignmentVal;
return $dropdownList;
case 'optionalAssignment':
// optional assignment for users (can be left blank)
$users = User::getNames();
unset($users['Anyone']);
return CHtml::activeDropDownList($model, $fieldName, $users, array_merge(array('title' => $field->attributeLabel, 'empty' => ''), $htmlOptions));
case 'visibility':
$permissionsBehavior = Yii::app()->params->modelPermissions;
return CHtml::activeDropDownList($model, $field->fieldName, $permissionsBehavior::getVisibilityOptions(), array_merge(array('title' => $field->attributeLabel, 'id' => $field->modelName . "_visibility"), $htmlOptions));
// 'varchar', 'email', 'url', 'int', 'float', 'currency', 'phone'
// case 'int':
// return CHtml::activeNumberField($model, $field->fieldNamearray_merge(array(
// 'title' => $field->attributeLabel,
// ), $htmlOptions));
// 'varchar', 'email', 'url', 'int', 'float', 'currency', 'phone'
// case 'int':
// return CHtml::activeNumberField($model, $field->fieldNamearray_merge(array(
// 'title' => $field->attributeLabel,
// ), $htmlOptions));
case 'percentage':
$htmlOptions['class'] = empty($htmlOptions['class']) ? 'input-percentage' : $htmlOptions['class'] . ' input-percentage';
return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions));
case 'currency':
$fieldName = $field->fieldName;
$elementId = isset($htmlOptions['id']) ? '#' . $htmlOptions['id'] : '#' . $field->modelName . '_' . $field->fieldName;
Yii::app()->controller->widget('application.extensions.moneymask.MMask', array('element' => $elementId, 'currency' => Yii::app()->params['currency'], 'config' => array('affixStay' => true, 'decimal' => Yii::app()->locale->getNumberSymbol('decimal'), 'thousands' => Yii::app()->locale->getNumberSymbol('group'))));
return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel, 'class' => 'currency-field'), $htmlOptions));
case 'credentials':
$typeAlias = explode(':', $field->linkType);
$type = $typeAlias[0];
if (count($typeAlias) > 1) {
$uid = Credentials::$sysUseId[$typeAlias[1]];
} else {
$uid = Yii::app()->user->id;
}
return Credentials::selectorField($model, $field->fieldName, $type, $uid);
case 'timerSum':
// Sorry, no-can-do. This is field derives its value from a sum over timer records.
return $model->renderAttribute($field->fieldName);
case 'float':
case 'int':
if (isset($model->{$fieldName})) {
$oldNumVal = $model->{$fieldName};
$model->{$fieldName} = Yii::app()->locale->numberFormatter->formatDecimal($model->{$fieldName});
}
$input = CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions));
if (isset($oldNumVal)) {
$model->{$fieldName} = $oldNumVal;
}
return $input;
default:
return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions));
// array(
// 'tabindex'=>isset($item['tabindex'])? $item['tabindex'] : null,
// 'disabled'=>$item['readOnly']? 'disabled' : null,
// 'title'=>$field->attributeLabel,
// 'style'=>$default?'color:#aaa;':null,
// ));
}
}