本文整理汇总了PHP中getAssignedPicklistValues函数的典型用法代码示例。如果您正苦于以下问题:PHP getAssignedPicklistValues函数的具体用法?PHP getAssignedPicklistValues怎么用?PHP getAssignedPicklistValues使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getAssignedPicklistValues函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getUserFldArray
/**
* Function to get picklist fields for the given module
* @ param $fld_module
* It gets the picklist details array for the given module in the given format
* $fieldlist = Array(Array('fieldlabel'=>$fieldlabel,'generatedtype'=>$generatedtype,'columnname'=>$columnname,'fieldname'=>$fieldname,'value'=>picklistvalues))
*/
function getUserFldArray($fld_module, $roleid)
{
$adb = PearDatabase::getInstance();
$log = vglobal('log');
$user_fld = array();
$tabid = getTabid($fld_module);
$query = "select vtiger_field.fieldlabel,vtiger_field.columnname,vtiger_field.fieldname, vtiger_field.uitype" . " FROM vtiger_field inner join vtiger_picklist on vtiger_field.fieldname = vtiger_picklist.name" . " where (displaytype=1 and vtiger_field.tabid=? and vtiger_field.uitype in ('15','55','33','16') " . " or (vtiger_field.tabid=? and fieldname='salutationtype' and fieldname !='vendortype')) " . " and vtiger_field.presence in (0,2) ORDER BY vtiger_picklist.picklistid ASC";
$result = $adb->pquery($query, array($tabid, $tabid));
$noofrows = $adb->num_rows($result);
if ($noofrows > 0) {
$fieldlist = array();
for ($i = 0; $i < $noofrows; $i++) {
$user_fld = array();
$fld_name = $adb->query_result($result, $i, "fieldname");
$user_fld['fieldlabel'] = $adb->query_result($result, $i, "fieldlabel");
$user_fld['generatedtype'] = $adb->query_result($result, $i, "generatedtype");
$user_fld['columnname'] = $adb->query_result($result, $i, "columnname");
$user_fld['fieldname'] = $adb->query_result($result, $i, "fieldname");
$user_fld['uitype'] = $adb->query_result($result, $i, "uitype");
$user_fld['value'] = getAssignedPicklistValues($user_fld['fieldname'], $roleid, $adb);
$fieldlist[] = $user_fld;
}
}
return $fieldlist;
}
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:31,代码来源:PickListUtils.php
示例2: setupAccessiblePicklistValueList
public function setupAccessiblePicklistValueList($name)
{
$isRoleBased = vtws_isRoleBasedPicklist($name);
$this->picklistRoleMap[$name] = $isRoleBased;
if ($this->picklistRoleMap[$name]) {
$this->picklistValueMap[$name] = getAssignedPicklistValues($name, $this->user->roleid, $this->db);
}
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:8,代码来源:ListViewController.php
示例3: gv_getGVVarNames
function gv_getGVVarNames()
{
global $current_user, $adb;
require_once 'modules/PickList/PickListUtils.php';
$roleid = $current_user->roleid;
$picklistValues = getAssignedPicklistValues('gvname', $roleid, $adb);
if (!empty($picklistValues)) {
foreach ($picklistValues as $order => $pickListValue) {
$options[$pickListValue] = getTranslatedString($pickListValue, 'GlobalVariable');
}
}
asort($options);
$options = get_select_options_with_id($options, '--none--');
return $options;
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:15,代码来源:TestGlobalVar.php
示例4: sanitizeValues
/**
* this function takes in an array of values for an user and sanitizes it for export
* @param array $arr - the array of values
*/
function sanitizeValues($arr)
{
global $current_user, $adb;
$roleid = fetchUserRole($current_user->id);
foreach ($arr as $fieldlabel => &$value) {
$fieldInfo = $this->fieldsArr[$fieldlabel];
$uitype = $fieldInfo['uitype'];
$fieldname = $fieldInfo['fieldname'];
if ($uitype == 15 || $uitype == 16 || $uitype == 33) {
//picklists
if (empty($this->picklistValues[$fieldname])) {
$this->picklistValues[$fieldname] = getAssignedPicklistValues($fieldname, $roleid, $adb);
}
$value = trim($value);
} elseif ($uitype == 10) {
//have to handle uitype 10
$value = trim($value);
if (!empty($value)) {
$parent_module = getSalesEntityType($value);
$displayValueArray = getEntityName($parent_module, $value);
if (!empty($displayValueArray)) {
foreach ($displayValueArray as $k => $v) {
$displayValue = $v;
}
}
if (!empty($parent_module) && !empty($displayValue)) {
$value = $parent_module . "::::" . $displayValue;
} else {
$value = "";
}
} else {
$value = '';
}
}
}
return $arr;
}
开发者ID:nvh3010,项目名称:quancrm,代码行数:41,代码来源:export.php
示例5: sanitizeValues
/**
* this function takes in an array of values for an user and sanitizes it for export
* @param array $arr - the array of values
*/
function sanitizeValues($arr)
{
global $current_user, $adb;
$roleid = fetchUserRole($current_user->id);
$decimal = $current_user->currency_decimal_separator;
$numsep = $current_user->currency_grouping_separator;
foreach ($arr as $fieldlabel => &$value) {
$fieldInfo = $this->fieldsArr[$fieldlabel];
$uitype = $fieldInfo['uitype'];
$fieldname = $fieldInfo['fieldname'];
if ($uitype == 15 || $uitype == 16 || $uitype == 33) {
//picklists
if (empty($this->picklistValues[$fieldname])) {
$this->picklistValues[$fieldname] = getAssignedPicklistValues($fieldname, $roleid, $adb);
}
$value = trim($value);
} elseif ($uitype == 10) {
//have to handle uitype 10
$value = trim($value);
if (!empty($value)) {
$parent_module = getSalesEntityType($value);
$displayValueArray = getEntityName($parent_module, $value);
if (!empty($displayValueArray)) {
foreach ($displayValueArray as $k => $v) {
$displayValue = $v;
}
}
if (!empty($parent_module) && !empty($displayValue)) {
$value = $parent_module . "::::" . $displayValue;
} else {
$value = "";
}
} else {
$value = '';
}
} elseif ($uitype == 71 || $uitype == 72) {
$value = CurrencyField::convertToUserFormat($value, null, true);
} elseif ($uitype == 7 || $fieldInfo['typeofdata'] == 'N~O' || $uitype == 9) {
$value = number_format($value, 2, $decimal, $numsep);
}
}
return $arr;
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:47,代码来源:export.php
示例6: vtlib_purify
$fieldLabel = vtlib_purify($_REQUEST['fieldlabel']);
$moduleName = vtlib_purify($_REQUEST["moduleName"]);
$roleid = vtlib_purify($_REQUEST['roleid']);
if (!empty($roleid)) {
$roleName = getRoleName($roleid);
}
if ($moduleName == 'Events') {
$temp_module_strings = return_module_language($current_language, 'Calendar');
} else {
$temp_module_strings = return_module_language($current_language, $moduleName);
}
if (!empty($fieldName)) {
foreach (getAllPickListValues($fieldName, $temp_module_strings) as $key => $value) {
$values[$key] = $value;
}
}
foreach (getAssignedPicklistValues($fieldName, $roleid, $adb, $temp_module_strings) as $key => $value) {
$assignedValues[$key] = $value;
}
$smarty->assign("THEME", $theme);
$smarty->assign("FIELDNAME", $fieldName);
$smarty->assign("FIELDLABEL", getTranslatedString($fieldLabel));
$smarty->assign("MODULE", $moduleName);
$smarty->assign("PICKVAL", $values);
$smarty->assign("ASSIGNED_VALUES", $assignedValues);
$smarty->assign("ROLEID", $roleid);
$smarty->assign("ROLENAME", $roleName);
$smarty->assign("MOD", return_module_language($current_language, 'PickList'));
$smarty->assign("APP", $app_strings);
$data = $smarty->fetch("modules/PickList/AssignPicklistValues.tpl");
echo $data;
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:AssignValues.php
示例7: insertIntoEntityTable
//.........这里部分代码省略.........
//If the value in the request is Not Accessible for a picklist, the existing value will be replaced instead of Not Accessible value.
$sql = "select {$columname} from {$table_name} where " . $this->tab_name_index[$table_name] . "=?";
$res = $adb->pquery($sql, array($this->id));
$pick_val = $adb->query_result($res, 0, $columname);
$fldvalue = $pick_val;
} else {
$fldvalue = $this->column_fields[$fieldname];
}
} elseif ($uitype == 33 || $uitype == 3313 || $uitype == 1024) {
if (!is_array($this->column_fields[$fieldname])) {
$this->column_fields[$fieldname] = array_map('trim', explode('|##|', $this->column_fields[$fieldname]));
}
$sql = "select columnname,tablename from vtiger_field where tabid=? and fieldname=?";
$res = $adb->pquery($sql, array($tabid, $fieldname));
$colj = $adb->query_result($res, 0, 0);
$tabj = $adb->query_result($res, 0, 1);
$sql1 = "select {$colj} from {$tabj} where " . $this->tab_name_index[$tabj] . "=?";
$res = $adb->pquery($sql1, array($this->id));
$vlera = $adb->query_result($res, 0, $colj);
if (empty($vlera)) {
$currentvalues = array();
} else {
$currentvalues = array_map('trim', explode('|##|', decode_html($vlera)));
}
$selectedvalues = $this->column_fields[$fieldname];
if ($uitype == 3313) {
$uservalues = getAllowedPicklistModules();
} elseif ($uitype == 1024) {
$roleid = $current_user->roleid;
$subrole = getRoleSubordinates($roleid);
$uservalues = array_merge($subrole, array($roleid));
} else {
$roleid = $current_user->roleid;
$uservalues = getAssignedPicklistValues($fieldname, $roleid, $adb);
}
$vek = array_unique(array_merge(array_diff($currentvalues, $uservalues), $selectedvalues));
$fldvalue = implode(' |##| ', $vek);
} elseif ($uitype == 5 || $uitype == 6 || $uitype == 23) {
//Added to avoid function call getDBInsertDateValue in ajax save
if (isset($current_user->date_format) && !$ajaxSave) {
$fldvalue = getValidDBInsertDateValue($this->column_fields[$fieldname]);
} else {
$fldvalue = $this->column_fields[$fieldname];
}
} elseif ($uitype == 7) {
//strip out the spaces and commas in numbers if given ie., in amounts there may be ,
$fldvalue = str_replace(",", "", $this->column_fields[$fieldname]);
//trim($this->column_fields[$fieldname],",");
} elseif ($uitype == 26) {
if (empty($this->column_fields[$fieldname])) {
$fldvalue = 1;
//the documents will stored in default folder
} else {
$fldvalue = $this->column_fields[$fieldname];
}
} elseif ($uitype == 28) {
if ($this->column_fields[$fieldname] == null) {
$fileQuery = $adb->pquery("SELECT filename from vtiger_notes WHERE notesid = ?", array($this->id));
$fldvalue = null;
if (isset($fileQuery)) {
$rowCount = $adb->num_rows($fileQuery);
if ($rowCount > 0) {
$fldvalue = $adb->query_result($fileQuery, 0, 'filename');
}
}
} else {
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:67,代码来源:CRMEntity.php
示例8: getUserValuesConditions
private function getUserValuesConditions($conditions, $columns_arr)
{
global $current_user;
// kontrola picklist values permissions start
$user_privileges_path = 'user_privileges/user_privileges_' . $current_user->id . '.php';
if (file_exists($user_privileges_path)) {
require $user_privileges_path;
}
if (file_exists($user_privileges_path) && ($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0)) {
return $conditions;
} else {
if (!empty($columns_arr)) {
foreach ($columns_arr as $key_fld => $sc_fld_array) {
$sc_fieldcolname = $sc_fld_array["fieldcolname"];
$sc_fld_as = $this->columns_array[$sc_fieldcolname]["fld_alias"];
$sc_fld_arr = explode("_", $sc_fld_as);
$sc_lk = count($sc_fld_arr) - 1;
$sc_lk_lc = strtolower($sc_fld_arr[$sc_lk]);
if (in_array($sc_lk_lc, array("mif", "inv"))) {
unset($sc_fld_arr[$sc_lk]);
$sc_fld_name = implode("_", $sc_fld_arr);
} else {
$sc_fld_name = $sc_fld_as;
}
$sc_fld_cond = $this->columns_array[$sc_fieldcolname]["fld_cond"];
$sc_fld_ui_type = "";
if (array_key_exists($sc_fld_as, $this->columns_array) && isset($this->columns_array["uitype_{$sc_fld_as}"]) && $this->columns_array["uitype_{$sc_fld_as}"] != "") {
$sc_fld_ui_type = $this->columns_array["uitype_{$sc_fld_as}"];
}
/* elseif (array_key_exists($sc_fld_as, $this->result_columns_array) && isset($this->result_columns_array["uitype_$sc_fld_as"]) && $this->result_columns_array["uitype_$sc_fld_as"] != "") {
$sc_fld_ui_type = $this->result_columns_array["uitype_$sc_fld_as"];
} */
if (in_array($sc_fld_ui_type, ITS4YouReports::$s_uitypes)) {
require_once 'modules/PickList/PickListUtils.php';
$roleid = $current_user->roleid;
$adb = PearDatabase::getInstance();
$picklistValues = getAssignedPicklistValues($sc_fld_name, $roleid, $adb);
// ITS4YOU-UP SlOl 5. 12. 2014 8:38:10 long generation selectbox values fix
// admin picklist values
$admin_role_row = $adb->fetchByAssoc($adb->pquery("SELECT roleid FROM `vtiger_user2role` WHERE userid=1", array()), 0);
$admin_roleid = "";
if (!empty($admin_role_row)) {
$admin_roleid = $admin_role_row["roleid"];
}
if ($admin_roleid == "") {
$admin_roleid = "H1";
}
$picklistValuesHA = getAssignedPicklistValues($sc_fld_name, $admin_roleid, $adb);
if (!empty($picklistValues) && $picklistValues != $picklistValuesHA) {
// ITS4YOU-END
$w_picklistValues = implode("', '", $picklistValues);
$conditions[] = " {$sc_fld_cond} IN ('{$w_picklistValues}') ";
}
}
}
}
}
// kontrola picklist values permissions end
return $conditions;
}
开发者ID:cin-system,项目名称:cinrepo,代码行数:60,代码来源:GenerateObj.php
示例9: getOutputHtml
//.........这里部分代码省略.........
} elseif ($uitype == 1613) {
require_once 'modules/PickList/PickListUtils.php';
$editview_label[] = getTranslatedString($fieldlabel, $module_name);
$fieldname = $adb->sql_escape_string($fieldname);
$pickListResult = getAllowedPicklistModules();
$options = array();
$options[] = "";
$pickcount = 0;
$found = false;
foreach ($pickListResult as $pKey => $pValue) {
$value = decode_html($value);
$pickListValue = decode_html($pValue);
if ($value == trim($pickListValue)) {
$chk_val = "selected";
$pickcount++;
$found = true;
} else {
$chk_val = '';
}
$pickListValue = to_html($pickListValue);
if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') {
$options[] = array(htmlentities(getTranslatedString($pickListValue, $pickListValue), ENT_QUOTES, $default_charset), $pickListValue, $chk_val);
} else {
$options[] = array(getTranslatedString($pickListValue, $pickListValue), $pickListValue, $chk_val);
}
}
uasort($options, function ($a, $b) {
return strtolower($a[0]) < strtolower($b[0]) ? -1 : 1;
});
$fieldvalue[] = $options;
} elseif ($uitype == 15 || $uitype == 33) {
require_once 'modules/PickList/PickListUtils.php';
$roleid = $current_user->roleid;
$picklistValues = getAssignedPicklistValues($fieldname, $roleid, $adb);
$valueArr = explode("|##|", $value);
foreach ($valueArr as $key => $value) {
$valueArr[$key] = trim(html_entity_decode($value, ENT_QUOTES, $default_charset));
}
$pickcount = 0;
if (!empty($picklistValues)) {
foreach ($picklistValues as $order => $pickListValue) {
if (in_array(trim($pickListValue), $valueArr)) {
$chk_val = "selected";
$pickcount++;
} else {
$chk_val = '';
}
if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') {
$options[] = array(htmlentities(getTranslatedString($pickListValue), ENT_QUOTES, $default_charset), $pickListValue, $chk_val);
} else {
$options[] = array(getTranslatedString($pickListValue), $pickListValue, $chk_val);
}
}
if ($pickcount == 0 && !empty($value)) {
$options[] = array($app_strings['LBL_NOT_ACCESSIBLE'], $value, 'selected');
}
}
$editview_label[] = getTranslatedString($fieldlabel, $module_name);
$fieldvalue[] = $options;
} elseif ($uitype == 3313) {
require_once 'modules/PickList/PickListUtils.php';
$picklistValues = getAllowedPicklistModules();
$valueArr = explode("|##|", $value);
foreach ($valueArr as $key => $value) {
$valueArr[$key] = trim(html_entity_decode($value, ENT_QUOTES, $default_charset));
}
开发者ID:kduqi,项目名称:corebos,代码行数:67,代码来源:EditViewUtils.php
示例10: getSalesStageList
function getSalesStageList()
{
global $adb;
require_once 'modules/PickList/PickListUtils.php';
global $adb;
$sales_stage_list = array();
if (is_admin($this->current_user)) {
$pick_list_values = getAllPickListValues('sales_stage');
} else {
$pick_list_values = getAssignedPicklistValues('sales_stage', $this->current_user->roleid, $adb);
}
foreach ($pick_list_values as $value) {
$sales_stage_list[$value]["value"] = $value;
}
return $sales_stage_list;
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:16,代码来源:ConvertLeadUI.php
示例11: getFilterColHtml
function getFilterColHtml(Vtiger_Request $request)
{
require_once 'modules/ITS4YouReports/ITS4YouReports.php';
$return_html = "";
$n_c = 3;
$n_r = 5;
$n = $n_c * $n_r;
$sfield_name = $request->get("sfield_name");
$r_sel_fields = $request->get("r_sel_fields");
$adb = PearDatabase::getInstance();
global $current_user;
//$roleid = $current_user->roleid;
//$sub = getSubordinateRoleAndUsers($roleid);
$roleid = $current_user->roleid;
$sub = getRoleSubordinates($roleid);
$picklistGroupValues = array();
$currField = $request->get("currField");
$currField_arr = explode(":", $currField);
// list($s_tablename,$columnname,$s_module_field_label_str,$fieldname) = explode(":",$currField);
$s_tablename = $currField_arr[0];
$columnname = $currField_arr[1];
$s_module_field_label_str = $currField_arr[2];
$fieldname = $currField_arr[3];
$last_key = count($currField_arr) - 1;
$s_tablename_clear = $s_tablename;
if (is_numeric($currField_arr[$last_key]) || in_array($currField_arr[$last_key], array("INV", "MIF"))) {
$s_tablename_clear = trim($s_tablename, "_" . $currField_arr[$last_key]);
}
$s_module_field_arr = explode("_", $s_module_field_label_str);
$moduleName = $s_module_field_arr[0];
$moduleTabId = getTabid($moduleName);
$uitypeSql = "SELECT uitype FROM vtiger_field WHERE tabid=? AND tablename=? AND columnname=?";
//$adb->setDebug(true);
$uitypeParams = array($moduleTabId, $s_tablename_clear, $columnname);
$uitypeResult = $adb->pquery($uitypeSql, $uitypeParams);
$num_rowuitype = $adb->num_rows($uitypeResult);
if ($num_rowuitype > 0) {
$uitype_row = $adb->fetchByAssoc($uitypeResult);
} elseif ($moduleName == "Leads" && $fieldname == "converted") {
$uitype_row = array("uitype" => "56");
} else {
$uitype_row = array("uitype" => "1");
}
if (!empty($uitype_row) && in_array($uitype_row["uitype"], ITS4YouReports::$s_users_uitypes)) {
$picklistValues = get_user_array(false);
$groups = get_group_array(false);
if (!empty($groups)) {
foreach ($groups as $g_key => $g_name) {
$picklistGroupValues[$g_key] = $g_name;
}
}
$valueArr = explode("|##|", $value);
} elseif (!empty($uitype_row) && $uitype_row['uitype'] == '56') {
$picklistValues = array("0" => "LBL_NO", "1" => "LBL_YES");
//$valueArr = explode("|##|", $r_sel_fields);
$valueArr = explode(",", $r_sel_fields);
} elseif (!empty($uitype_row) && $uitype_row['uitype'] == '26') {
$sql = "select foldername,folderid from vtiger_attachmentsfolder order by foldername asc ";
$res = $adb->pquery($sql, array());
for ($i = 0; $i < $adb->num_rows($res); $i++) {
$fid = $adb->query_result($res, $i, "folderid");
$picklistValues[$fid] = $adb->query_result($res, $i, "foldername");
}
$valueArr = explode(",", $r_sel_fields);
} elseif (!empty($uitype_row) && $uitype_row['uitype'] == '27') {
$picklistValues = array("I" => "LBL_INTERNAL", "E" => "LBL_EXTERNAL");
$valueArr = explode(",", $r_sel_fields);
} else {
require_once 'modules/PickList/PickListUtils.php';
if ($uitype_row["uitype"] == "16") {
$picklistValues = Vtiger_Util_Helper::getPickListValues($columnname);
} else {
$picklistValues = getAssignedPicklistValues($fieldname, $roleid, $adb);
$valueArr = explode("|##|", $value);
}
}
$pickcount = 0;
$sel_fields = array();
$field_uitype = $uitype_row["uitype"];
if (!empty($picklistValues)) {
foreach ($picklistValues as $order => $pickListValue) {
$pickListValue = trim($pickListValue);
if ($uitype_row['uitype'] == '56') {
$check_val = $pickListValue == "LBL_YES" ? "yes" : "no";
if (in_array(trim($order), array_map("trim", $valueArr)) || in_array($check_val, $valueArr)) {
$chk_val = "selected";
} else {
$chk_val = "";
}
$pickcount++;
} elseif (in_array(trim($pickListValue), array_map("trim", $valueArr))) {
$chk_val = "selected";
$pickcount++;
} else {
$chk_val = '';
}
if ($uitype_row['uitype'] == '56') {
$sel_fields[] = array(vtranslate($pickListValue, $s_module_field_arr[0]), $order, $chk_val);
} else {
$sel_fields[] = array(vtranslate($pickListValue, $s_module_field_arr[0]), $pickListValue, $chk_val);
//.........这里部分代码省略.........
开发者ID:cin-system,项目名称:cinrepo,代码行数:101,代码来源:IndexAjax.php
示例12: vtigerCRM_Smarty
global $adb, $current_user, $app_strings, $current_language, $theme;
$smarty = new vtigerCRM_Smarty();
$smarty->assign("IMAGE_PATH", $image_path);
$fieldName = vtlib_purify($_REQUEST["fieldname"]);
$fieldLabel = vtlib_purify($_REQUEST['fieldlabel']);
$moduleName = vtlib_purify($_REQUEST["moduleName"]);
$roleid = vtlib_purify($_REQUEST['roleid']);
if (!empty($roleid)) {
$roleName = getRoleName($roleid);
}
if ($moduleName == 'Events') {
$temp_module_strings = return_module_language($current_language, 'Calendar');
} else {
$temp_module_strings = return_module_language($current_language, $moduleName);
}
if (!empty($fieldName)) {
$values = getAllPickListValues($fieldName);
}
$assignedValues = getAssignedPicklistValues($fieldName, $roleid, $adb);
$smarty->assign("THEME", $theme);
$smarty->assign("FIELDNAME", $fieldName);
$smarty->assign("FIELDLABEL", getTranslatedString($fieldLabel));
$smarty->assign("MODULE", $moduleName);
$smarty->assign("PICKVAL", $values);
$smarty->assign("ASSIGNED_VALUES", $assignedValues);
$smarty->assign("ROLEID", $roleid);
$smarty->assign("ROLENAME", $roleName);
$smarty->assign("MOD", return_module_language($current_language, 'PickList'));
$smarty->assign("APP", $app_strings);
$data = $smarty->fetch("modules/PickList/AssignPicklistValues.tpl");
echo $data;
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:31,代码来源:AssignValues.php
示例13: getFieldDisplayValue
function getFieldDisplayValue($moduleName, $recordId, $fieldInstance, $value)
{
global $current_user;
$adb = PearDatabase::getInstance();
$fieldName = $fieldInstance->getFieldName();
$uitype = $fieldInstance->getUIType();
if ($moduleName == 'Documents') {
if ($fieldName == 'filesize') {
$filesize = $value;
if (empty($fieldsize)) {
$value = '--';
} elseif ($filesize < 1024) {
$value = $filesize . ' B';
} elseif ($filesize > 1024 && $filesize < 1048576) {
$value = round($filesize / 1024, 2) . ' KB';
} else {
if ($filesize > 1048576) {
$value = round($filesize / (1024 * 1024), 2) . ' MB';
}
}
}
if ($fieldName == 'filestatus') {
if ($value == 1) {
$value = getTranslatedString('yes', $moduleName);
} elseif ($value == 0) {
$value = getTranslatedString('no', $moduleName);
} else {
$value = '--';
}
}
if ($fieldName == 'filetype') {
if ($value == 1) {
$value = getTranslatedString('yes', $moduleName);
} elseif ($value == 0) {
$value = getTranslatedString('no', $moduleName);
} else {
$value = '--';
}
}
}
if ($fieldInstance->getUIType() == '27') {
if ($value == 'I') {
$value = getTranslatedString('LBL_INTERNAL', $moduleName);
} elseif ($value == 'E') {
$value = getTranslatedString('LBL_EXTERNAL', $moduleName);
} else {
$value = ' --';
}
}
if ($fieldInstance->getFieldDataType() == 'picklist') {
$isRoleBased = vtws_isRoleBasedPicklist($fieldName);
if ($isRoleBased && ($fieldName != 'activitytype' || $value != 'Task')) {
$accessiblePicklistValues = getAssignedPicklistValues($fieldName, $current_user->roleid, $adb);
if (!empty($value) && !is_admin($current_user) && !in_array($value, $accessiblePicklistValues)) {
$value = "<font color='red'>" . getTranslatedString('LBL_NOT_ACCESSIBLE', $moduleName) . "</font>";
} else {
$value = getTranslatedString($value, $moduleName);
}
} else {
$value = getTranslatedString($value, $moduleName);
}
}
if ($fieldInstance->getFieldDataType() == 'date' || $fieldInstance->getFieldDataType() == 'datetime' || $fieldInstance->getFieldDataType() == 'time') {
if ($value != '' && $value != '0000-00-00') {
$date = new DateTimeField($value);
if ($fieldInstance->getFieldDataType() == 'date') {
$value = $date->getDisplayDate();
}
if ($fieldInstance->getFieldDataType() == 'datetime') {
$value = $date->getDisplayDateTimeValue();
}
if ($fieldInstance->getFieldDataType() == 'time') {
$value = $date->getDisplayTime();
}
} else {
$value = '';
}
}
if ($fieldInstance->getFieldDataType() == 'currency') {
if ($value != '' && $value != 0) {
if ($fieldInstance->getUIType() == 72) {
if ($fieldName == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $moduleName);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($moduleName, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
$currencyValue = CurrencyField::convertToUserFormat($value, null, true);
$value = CurrencyField::appendCurrencySymbol($currencyValue, $currencySymbol);
} else {
$currencyField = new CurrencyField($value);
$value = $currencyField->getDisplayValueWithSymbol();
}
}
}
if ($fieldInstance->getFieldDataType() == 'url') {
$matchPattern = "^[\\w]+:\\/\\/^";
preg_match($matchPattern, $value, $matches);
//.........这里部分代码省略.........
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:101,代码来源:ModTracker_Field.php
示例14: GenWithoutDashboard
private function GenWithoutDashboard($data)
{
$js = NULL;
$js .= $this->load_library() . "\n";
if ($this->open_js_tag === TRUE) {
$js .= '<script type="text/javascript">' . "\n";
}
// Load the Visualization API and the controls package.
$js .= 'google.load("visualization", "1", {packages:["corechart"]});' . "\n";
// Set a callback to run when the Google Visualization API is loaded.
$js .= 'google.setOnLoadCallback(drawChart);' . "\n";
// Callback that creates and populates a data table,
// instantiates a dashboard, a range slider and a pie chart,
// passes in the data and draws it.
$js .= 'function drawChart() {' . "\n";
global $default_charset;
if ($this->chart_type == "funnel") {
// Create our data table.
if (!empty($data)) {
$values_array = $data_values_array = array();
$spacing_array = array("");
foreach ($data as $data_key => $data_arr) {
// $data_arr[0] = x axis
// $data_arr[1] = y axis
if ($data_key == 0) {
$values_label = $data_arr[1];
} else {
// $data_arr[0] = label , $data_arr[1] = value
$values_array[$data_arr[0]] = $data_arr[1];
}
}
$s_uitypes = ITS4YouReports::$s_uitypes;
if (in_array($this->chart_column_uitype, $s_uitypes) && $this->chart_column_str != "") {
global $current_user;
require_once 'modules/PickList/PickListUtils.php';
$roleid = $current_user->roleid;
$adb = PearDatabase::getInstance();
$column_str_arr = explode(":", $this->chart_column_str);
$column_name = $column_str_arr[1];
$picklistValues = getAssignedPicklistValues($column_name, $roleid, $adb);
$ordered_values_array = array();
foreach ($picklistValues as $picklistValuesKey => $picklistValuesVal) {
if (array_key_exists($picklistValuesKey, $values_array)) {
$ordered_values_array[$picklistValuesKey] = $values_array[$picklistValuesKey];
}
}
if (!empty($ordered_values_array)) {
$values_array = $ordered_values_array;
}
}
$data_values_array[] = $values_label;
$max_data = max($values_array);
foreach ($values_array as $dv_key => $data_value) {
if ($max_data == $data_value) {
$spacing_array[] = 0;
}
if ($max_data != $data_value && is_numeric($data_value)) {
$spacing_array[] = ($max_data - $data_value) / 2;
}
$data_labels_array[] = $dv_key . " [{$data_value}]";
$data_values_array[] = $data_value;
}
}
$spacing_array = $this->array_to_jsarray($spacing_array);
$data_values_array = $this->array_to_jsarray($data_values_array);
$data_labels_array = $this->array_to_jsarray($data_labels_array);
$js_spacing_array = html_entity_decode($spacing_array, ENT_QUOTES, $default_charset);
$js_data_values_array = html_entity_decode($data_values_array, ENT_QUOTES, $default_charset);
$js_data_labels_array = html_entity_decode($data_labels_array, ENT_QUOTES, $default_charset);
$js .= '
var data = new google.visualization.DataTable();
var raw_data = [' . $js_spacing_array . ',
' . $js_data_values_array . '];
var data_values = ' . $js_data_labels_array . ';
data.addColumn("string", "");
for (var i = 0; i < raw_data.length; ++i) {
data.addColumn("number", raw_data[i][0]);
}
data.addRows(data_values.length);
for (var j = 0; j < data_values.length; ++j) {
data.setValue(j, 0, data_values[j].toString());
}
for (var i = 0; i < raw_data.length; ++i) {
for (var j = 1; j < raw_data[i].length; ++j) {
data.setValue(j-1, i+1, raw_data[i][j]);
}
}
';
/*
var colors=["#3366cc","#dc3912","#ff9900","#109618","#990099","#0099c6","#dd4477","#66aa00","#b82e2e","#316395","#994499","#22aa99","#aaaa11","#6633cc","#e67300","#8b0707","#651067","#329262","#5574a6","#3b3eac","#b77322","#16d620","#b91383","#f4359e","#9c5935","#a9c413","#2a778d","#668d1c","#bea413","#0c5922","#743411"];
//the code
view.columns.sort(function (a, b) {
return (a - b);
});
//.........这里部分代码省略.........
开发者ID:cin-system,项目名称:cinrepo,代码行数:101,代码来源:gcharts.php
示例15: transformRecordWithGrouping
protected function transformRecordWithGrouping($resultRecord, $module, $isTemplateRecord = false)
{
$current_user = $this->getActiveUser();
$moduleFieldGroups = Mobile_WS_Utils::gatherModuleFieldGroupInfo($module);
$modifiedResult = array();
$blocks = array();
$labelFields = false;
foreach ($moduleFieldGroups as $blocklabel => $fieldgroups) {
$fields = array();
foreach ($fieldgroups as $fieldname => $fieldinfo) {
$value = $resultRecord[$fieldname];
$fieldlabel = $fieldinfo['label'];
// get field information
if (isset($resultRecord[$fieldname])) {
//get standard content & perform special settings
if ($fieldinfo['uitype'] == 17 && strlen($resultRecord[$fieldname])) {
//www fields
if ($_REQUEST['_operation'] == 'edit') {
$resultRecord[$fieldname] = $resultRecord[$fieldname];
} else {
$htmlstring = str_replace("http://", "", $resultRecord[$fieldname]);
$resultRecord[$fieldname] = "<A HREF=\"#\" onclick=\"window.location.href ='http://" . $htmlstring . "';\" rel=external>" . $htmlstring . "</A>";
}
}
if ($fieldinfo['uitype'] == 13 && strlen($resultRecord[$fieldname])) {
// email fields
if ($_REQUEST['_operation'] == 'edit') {
$resultRecord[$fieldname] = $resultRecord[$fieldname];
} else {
$resultRecord[$fieldname] = "<A HREF=\"#\" onclick=\"window.location.href ='mailto:" . $resultRecord[$fieldname] . "';\">" . $resultRecord[$fieldname] . "</A>";
}
}
if ($fieldinfo['uitype'] == 72 && strlen($resultRecord[$fieldname])) {
//currency fields
$resultRecord[$fieldname] = round($resultRecord[$fieldname], 2);
}
$field = array('name' => $fieldname, 'value' => $resultRecord[$fieldname], 'label' => $fieldinfo['label'], 'uitype' => $fieldinfo['uitype'], 'typeofdata' => $fieldinfo['typeofdata']);
// Template record requested, send more details if available
if ($isTemplateRecord) {
$describeFieldInfo = $this->cachedDescribeFieldInfo($fieldname);
foreach ($describeFieldInfo as $k => $v) {
if (isset($field[$k])) {
continue;
}
$field[$k] = $v;
}
// Entity fieldnames
$labelFields = $this->cachedEntityFieldnames($module);
}
//handling for special UI types: modify $field
if ($field['uitype'] == '53') {
//assigned user
global $adb;
$output = array_chunk($value, 1);
$recordarray = explode('x', $output[0][0]);
$recordprefix = $recordarray[0];
$value = $output[0][0];
if ($value != '' && $value != 0) {
$assigned_user_id = $value;
} else {
$assigned_user_id = $current_user->id;
}
$fieldvalue = Mobile_WS_Utils::getassignedtoValues($current_user, $assigned_user_id);
$field['type']['value'] = array('value' => $fieldvalue, 'name' => $fieldname);
//end UI 53
} else {
if ($field['uitype'] == '117') {
$field['type']['defaultValue'] = $field['value'];
} else {
if ($field['uitype'] == '15' || $field['uitype'] == '16' || $field['uitype'] == '33') {
//picklists
global $adb;
require_once 'modules/PickList/PickListUtils.php';
$fieldvalue = array();
$options = array();
$chk_val = "";
$roleid = $current_user->roleid;
$picklistValues = getAssignedPicklistValues($fieldname, $roleid, $adb);
$valueArr = explode("|##|", $value);
$pickcount = 0;
//get values
if (!empty($picklistValues)) {
foreach ($picklistValues as $order => $pickListValue) {
if (in_array(trim($pickListValue), array_map("trim", $valueArr))) {
$chk_val = "selected";
$pickcount++;
} else {
$chk_val = '';
}
if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') {
$options[] = array('label' => htmlentities(getTranslatedString($pickListValue), ENT_QUOTES, $default_charset), 'value' => $pickListValue, 'selected' => $chk_val);
} else {
$options[] = array('label'
|
请发表评论