本文整理汇总了PHP中AuxLib::dropdownForJson方法的典型用法代码示例。如果您正苦于以下问题:PHP AuxLib::dropdownForJson方法的具体用法?PHP AuxLib::dropdownForJson怎么用?PHP AuxLib::dropdownForJson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuxLib
的用法示例。
在下文中一共展示了AuxLib::dropdownForJson方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionGetStageNames
/**
* Used to populate options of stage name dropdowns
*/
public function actionGetStageNames($workflowId, $optional = 'true')
{
$stages = Workflow::getStagesByNumber($workflowId);
if ($optional === 'true') {
echo CJSON::encode(AuxLib::dropdownForJson(array('any' => Yii::t('app', 'Any')) + $stages));
} else {
echo CJSON::encode(AuxLib::dropdownForJson($stages));
}
}
示例2: listOption
public static function listOption($attributes, $name)
{
if ($attributes instanceof Fields) {
$attributes = $attributes->getAttributes();
}
$data = array('name' => $name, 'label' => $attributes['attributeLabel']);
if (isset($attributes['type']) && $attributes['type']) {
$data['type'] = $attributes['type'];
}
if (isset($attributes['required']) && $attributes['required']) {
$data['required'] = 1;
}
if (isset($attributes['readOnly']) && $attributes['readOnly']) {
$data['readOnly'] = 1;
}
if (isset($attributes['type'])) {
if ($attributes['type'] === 'assignment' || $attributes['type'] === 'optionalAssignment') {
$data['options'] = AuxLib::dropdownForJson(X2Model::getAssignmentOptions(true, true));
} elseif ($attributes['type'] === 'dropdown' && isset($attributes['linkType'])) {
$data['linkType'] = $attributes['linkType'];
$data['options'] = AuxLib::dropdownForJson(Dropdowns::getItems($attributes['linkType']));
} elseif ($attributes['type'] === 'link' && isset($attributes['linkType'])) {
$staticLinkModel = X2Model::model($attributes['linkType']);
if (array_key_exists('X2LinkableBehavior', $staticLinkModel->behaviors())) {
$data['linkType'] = $attributes['linkType'];
$data['linkSource'] = Yii::app()->controller->createUrl($staticLinkModel->autoCompleteSource);
}
}
}
return $data;
}
示例3: actionGetFields
public function actionGetFields($model)
{
if (!class_exists($model)) {
echo 'false';
return;
}
$fieldModels = X2Model::model($model)->getFields();
$fields = array();
foreach ($fieldModels as &$field) {
if ($field->isVirtual) {
continue;
}
$data = array('name' => $field->fieldName, 'label' => $field->attributeLabel, 'type' => $field->type);
if ($field->required) {
$data['required'] = 1;
}
if ($field->readOnly) {
$data['readOnly'] = 1;
}
if ($field->type === 'assignment' || $field->type === 'optionalAssignment') {
$data['options'] = AuxLib::dropdownForJson(X2Model::getAssignmentOptions(true, true));
} elseif ($field->type === 'dropdown') {
$data['linkType'] = $field->linkType;
$data['options'] = AuxLib::dropdownForJson(Dropdowns::getItems($field->linkType));
}
if ($field->type === 'link') {
$staticLinkModel = X2Model::model($field->linkType);
if (array_key_exists('X2LinkableBehavior', $staticLinkModel->behaviors())) {
$data['linkType'] = $field->linkType;
$data['linkSource'] = Yii::app()->controller->createUrl($staticLinkModel->autoCompleteSource);
}
}
$fields[] = $data;
}
echo CJSON::encode($fields);
}