本文整理汇总了PHP中Vtiger_Field_Model::getPicklistValues方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Field_Model::getPicklistValues方法的具体用法?PHP Vtiger_Field_Model::getPicklistValues怎么用?PHP Vtiger_Field_Model::getPicklistValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Field_Model
的用法示例。
在下文中一共展示了Vtiger_Field_Model::getPicklistValues方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPicklistValues
public function getPicklistValues()
{
$fieldDataType = $this->getFieldDataType();
if ($fieldDataType != 'picklist') {
return parent::getPicklistValues();
}
$pickListValues = array();
$pickListValues[""] = vtranslate("LBL_SELECT_OPTION", 'Settings:Webforms');
return $pickListValues + parent::getPicklistValues();
}
示例2: getPicklistValues
/**
* Function which will give the picklistvalues for given roleids
* @param type $roleIdList -- array of role ids
* @param type $groupMode -- Intersection/Conjuction , intersection will give only picklist values that exist for all roles
* @return type -- array
*/
public function getPicklistValues($roleIdList, $groupMode = 'INTERSECTION')
{
if (!$this->isRoleBased()) {
return parent::getPicklistValues();
}
$intersectionMode = false;
if ($groupMode == 'INTERSECTION') {
$intersectionMode = true;
}
$db = PearDatabase::getInstance();
$fieldName = $this->getName();
$tableName = 'vtiger_' . $fieldName;
$idColName = $fieldName . 'id';
$query = 'SELECT ' . $fieldName;
if ($intersectionMode) {
$query .= ',count(roleid) as rolecount ';
}
$query .= ' FROM vtiger_role2picklist INNER JOIN ' . $tableName . ' ON vtiger_role2picklist.picklistvalueid = ' . $tableName . '.picklist_valueid' . ' WHERE roleid IN (' . generateQuestionMarks($roleIdList) . ') order by sortid';
if ($intersectionMode) {
$query .= ' GROUP BY picklistvalueid';
}
$result = $db->pquery($query, $roleIdList);
$pickListValues = array();
$num_rows = $db->num_rows($result);
for ($i = 0; $i < $num_rows; $i++) {
$rowData = $db->query_result_rowdata($result, $i);
if ($intersectionMode) {
//not equal if specify that the picklistvalue is not present for all the roles
if ($rowData['rolecount'] != count($roleIdList)) {
continue;
}
}
//Need to decode the picklist values twice which are saved from old ui
$pickListValues[] = decode_html(decode_html($rowData[$fieldName]));
}
return $pickListValues;
}
示例3: 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()
{
if ($this->get('uitype') == 32) {
return Vtiger_Language_Handler::getAllLanguages();
} else {
if ($this->get('uitype') == '115') {
$db = PearDatabase::getInstance();
$query = 'SELECT ' . $this->getFieldName() . ' FROM vtiger_' . $this->getFieldName();
$result = $db->pquery($query, array());
$num_rows = $db->num_rows($result);
$fieldPickListValues = array();
for ($i = 0; $i < $num_rows; $i++) {
$picklistValue = $db->query_result($result, $i, $this->getFieldName());
$fieldPickListValues[$picklistValue] = vtranslate($picklistValue, $this->getModuleName());
}
return $fieldPickListValues;
}
}
return parent::getPicklistValues();
}