function get_fixed_values($DB, $field_id) { $contents_table = fixed_values_table_name($field_id); $query = "SELECT val FROM {$contents_table} ORDER BY id"; $fixed_values = array(); $result = $DB->Execute($query); if ($result != false) { while (!$result->EOF) { $fixed_values[] = $result->fields[0]; $result->MoveNext(); } } return $fixed_values; }
break; } } if ($action != "") { $DB->StartTrans(); $query = "SELECT field_type, field_index FROM {$field_types_table}\n\t\t\t\t\t WHERE field_id={$field_id} AND field_form={$quoted_form_name}"; $res = db_execute($DB, $query, $error_detected); if ($res != false && !$res->EOF) { $old_rank = $res->fields['field_index']; $query_list = array(); if ($action == "del") { $query_list[] = "UPDATE {$field_types_table}\n\t\t\t\t\t\t\t\t SET field_index=field_index-1\n\t\t\t\t\t\t\t\t WHERE field_index > {$old_rank} AND\n\t\t\t\t\t\t\t\t field_form={$quoted_form_name}"; $query_list[] = "DELETE FROM {$fields_table}\n\t\t\t\t\t\t\t\t WHERE field_id={$field_id} AND\n\t\t\t\t\t\t\t\t field_form={$quoted_form_name}"; $query_list[] = "DELETE FROM {$field_types_table}\n\t\t\t\t\t\t\t\t WHERE field_id={$field_id} AND\n\t\t\t\t\t\t\t\t field_form={$quoted_form_name}"; if ($field_properties[$res->fields['field_type']]['fixed_values']) { $contents_table = fixed_values_table_name($field_id); $query_list[] = "DROP TABLE {$contents_table}"; } $query = "SELECT field_name\n\t\t\t\t\t\t\t FROM {$field_types_table}\n\t\t\t\t\t\t\t WHERE field_id={$field_id}"; $field_name = db_get_one($DB, $query, $error_detected); delete_dynamic_translation($DB, $field_name, $error_detected); } elseif ($action != "") { $direction = $action == "up" ? -1 : 1; $new_rank = $old_rank + $direction; $query_list[] = "UPDATE {$field_types_table}\n\t\t\t\t\t\t\t\t SET field_index={$old_rank}\n\t\t\t\t\t\t\t\t WHERE field_index={$new_rank} AND\n\t\t\t\t\t\t\t\t field_form={$quoted_form_name}"; $query_list[] = "UPDATE {$field_types_table}\n\t\t\t\t\t\t\t\t SET field_index={$new_rank}\n\t\t\t\t\t\t\t\t WHERE field_id={$field_id} AND\n\t\t\t\t\t\t\t\t field_form={$quoted_form_name}"; } foreach ($query_list as $query) { db_execute($DB, $query, $error_detected); } }