function form_ajax_request($template_id) { $xml = get_template_detailes($template_id); $preview_image = get_preview_images($xml); $text_fields = get_text_fields($xml); $image_fields = get_image_fields($xml); return "{$preview_image}|{$text_fields} {$image_fields}"; }
function get_attribute_values($attribute_value_type = '', $attribute = array()) { $result = ''; if (!empty($attribute)) { $attribute_id = $attribute['attribute_id']; $this_attribute_group_type = $attribute['attribute_group_type']; $this_attribute_value_type = $attribute['attribute_value_type']; $attribute_values = array(); if (!empty($attribute['attribute_values'])) { $attribute_values = $attribute['attribute_values']; } if ($attribute_value_type == 'PC') { $counter = 0; $id = $attribute_id . '_PC_value'; $class = $attribute_id . '_value'; $result .= ' <div class="form_field attributes ' . $class . '" id="' . $id . '"> <div class="form_title">Contact:</div> <ul class="form_input picklist_contacts">'; if ($this_attribute_value_type == 'PC' && !empty($attribute_values)) { foreach ($attribute_values as $attribute_value) { $result .= get_contact_fields($attribute_id, $counter, $attribute_value); $counter++; } } else { $result .= get_contact_fields($attribute_id, $counter); } $result .= ' </ul> </div>'; } elseif ($attribute_value_type == 'PD') { $counter = 0; $id = $attribute_id . '_PD_value'; $class = $attribute_id . '_value'; $result .= ' <div class="form_field attributes ' . $class . '" id="' . $id . '"> <div class="form_title">Date Field:</div> <ul class="form_input picklist_dates">'; if ($this_attribute_value_type == 'PD' && !empty($attribute_values)) { foreach ($attribute_values as $attribute_value) { $result .= get_date_fields($attribute_id, $counter, $attribute_value); $counter++; } } else { $result .= get_date_fields($attribute_id, $counter); } $result .= ' </ul> </div>'; } elseif ($attribute_value_type == 'PT') { $counter = 0; $id = $attribute_id . '_PT_value'; $class = $attribute_id . '_value'; $result .= ' <div class="form_field attributes ' . $class . '" id="' . $id . '"> <div class="form_title">Text Field:</div> <ul class="form_input picklist_texts">'; if ($this_attribute_value_type == 'PT' && !empty($attribute_values)) { foreach ($attribute_values as $attribute_value) { $result .= get_text_fields($attribute_id, $counter, $attribute_value); $counter++; } } else { $result .= get_text_fields($attribute_id, $counter); } $result .= ' </ul> </div>'; } elseif ($this_attribute_group_type == 'M' || $attribute_value_type == 'SF') { $counter = 0; $id = $attribute_id . '_SF_value'; $class = $attribute_id . '_value'; $result .= ' <div class="form_field attributes ' . $class . '" id="' . $id . '"> <div class="form_title">Search String:</div> <ul class="form_input search_fields">'; if ($this_attribute_value_type == 'SF' && !empty($attribute_values)) { foreach ($attribute_values as $attribute_value) { $result .= get_search_fields($attribute_id, $counter, $attribute_value); $counter++; } } else { $result .= get_search_fields($attribute_id, $counter); } $found_value = isset($attribute['client_attribute_found_value']) ? $attribute['client_attribute_found_value'] : ''; $not_found_value = isset($attribute['client_attribute_not_found_value']) ? $attribute['client_attribute_not_found_value'] : ''; $found_id = 'attribute_value_found_' . $attribute_id; $not_found_id = 'attribute_value_not_found_' . $attribute_id; $found_data = array('name' => 'data[attribute_found_value_SF_' . $attribute_id . ']', 'size' => '50', 'maxlength' => '255', 'id' => $found_id); $not_found_data = array('name' => 'data[attribute_not_found_value_SF_' . $attribute_id . ']', 'size' => '50', 'maxlength' => '255', 'id' => $not_found_id); $result .= ' </ul> <div class="form_field found_value first"> <div class="form_title">Found Value:</div> <div class="form_input"> ' . form_input($found_data, $found_value) . ' </div> </div> <div class="form_field found_value"> <div class="form_title">Not Found Value:</div> <div class="form_input"> ' . form_input($not_found_data, $not_found_value) . ' </div> </div> </div>'; } } return $result; }