本文整理匯總了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;
}