function render_value($source, $column_name) { if (isset($this->_source_fields[$column_name]) && isset($this->_source_fields[$column_name]['values']) && ($lookup = $this->_source_fields[$column_name]['values']) && is_object($lookup)) { $data = AMP_evalLookup($lookup); $value = $source->getData($column_name); if (isset($data[$value])) { return trim(str_replace(' ', ' ', $data[$value])); } } return parent::render_value($source, $column_name); }
function adjustFields($fields) { if (!isset($this->_modin)) { return $fields; } $udm =& new UserData(AMP_Registry::getDbcon(), $this->_modin); $end_field = array_pop($fields); $fields = array_merge($fields, $udm->fields); array_push($fields, $end_field); $target_array = $this->_action->getTargets(); if ($target_array) { $values = AMP_evalLookup($fields['target']['lookup']); $target_values = array_combine_key($target_array, $values); unset($fields['target']['lookup']); $fields['target']['values'] = $target_values; $fields['target']['default'] = join(",", $target_array); } return $fields; }
function discover_options($field_def) { $options = array(); if (isset($field_def['lookup']) && $field_def['lookup']) { $options = AMP_evalLookup($field_def['lookup']); } if (isset($field_def['values']) && is_array($field_def['values'])) { foreach ($field_def['values'] as $key => $value) { if (!is_array($value)) { $options[$value] = $value; continue; } if (isset($value['key']) && isset($value['value'])) { $options[$value['key']] = $value['value']; } } } return $options; }
function _getValueSet($name) { if (!($def = $this->getField($name))) { return null; } if (isset($def['lookup']) && ($values = AMP_evalLookup($def['lookup']))) { $this->setFieldValueSet($name, $values); return $values; } if (!(isset($def['values']) && $def['values'])) { return null; } if (!is_array(current($def['values']))) { return $def['values']; } $option_array = array(); foreach ($def['values'] as $v_key => $value) { if (!isset($value['key']) || !isset($value['value'])) { continue; } $option_array[$value['key']] = $value['value']; } return $option_array; }