function DisplayLookupWizard($field, $value, $data, $keylink, $mode) { global $conn, $strTableName; if (!strlen($value)) { return ""; } $LookupSQL = "SELECT "; $LookupSQL .= GetLWDisplayField($field); $LookupSQL .= " FROM " . AddTableWrappers(GetLookupTable($field)) . " WHERE "; $where = ""; $lookupvalue = $value; $iquery = "field=" . htmlspecialchars(rawurlencode($field)) . $keylink; $out = ""; if (Multiselect($field)) { $arr = splitvalues($value); $numeric = true; $type = GetLWLinkFieldType($field); if (!$type) { foreach ($arr as $val) { if (strlen($val) && !is_numeric($val)) { $numeric = false; break; } } } else { $numeric = !NeedQuotes($type); } $in = ""; foreach ($arr as $val) { if ($numeric && !strlen($val)) { continue; } if (strlen($in)) { $in .= ","; } if ($numeric) { $in .= $val + 0; } else { $in .= db_prepare_string($val); } } if (strlen($in)) { $LookupSQL .= GetLWLinkField($field) . " in (" . $in . ")"; $where = GetLWWhere($field); if (strlen($where)) { $LookupSQL .= " and (" . $where . ")"; } LogInfo($LookupSQL); $rsLookup = db_query($LookupSQL, $conn); $found = false; while ($lookuprow = db_fetch_numarray($rsLookup)) { $lookupvalue = $lookuprow[0]; if ($found) { $out .= ","; } $found = true; $out .= GetDataInt($lookupvalue, $data, $field, ViewFormat($field)); } if ($found) { if (NeedEncode($field) && $mode != MODE_EXPORT) { return ProcessLargeText($out, $iquery, "", $mode, GetEditFormat($field)); } else { return $out; } } } } else { $strdata = make_db_value($field, $value); $LookupSQL .= GetLWLinkField($field) . " = " . $strdata; $where = GetLWWhere($field); if (strlen($where)) { $LookupSQL .= " and (" . $where . ")"; } LogInfo($LookupSQL); $rsLookup = db_query($LookupSQL, $conn); if ($lookuprow = db_fetch_numarray($rsLookup)) { $lookupvalue = $lookuprow[0]; } } if (!$out) { $out = GetDataInt($lookupvalue, $data, $field, ViewFormat($field)); } if (NeedEncode($field) && $mode != MODE_EXPORT) { $value = ProcessLargeText($out, $iquery, "", $mode, GetEditFormat($field)); } else { $value = $out; } return $value; }
function getFieldName($fieldValue, $data) { global $locale_info; $value = $data[$this->_recordBasedRequest ? $this->_name : $this->_sqlname]; if ($value == null || !$value || strcasecmp($value, 'null') == 0) { return 'NULL'; } if ($this->_interval == 0) { if ($this->_viewFormat) { return GetDataInt($value, array($this->_name => $value), $this->_name, $this->_viewFormat); } else { $date = db2time($value); return str_format_datetime($date); } } switch ($this->_interval) { case 1: $date = cached_db2time($value); return $date[0]; case 2: $date = cached_db2time($value); return $date[0] . '/Q' . intval($date[1] / 3); case 3: $date = cached_db2time($value); return @$locale_info["LOCALE_SABBREVMONTHNAME" . $date[1]] . " " . $date[0]; case 4: return cached_formatweekstart($value); case 5: $date = cached_db2time($value); return format_shortdate($date); case 6: $date = db2time($value); $date[4] = 0; $date[5] = 0; return str_format_datetime($date); case 7: $date = db2time($value); $date[5] = 0; return str_format_datetime($date); } }