本文整理汇总了PHP中Vtiger_Util_Helper::getPickListId方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Util_Helper::getPickListId方法的具体用法?PHP Vtiger_Util_Helper::getPickListId怎么用?PHP Vtiger_Util_Helper::getPickListId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Util_Helper
的用法示例。
在下文中一共展示了Vtiger_Util_Helper::getPickListId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValuesFromField
public static function getValuesFromField($fieldName)
{
$db = PearDatabase::getInstance();
$primaryKey = Vtiger_Util_Helper::getPickListId($fieldName);
$query = 'SELECT * FROM vtiger_' . $fieldName . ' order by sortorderid';
$values = array();
$result = $db->pquery($query, array());
$num_rows = $db->num_rows($result);
for ($i = 0; $i < $num_rows; $i++) {
//Need to decode the picklist values twice which are saved from old ui
$groupColors[] = array('id' => $db->query_result($result, $i, $primaryKey), 'value' => decode_html(decode_html($db->query_result($result, $i, $fieldName))), 'color' => $db->query_result($result, $i, 'color'));
}
return $groupColors;
}
示例2: getPickListValues
/**
* Function which will give the picklist values for a field
* @param type $fieldName -- string
* @return type -- array of values
*/
public static function getPickListValues($fieldName) {
$cache = Vtiger_Cache::getInstance();
if($cache->getPicklistValues($fieldName)) {
return $cache->getPicklistValues($fieldName);
}
$db = PearDatabase::getInstance();
$primaryKey = Vtiger_Util_Helper::getPickListId($fieldName);
$query = 'SELECT '.$primaryKey.', '.$fieldName.' FROM vtiger_'.$fieldName.' order by sortorderid';
$values = array();
$result = $db->pquery($query, array());
$num_rows = $db->num_rows($result);
for($i=0; $i<$num_rows; $i++) {
//Need to decode the picklist values twice which are saved from old ui
$values[$db->query_result($result,$i,$primaryKey)] = decode_html(decode_html($db->query_result($result,$i,$fieldName)));
}
$cache->setPicklistValues($fieldName, $values);
return $values;
}
示例3: updateSequence
public function updateSequence($pickListFieldName, $picklistValues)
{
$db = PearDatabase::getInstance();
$primaryKey = Vtiger_Util_Helper::getPickListId($pickListFieldName);
$query = 'UPDATE ' . $this->getPickListTableName($pickListFieldName) . ' SET sortorderid = CASE ';
foreach ($picklistValues as $values => $sequence) {
$query .= ' WHEN ' . $primaryKey . '="' . $values . '" THEN "' . $sequence . '"';
}
$query .= ' END';
$db->pquery($query, array());
}
示例4: getPickListValues
/**
* Function which will give the picklist values for a field
* @param type $fieldName -- string
* @return type -- array of values
*/
public static function getPickListValues($fieldName)
{
$cache = Vtiger_Cache::getInstance();
if ($cache->getPicklistValues($fieldName)) {
return $cache->getPicklistValues($fieldName);
}
$db = PearDatabase::getInstance();
$primaryKey = Vtiger_Util_Helper::getPickListId($fieldName);
$query = 'SELECT ' . $primaryKey . ', ' . $fieldName . ' FROM vtiger_' . $fieldName . ' order by sortorderid';
$values = [];
$result = $db->query($query);
while ($row = $db->fetch_array($result)) {
$values[$row[$primaryKey]] = decode_html(decode_html($row[$fieldName]));
}
$cache->setPicklistValues($fieldName, $values);
return $values;
}
示例5: getNonEditablePicklistValues
/**
* Function which will give the non editable picklist values for a field
* @param type $fieldName -- string
* @return type -- array of values
*/
public static function getNonEditablePicklistValues($fieldName)
{
$cache = Vtiger_Cache::getInstance();
$NonEditablePicklistValues = $cache->get('NonEditablePicklistValues', $fieldName);
if ($NonEditablePicklistValues) {
return $NonEditablePicklistValues;
}
$db = PearDatabase::getInstance();
//SalesPlatform.ru begin fix picklist value unique id cretation
$primaryKey = Vtiger_Util_Helper::getPickListId($fieldName);
$query = "select {$primaryKey} ,{$fieldName} from vtiger_{$fieldName} where presence=0";
//$query = "select $fieldName from vtiger_$fieldName where presence=0";
//SalesPlatform.ru end
$values = array();
$result = $db->pquery($query, array());
$num_rows = $db->num_rows($result);
for ($i = 0; $i < $num_rows; $i++) {
//Need to decode the picklist values twice which are saved from old ui
//SalesPlatform.ru begin fix picklist value unique id cretation
$values[$db->query_result($result, $i, $primaryKey)] = decode_html(decode_html($db->query_result($result, $i, $fieldName)));
//$values[] = decode_html(decode_html($db->query_result($result,$i,$fieldName)));
//SalesPlatform.ru end
}
$cache->set('NonEditablePicklistValues', $fieldName, $values);
return $values;
}
示例6: getEditablePicklistValues
/**
* Function which will give the editable picklist values for a field
* @param type $fieldName -- string
* @return type -- array of values
*/
public static function getEditablePicklistValues($fieldName)
{
$cache = Vtiger_Cache::getInstance();
$EditablePicklistValues = $cache->get('EditablePicklistValues', $fieldName);
if ($EditablePicklistValues) {
return $EditablePicklistValues;
}
$db = PearDatabase::getInstance();
$primaryKey = Vtiger_Util_Helper::getPickListId($fieldName);
$query = "SELECT {$primaryKey} ,{$fieldName} FROM vtiger_{$fieldName} WHERE presence=1 AND {$fieldName} <> '--None--'";
$values = array();
$result = $db->pquery($query, array());
$num_rows = $db->num_rows($result);
for ($i = 0; $i < $num_rows; $i++) {
//Need to decode the picklist values twice which are saved from old ui
$values[$db->query_result($result, $i, $primaryKey)] = decode_html(decode_html($db->query_result($result, $i, $fieldName)));
}
$cache->set('EditablePicklistValues', $fieldName, $values);
return $values;
}