function pcp_format_input($type, $name, $value, $style = '', $protected = false) { global $types_list; if ($protected) { $res = pcp_format_output($type, $value, $style); } else { if (!empty($type) && isset($types_list[$type]) && !empty($types_list[$type]['get_func'])) { $func = $types_list[$type]['get_func']; $res = $func($name, $value); } else { if (substr($value, 0, 4) == '[lf]') { $value = '[lf]'; } if ($value == '%s') { $value = ''; } $func = 'pcp_input_varchar'; $res = $func($name, $value); } if (!empty($style)) { $res = sprintf($style, $res); } } return $res; }
$template->assign_block_vars('details.block.multi.col', array('TITLE' => ' ' . ($list_field[$j] != 'field_name' ? pcp_format_lang($field_def[$list_field[$j]]['short']) : $lang['PCP_usermaps_fields']) . ' ', 'WIDTH' => $list_field[$j] == 'field_name' ? '50%' : ($list_field[$j] == 'lang_key' ? '50%' : '10%'))); } $color = false; @reset($maps[$map]['fields']); $i = 0; while (list($field_name, $field_data) = @each($maps[$map]['fields'])) { $field_data['field_name'] = $field_name; $i++; $color = !$color; $template->assign_block_vars('details.block.multi.row', array('COLOR' => $color ? 'row1' : 'row2')); for ($j = 0; $j < count($list_field); $j++) { $value = $field_data[$list_field[$j]]; if (empty($value) && !empty($user_fields[$field_name][$list_field[$j]])) { $value = $user_fields[$field_name][$list_field[$j]]; } $template->assign_block_vars('details.block.multi.row.col', array('ALIGN' => empty($types_list[$field_def[$list_field[$j]]['type']]['align']) ? 'left' : $types_list[$field_def[$list_field[$j]]['type']]['align'], 'VALUE' => pcp_format_output($field_def[$list_field[$j]]['type'], $value, $field_def[$list_field[$j]]['style']))); } } // empty if ($i == 0) { $template->assign_block_vars('details.block.multi.none', array()); } } } // footer $s_hidden_fields = ''; $s_hidden_fields .= '<input type="hidden" name="map" value="' . $map . '" />'; $template->assign_vars(array('MAP_NAV_DESC' => $map_nav_desc, 'S_ACTION' => append_sid("./admin_pcp_usermaps.{$phpEx}"), 'S_HIDDEN_FIELDS' => $s_hidden_fields)); } // dump $template->pparse('body');