本文整理汇总了PHP中Credentials::getCredentialOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Credentials::getCredentialOptions方法的具体用法?PHP Credentials::getCredentialOptions怎么用?PHP Credentials::getCredentialOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Credentials
的用法示例。
在下文中一共展示了Credentials::getCredentialOptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: paramRules
public function paramRules()
{
if (Yii::app()->isInSession) {
$credOptsDict = Credentials::getCredentialOptions(null, true);
$credOpts = $credOptsDict['credentials'];
$selectedOpt = $credOptsDict['selectedOption'];
foreach ($credOpts as $key => $val) {
if ($key == $selectedOpt) {
$credOpts = array($key => $val) + $credOpts;
// move to beginning of array
break;
}
}
} else {
$credOpts = array();
}
return array_merge(parent::paramRules(), array('title' => Yii::t('studio', $this->title), 'info' => Yii::t('studio', $this->info), 'options' => array(array('name' => 'from', 'label' => Yii::t('studio', 'Send As:'), 'type' => 'dropdown', 'options' => $credOpts))));
}
示例2: fieldOptions
/**
* Gets possible values for a field.
*
* Note, this is meant to be a stripped-down imitation of what is in
* {@link X2Model} already. I know this is code duplication, but considering
*
* Note, does not yet handle multiple choice (selecting more than one).
*
* @param Fields $field
*/
public function fieldOptions(Fields $field)
{
switch ($field->type) {
case 'assignment':
return X2Model::getAssignmentOptions(true, true, false);
case 'credentials':
$typeArr = explode(':', $field->linkType);
$type = $typeArr[0];
if (count($typeAlias) > 1) {
$uid = Credentials::$sysUseId[$typeAlias[1]];
} else {
$uid = Yii::app()->getSuId();
}
if (count($typeArr > 0)) {
$uid = $typeArr[1];
}
$config = Credentials::getCredentialOptions($this->staticModel, $field->fieldName, $type, $uid);
return $config['credentials'];
case 'dropdown':
// Dropdown options
$dropdown = Dropdowns::model()->findByPk($field->linkType);
if ($dropdown instanceof Dropdowns) {
return json_decode($dropdown->options, 1);
}
break;
case 'optionalAssignment':
$options = X2Model::getAssignmentOptions(true, true, false);
unset($options['Anyone']);
$options[''] = '';
return $options;
case 'rating':
return range(Fields::RATING_MIN, Fields::RATING_MAX);
case 'varchar':
// Special kludge for actions priority dropdown mapping
if ($field->modelName == 'Actions' && $field->fieldName == 'priority') {
return Actions::getPriorityLabels();
}
break;
case 'visibility':
$permissionsBehavior = Yii::app()->params->modelPermissions;
return $permissionsBehavior::getVisibilityOptions();
}
return array();
}