本文整理汇总了PHP中Vtiger_Util_Helper::getRoleBasedPicklistValues方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Util_Helper::getRoleBasedPicklistValues方法的具体用法?PHP Vtiger_Util_Helper::getRoleBasedPicklistValues怎么用?PHP Vtiger_Util_Helper::getRoleBasedPicklistValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Util_Helper
的用法示例。
在下文中一共展示了Vtiger_Util_Helper::getRoleBasedPicklistValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPicklistValues
/**
* Function to get all the available picklist values for the current field
* @return <Array> List of picklist values if the field is of type picklist or multipicklist, null otherwise.
*/
public function getPicklistValues()
{
$fieldDataType = $this->getFieldDataType();
if ($this->getName() == 'hdnTaxType') {
return null;
}
if ($fieldDataType == 'picklist' || $fieldDataType == 'multipicklist') {
if ($this->isRoleBased()) {
$userModel = Users_Record_Model::getCurrentUserModel();
$picklistValues = Vtiger_Util_Helper::getRoleBasedPicklistValues($this->getName(), $userModel->get('roleid'));
} else {
$picklistValues = Vtiger_Util_Helper::getPickListValues($this->getName());
}
$fieldPickListValues = [];
foreach ($picklistValues as $value) {
$fieldPickListValues[$value] = vtranslate($value, $this->getModuleName());
}
return $fieldPickListValues;
} else {
if (method_exists($this->getUITypeModel(), 'getPicklistValues')) {
return $this->getUITypeModel()->getPicklistValues();
}
}
return null;
}
示例2: getReccurencePicklistValues
/**
* Function which will give the picklist values for a recurrence field
* @param type $fieldName -- string
* @return type -- array of values
*/
public static function getReccurencePicklistValues()
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$fieldModel = Vtiger_Field_Model::getInstance('recurringtype', Vtiger_Module_Model::getInstance('Events'));
if ($fieldModel->isRoleBased() && !$currentUser->isAdminUser()) {
$userModel = Users_Record_Model::getCurrentUserModel();
$picklistValues = Vtiger_Util_Helper::getRoleBasedPicklistValues('recurringtype', $userModel->get('roleid'));
} else {
$picklistValues = Vtiger_Util_Helper::getPickListValues('recurringtype');
}
foreach ($picklistValues as $value) {
$fieldPickListValues[$value] = vtranslate($value, 'Events');
}
return $fieldPickListValues;
}