本文整理汇总了PHP中X2Model::getAssociationTypeOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP X2Model::getAssociationTypeOptions方法的具体用法?PHP X2Model::getAssociationTypeOptions怎么用?PHP X2Model::getAssociationTypeOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X2Model
的用法示例。
在下文中一共展示了X2Model::getAssociationTypeOptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderInput
/**
* @param type $fieldName
* @param type $htmlOptions
*/
public function renderInput($fieldName, $htmlOptions = array())
{
switch ($fieldName) {
case 'color':
$field = $this->getField($fieldName);
$options = Dropdowns::getItems($field->linkType, null, false);
$enableDropdownLegend = Yii::app()->settings->enableColorDropdownLegend;
if ($enableDropdownLegend) {
$htmlOptions['options'] = array();
foreach ($options as $value => $label) {
$brightness = X2Color::getColorBrightness($value);
$fontColor = $brightness > 127.5 ? 'black' : 'white';
$htmlOptions['options'][$value] = array('style' => 'background-color: ' . $value . ';
color: ' . $fontColor);
}
}
return CHtml::activeDropDownList($this, $field->fieldName, $options, $htmlOptions);
case 'priority':
return CHtml::activeDropdownList($this, 'priority', self::getPriorityLabels());
case 'associationType':
return X2Html::activeMultiTypeAutocomplete($this, 'associationType', 'associationId', array('calendar' => Yii::t('app', 'Select an option')) + X2Model::getAssociationTypeOptions());
case 'reminder':
$reminderInput = parent::renderInput($fieldName, array('class' => 'reminder-checkbox'));
$reminderInput .= X2Html::openTag('div', X2Html::mergeHtmlOptions($htmlOptions, array('class' => 'reminder-config'))) . Yii::t('actions', 'Create a notification reminder for {user} {time} before this {action} ' . 'is due', array('{user}' => CHtml::activeDropDownList($this, 'notificationUsers', array('me' => Yii::t('actions', 'me'), 'assigned' => Yii::t('actions', 'the assigned user'), 'both' => Yii::t('actions', 'me and the assigned user'))), '{time}' => CHtml::activeDropDownList($this, 'notificationTime', array(1 => Yii::t('actions', '1 minute'), 5 => Yii::t('actions', '5 minutes'), 10 => Yii::t('actions', '10 minutes'), 15 => Yii::t('actions', '15 minutes'), 30 => Yii::t('actions', '30 minutes'), 60 => Yii::t('actions', '1 hour'), 1440 => Yii::t('actions', '1 day'), 10080 => Yii::t('actions', '1 week'))), '{action}' => lcfirst(Modules::displayName(false, 'Actions')))) . '</div>';
return $reminderInput;
default:
return parent::renderInput($fieldName, $htmlOptions);
}
}
示例2: unset
* You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
* California 95067, USA. or at email address contact@x2engine.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* X2Engine" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by X2Engine".
*****************************************************************************************/
Yii::app()->clientScript->registerCss('eventTabCss', "\n\n#calendar + br + #publisher-form #save-publisher {\n float: right !important;\n}\n\n");
if ($associationType === 'calendar') {
$associationTypeOptions = X2Model::getAssociationTypeOptions();
unset($associationTypeOptions['calendar']);
$associationTypeOptions = array('calendar' => Yii::t('app', 'Select an option')) + $associationTypeOptions;
$associationModels = array();
// get the association type => model name mapping for available options
foreach ($associationTypeOptions as $typ => $title) {
$associationModels[$typ] = X2Model::getModelName($typ);
}
Yii::app()->clientScript->registerScript('eventTabJS', "\n(function () {\n\n\$('#Actions_associationType').change (function () {\n var that = this;\n var associationModels = " . CJSON::encode($associationModels) . ";\n if (\$(this).val () === 'calendar') {\n \$('#association-type-autocomplete-container').hide ();\n \$('#association-type-autocomplete-container input').attr ('disabled', 'disabled');\n return false;\n }\n \$('#association-type-autocomplete-container input').removeAttr ('disabled');\n x2.forms.inputLoading (\$(this));\n \$.ajax ({\n type: 'GET',\n url: '" . Yii::app()->controller->createUrl('ajaxGetModelAutocomplete') . "',\n data: {\n modelType: associationModels[\$(this).val ()],\n name: 'Actions[associationName]'\n },\n success: function (data) {\n if (data !== 'failure') {\n // remove span element used by jQuery widget\n \$('#association-type-autocomplete-container input').\n first ().next ('span').remove ();\n // replace old autocomplete with the new one\n \$('#association-type-autocomplete-container input').first ().replaceWith (data); \n \$('#association-type-autocomplete-container').show ();\n } else {\n \$('#association-type-autocomplete-container').hide ();\n }\n x2.forms.inputLoadingStop (\$(that));\n }\n });\n});\n\n}) ();\n ", CClientScript::POS_READY);
}
?>
<div id='<?php
echo $this->resolveId('new-event');
?>
' class='publisher-form'