本文整理汇总了PHP中DBManager::fromConvert方法的典型用法代码示例。如果您正苦于以下问题:PHP DBManager::fromConvert方法的具体用法?PHP DBManager::fromConvert怎么用?PHP DBManager::fromConvert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager
的用法示例。
在下文中一共展示了DBManager::fromConvert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: convertField
/**
* Converts the field value based on the provided fieldDef
* @param $fieldvalue
* @param $fieldDef
* @return string
*/
public function convertField($fieldvalue, $fieldDef)
{
if (!empty($fieldvalue)) {
if (!(isset($fieldDef['source']) && !in_array($fieldDef['source'], array('db', 'custom_fields', 'relate')) && !isset($fieldDef['dbType']))) {
// fromConvert other fields
$fieldvalue = $this->db->fromConvert($fieldvalue, $this->db->getFieldType($fieldDef));
}
}
return $fieldvalue;
}
示例2: fromConvertReportScheduleDBRow
/**
* Converts datetime values from the database type
* NOTE that this is currently hardcoded as this whole module should
* be converted to using SugarBeans, which would make this obsolete
* @param $row
* @return converted row
* TODO XXX Move this whole module to use SugarBeans
*/
protected function fromConvertReportScheduleDBRow($row)
{
if (!$row) {
return false;
}
foreach ($row as $name => $value) {
switch ($name) {
case 'date_start':
case 'next_run':
case 'date_modified':
$row[$name] = $this->db->fromConvert($row[$name], 'datetime');
default:
break;
}
}
return $row;
}
示例3: check_date_relationships_load
/**
* This function retrieves a record of the appropriate type from the DB.
* It fills in all of the fields from the DB into the object it was called on.
*
* @return mixed this - The object that it was called upon or null if exactly 1 record was not found.
*
*/
public function check_date_relationships_load()
{
global $disable_date_format;
global $timedate;
if (empty($timedate)) {
$timedate = TimeDate::getInstance();
}
if (empty($this->field_defs)) {
return;
}
foreach ($this->field_defs as $fieldDef) {
$field = $fieldDef['name'];
if (!isset($this->processed_dates_times[$field])) {
$this->processed_dates_times[$field] = '1';
if (empty($this->{$field})) {
continue;
}
if ($field == 'date_modified' || $field == 'date_entered') {
$this->{$field} = $this->db->fromConvert($this->{$field}, 'datetime');
if (empty($disable_date_format)) {
$this->{$field} = $timedate->to_display_date_time($this->{$field});
}
} elseif (isset($this->field_name_map[$field]['type'])) {
$type = $this->field_name_map[$field]['type'];
if ($type == 'relate' && isset($this->field_name_map[$field]['custom_module'])) {
$type = $this->field_name_map[$field]['type'];
}
if ($type == 'date') {
if ($this->{$field} == '0000-00-00') {
$this->{$field} = '';
} elseif (!empty($this->field_name_map[$field]['rel_field'])) {
$rel_field = $this->field_name_map[$field]['rel_field'];
if (!empty($this->{$rel_field})) {
if (empty($disable_date_format)) {
$merge_time = $timedate->merge_date_time($this->{$field}, $this->{$rel_field});
$this->{$field} = $timedate->to_display_date($merge_time);
$this->{$rel_field} = $timedate->to_display_time($merge_time);
}
}
} else {
if (empty($disable_date_format)) {
$this->{$field} = $timedate->to_display_date($this->{$field}, false);
}
}
} elseif ($type == 'datetime' || $type == 'datetimecombo') {
if ($this->{$field} == '0000-00-00 00:00:00') {
$this->{$field} = '';
} else {
if (empty($disable_date_format)) {
$this->{$field} = $timedate->to_display_date_time($this->{$field}, true, true);
}
}
} elseif ($type == 'time') {
if ($this->{$field} == '00:00:00') {
$this->{$field} = '';
} else {
//$this->$field = from_db_convert($this->$field, 'time');
if (empty($this->field_name_map[$field]['rel_field']) && empty($disable_date_format)) {
$this->{$field} = $timedate->to_display_time($this->{$field}, true, false);
}
}
} elseif ($type == 'encrypt' && empty($disable_date_format)) {
$this->{$field} = $this->decrypt_after_retrieve($this->{$field});
}
}
}
}
}
示例4: array
function get_next_row($result_field_name = 'result', $column_field_name = 'display_columns', $skip_non_summary_columns = false, $exporting = false)
{
global $current_user;
$chart_cells = array();
if ($this->do_export) {
$db_row = $this->db->fetchByAssoc($this->{$result_field_name}, false);
} else {
$db_row = $this->db->fetchByAssoc($this->{$result_field_name});
}
if ($db_row == 0 || sizeof($db_row) == 0) {
return 0;
}
// Call custom hooks
if (isset($this->full_bean_list) && is_array($this->full_bean_list) && array_key_exists('self', $this->full_bean_list) && is_object($this->full_bean_list['self']) && method_exists($this->full_bean_list['self'], 'call_custom_logic')) {
$this->full_bean_list['self']->call_custom_logic('process_report_row', array('row' => &$db_row, 'reporter' => $this));
}
if ($result_field_name == 'summary_result') {
if (!empty($this->child_filter) && !empty($db_row[$this->child_filter_name])) {
$this->child_filter_by = $db_row[$this->child_filter_name];
} else {
$this->child_filter = '';
$this->child_filter_by = '';
$this->child_filter_name = '';
}
}
$row = array();
$cells = array();
$fields = array();
foreach ($db_row as $key => $value) {
//if value is null or not set, then change to empty string. This prevents array index errors while processing
$fields[strtoupper($key)] = is_null($value) ? '' : $value;
}
// here we want to make copies, so use foreach
foreach ($this->report_def[$column_field_name] as $display_column) {
$display_column['table_alias'] = $this->getTableFromField($display_column);
$this->register_field_for_query($display_column);
if ($skip_non_summary_columns && empty($display_column['group_function'])) {
if ($exporting || $this->plain_text_output) {
array_push($cells, ' ');
} else {
array_push($cells, ' ');
}
continue;
}
$display_column['fields'] = $fields;
if ($this->plain_text_output == true) {
/*nsingh: bug 13554- date and time fields must be displayed using user's locale settings.
* Since to_pdf uses plain_text_output=true, we handle the date and time case here by using the 'List' context of the layout_manager
*/
if ($display_column['type'] == 'date' || $display_column['type'] == 'time' || $display_column['type'] == 'datetimecombo') {
$this->layout_manager->setAttribute('context', 'List');
} else {
$this->layout_manager->setAttribute('context', 'ListPlain');
}
} else {
$this->layout_manager->setAttribute('context', 'List');
}
// Make sure 'AVG' aggregate is shown as float, regardless of the original field type
if (!empty($display_column['group_function']) && strtolower($display_column['group_function']) === 'avg' && $display_column['type'] != 'currency') {
$display_column['type'] = 'float';
}
if ($display_column['type'] != 'currency' || substr_count($display_column['name'], '_usdoll') == 0 && (isset($display_column['group_function']) ? $display_column['group_function'] != 'weighted_amount' && $display_column['group_function'] != 'weighted_sum' : true)) {
$pos = $display_column['table_key'];
$module_name = '';
if ($pos) {
$module_name = substr($pos, strrpos($pos, ':') + 1);
}
$field_name = $this->getColumnFieldName($display_column);
if ($module_name == 'currencies' && empty($display_column['fields'][$field_name])) {
switch ($display_column['name']) {
case 'iso4217':
$display = $this->currency_obj->getDefaultISO4217();
break;
case 'symbol':
$display = $this->currency_obj->getDefaultCurrencySymbol();
break;
case 'name':
$display = $this->currency_obj->getDefaultCurrencyName();
break;
default:
$display = $this->layout_manager->widgetDisplay($display_column);
}
$display_column['fields'][$field_name] = $display;
} else {
if (!empty($field_name) && isset($display_column['fields'][$field_name])) {
$display_column['fields'][$field_name] = $this->db->fromConvert($display_column['fields'][$field_name], $display_column['type']);
}
$display = $this->layout_manager->widgetDisplay($display_column);
}
} else {
if (isset($display_column['group_function'])) {
$field_name = $this->getTruncatedColumnAlias(strtoupper($display_column['table_alias']) . "_" . strtoupper($display_column['group_function']) . "_" . strtoupper($display_column['name']));
} else {
unset($field_name);
}
if (!isset($field_name) || !isset($display_column['fields'][$field_name])) {
$field_name = $this->getTruncatedColumnAlias(strtoupper($display_column['table_alias']) . "_" . strtoupper($display_column['name']));
}
if (isset($display_column['fields'][$field_name])) {
$display = $display_column['fields'][$field_name];
//.........这里部分代码省略.........