function multi_select($name, $lookup_results, $mask, $length, $size, $value, $onchange_event = NULL, $disabled = FALSE) { if (get_opendb_config_var('widgets', 'enable_javascript_validation') !== FALSE) { $onchange = "onchange=\"{$onchange_event}\""; } else { $onchange = "onchange=\"{$onchange_event}\""; } if (is_numeric($size) && $size > 1) { $var = "\n<select multiple name=\"" . $name . "[]\" size=\"{$size}\" {$onchange}" . ($disabled ? ' DISABLED' : '') . ">"; } else { $var = "\n<select name=\"{$name}\" {$onchange}" . ($disabled ? ' DISABLED' : '') . ">"; } $lookup_val_rs = process_lookup_results($lookup_results, $value); reset($lookup_val_rs); while (list(, $lookup_val_r) = each($lookup_val_rs)) { // Now get the display value. $display = format_display_value($mask, NULL, $lookup_val_r['value'], $lookup_val_r['display']); // Ensure any length restriction is enforced. if ($length > 0 && strlen($display) > $length) { $display = substr($display, 0, $length); } $var .= "\n<option value=\"" . $lookup_val_r['value'] . "\"" . ($lookup_val_r['checked_ind'] == 'Y' ? ' SELECTED' : '') . ">{$display}"; } $var .= "\n</select>"; return $var; }
function get_import_choices_table(&$importPlugin, $cfg_include_header_row, $cfg_ignore_duplicate_title, $cfg_is_trial_run, $cfg_override_status_type, $cfg_default_status_type_r) { $buffer = "<dl class=\"importOptions\">"; if ($importPlugin->get_plugin_type() == 'row' && $importPlugin->is_header_row()) { $buffer .= "<dt>" . get_opendb_lang_var('include_first_line') . "</dt>" . "<dd>" . ($cfg_include_header_row ? theme_image('tick.gif') : theme_image('cross.gif')) . "</dd>"; } $buffer .= "<dt>" . get_opendb_lang_var('ignore_duplicate_title') . "</dt>" . "<dd>" . ($cfg_ignore_duplicate_title ? theme_image('tick.gif') : theme_image('cross.gif')) . "</dd>"; if (strcasecmp(get_class($importPlugin), 'PreviewImportPlugin') !== 0) { $buffer .= "<dt>" . get_opendb_lang_var('trial_run') . "</dt>" . "<dd>" . ($cfg_is_trial_run ? theme_image('tick.gif') : theme_image('cross.gif')) . "</dd>"; } if ($cfg_override_status_type) { if (is_not_empty_array($cfg_default_status_type_r)) { $buffer .= "<dt>" . get_opendb_lang_var('override_status_type') . "</dt>" . "<dd>" . format_display_value('%img%', $cfg_default_status_type_r['img'], 'Y', $cfg_default_status_type_r['description'], "s_status_type") . "</dd>"; } } $buffer .= "</dl>"; return $buffer; }
function get_search_query_matrix($HTTP_VARS) { function get_match_type($match) { if ($match == 'word') { return get_opendb_lang_var('word_match'); } else { if ($match == 'partial') { return get_opendb_lang_var('partial_match'); } else { if ($match == 'exact') { return get_opendb_lang_var('exact_match'); } else { return NULL; } } } } $searches = array(); if (strlen($HTTP_VARS['title']) > 0) { // Default title match is exact match. $HTTP_VARS['title_match'] = ifempty($HTTP_VARS['title_match'], 'exact'); if ($HTTP_VARS['title_match'] == 'word' || $HTTP_VARS['title_match'] == 'partial') { if (is_null($HTTP_VARS['title_case'])) { $searches[] = array(prompt => get_opendb_lang_var('title') . ' (<em>' . get_match_type($HTTP_VARS['title_match']) . '</em>)', field => $HTTP_VARS['title']); } else { $searches[] = array(prompt => get_opendb_lang_var('title') . ' (<em>' . get_match_type($HTTP_VARS['title_match']) . ', ' . get_opendb_lang_var('case_sensitive') . '</em>)', field => $HTTP_VARS['title']); } } else { $searches[] = array(prompt => get_opendb_lang_var('title'), field => $HTTP_VARS['title']); } } if (strlen($HTTP_VARS['category']) > 0) { // If s_item_type defined, we can get at the s_attribute_type of the category value. if (strlen($HTTP_VARS['s_item_type']) > 0) { $attribute_type_r = fetch_sfieldtype_item_attribute_type_r($HTTP_VARS['s_item_type'], 'CATEGORY'); $searches[] = array(prompt => get_opendb_lang_var('category'), field => get_item_display_field(NULL, $attribute_type_r, $HTTP_VARS['category'], FALSE)); } else { $searches[] = array(prompt => get_opendb_lang_var('category'), field => $HTTP_VARS['category']); } } if (strlen($HTTP_VARS['owner_id']) > 0) { $username = fetch_user_name($HTTP_VARS['owner_id']); if (strlen($username) > 0) { $searches[] = array(prompt => get_opendb_lang_var('owner'), field => $username . ' (' . $HTTP_VARS['owner_id'] . ')'); } } if (strlen($HTTP_VARS['s_item_type_group']) > 0) { $searches[] = array(prompt => get_opendb_lang_var('s_item_type_group'), field => $HTTP_VARS['s_item_type_group']); } if (is_array($HTTP_VARS['s_item_type'])) { $field = ''; for ($i = 0; $i < count($HTTP_VARS['s_item_type']); $i++) { $item_type_r = fetch_item_type_r($HTTP_VARS['s_item_type'][$i]); $field .= theme_image($item_type_r['image'], $item_type_r['description'], 's_item_type'); } $searches[] = array(prompt => get_opendb_lang_var('s_item_type'), field => $field); } else { if (strlen($HTTP_VARS['s_item_type']) > 0) { $item_type_r = fetch_item_type_r($HTTP_VARS['s_item_type']); $searches[] = array(prompt => get_opendb_lang_var('s_item_type'), field => theme_image($item_type_r['image'], $item_type_r['description'], 's_item_type')); } } if (is_numeric($HTTP_VARS['rating'])) { $attribute_type_r = fetch_cached_attribute_type_r('S_RATING'); $searches[] = array(prompt => $attribute_type_r['prompt'], field => get_display_field($attribute_type_r['s_attribute_type'], NULL, 'review()', $HTTP_VARS['rating'], FALSE)); } $attribute_type_r = NULL; if (strlen($HTTP_VARS['attribute_type']) > 0) { $attribute_type_r = fetch_cached_attribute_type_r($HTTP_VARS['attribute_type']); if (is_not_empty_array($attribute_type_r)) { $attribute_type_r['listing_link_ind'] = 'N'; // Default title match is exact match. $HTTP_VARS['attr_match'] = ifempty($HTTP_VARS['attr_match'], 'exact'); // Special category search, but ignore if category variable actually specified. if (strlen($HTTP_VARS['category']) == 0 && strlen($HTTP_VARS['attribute_val']) > 0 && $HTTP_VARS['attr_match'] == 'category') { // We do not want the Listing Link to be added to this display field $searches[] = array(prompt => $attribute_type_r['prompt'], field => get_item_display_field(NULL, $attribute_type_r, stripslashes($HTTP_VARS['attribute_val']), FALSE)); } else { if (strlen($HTTP_VARS['attribute_val']) > 0) { $HTTP_VARS['attribute_val'] = stripslashes($HTTP_VARS['attribute_val']); if (starts_with($HTTP_VARS['attribute_val'], '"') && ends_with($HTTP_VARS['attribute_val'], '"')) { $HTTP_VARS['attribute_val'] = substr($HTTP_VARS['attribute_val'], 1, -1); } $search = ifempty(get_item_display_field(NULL, $attribute_type_r, $HTTP_VARS['attribute_val'], FALSE), $HTTP_VARS['attribute_val']); } else { if (strlen($HTTP_VARS['lookup_attribute_val']) > 0) { $search = get_item_display_field(NULL, $attribute_type_r, stripslashes($HTTP_VARS['lookup_attribute_val']), FALSE); } } if (!is_lookup_attribute_type($HTTP_VARS['attribute_type']) && $HTTP_VARS['attr_match'] != 'exact') { $searches[] = array(prompt => $attribute_type_r['prompt'] . ' (<em>' . get_match_type($HTTP_VARS['attr_match']) . '</em>)', field => $search); } else { $searches[] = array(prompt => $attribute_type_r['prompt'], field => $search); } } } //if(is_not_empty_array($attribute_type_r)) } else { if (strlen($HTTP_VARS['attribute_val']) > 0) { // specified a search term without attribute type, this is a global search. if (is_null($HTTP_VARS['attr_case'])) { $searches[] = array(prompt => get_opendb_lang_var('attribute_val') . ' (<em>' . get_match_type(ifempty($HTTP_VARS['attr_match'], 'exact')) . '</em>)', field => stripslashes($HTTP_VARS['attribute_val'])); } else { $searches[] = array(prompt => get_opendb_lang_var('attribute_val') . ' (<em>' . get_match_type(ifempty($HTTP_VARS['attr_match'], 'exact')) . ', ' . get_opendb_lang_var('case_sensitive') . '</em>)', field => stripslashes($HTTP_VARS['attribute_val'])); } } } // add another search field if update_on value also specified. if (strlen($HTTP_VARS['attr_update_on']) > 0) { if (is_not_empty_array($attribute_type_r)) { $prompt = get_opendb_lang_var('attribute_prompt_updated', array('s_attribute_type' => $attribute_type_r['s_attribute_type'], 'prompt' => $attribute_type_r['prompt'])); } else { $prompt = get_opendb_lang_var('attributes_updated'); } if (strlen($HTTP_VARS['datetimemask']) > 0) { $searches[] = array(prompt => $prompt, field => $HTTP_VARS['attr_update_on'] . ' (' . $HTTP_VARS['datetimemask'] . ')'); } else { $searches[] = array(prompt => $prompt, field => $HTTP_VARS['attr_update_on']); } } else { if (is_numeric($HTTP_VARS['attr_update_on_days'])) { if (is_not_empty_array($attribute_type_r)) { $prompt = get_opendb_lang_var('attribute_prompt_updated', array('s_attribute_type' => $attribute_type_r['s_attribute_type'], 'prompt' => $attribute_type_r['prompt'])); } else { $prompt = get_opendb_lang_var('attributes_updated'); } if ($HTTP_VARS['attr_update_on_days'] == '1') { $field = get_opendb_lang_var('one_day_ago'); } else { if ($HTTP_VARS['attr_update_on_days'] == '7') { $field = get_opendb_lang_var('one_week_ago'); } else { if ($HTTP_VARS['attr_update_on_days'] == '28') { $field = get_opendb_lang_var('one_month_ago'); } else { if ($HTTP_VARS['attr_update_on_days'] == '365') { $field = get_opendb_lang_var('one_year_ago'); } } } } $searches[] = array(prompt => $prompt, field => $field); } } if (strlen($HTTP_VARS['update_on']) > 0) { if (strlen($HTTP_VARS['datetimemask']) > 0) { $searches[] = array(prompt => get_opendb_lang_var('updated'), field => $HTTP_VARS['update_on'] . ' (' . $HTTP_VARS['datetimemask'] . ')'); } else { $searches[] = array(prompt => get_opendb_lang_var('updated'), field => $HTTP_VARS['update_on']); } } else { if (is_numeric($HTTP_VARS['update_on_days'])) { if ($HTTP_VARS['update_on_days'] == '1') { $field = get_opendb_lang_var('one_day_ago'); } else { if ($HTTP_VARS['update_on_days'] == '7') { $field = get_opendb_lang_var('one_week_ago'); } else { if ($HTTP_VARS['update_on_days'] == '28') { $field = get_opendb_lang_var('one_month_ago'); } else { if ($HTTP_VARS['update_on_days'] == '365') { $field = get_opendb_lang_var('one_year_ago'); } } } } $searches[] = array(prompt => get_opendb_lang_var('updated'), field => $field); } } if (is_not_empty_array($HTTP_VARS['s_status_type']) > 0) { $search = ''; for ($i = 0; $i < count($HTTP_VARS['s_status_type']); $i++) { if (strlen($search) > 0) { $search .= ' '; } $status_type_r = fetch_status_type_r($HTTP_VARS['s_status_type'][$i]); if (is_not_empty_array($status_type_r)) { $search .= format_display_value('%img%', $status_type_r['img'], 'Y', $status_type_r['description'], 's_status_type'); } } if (strlen($search) > 0) { $searches[] = array(prompt => get_opendb_lang_var('s_status_type'), field => $search); } } if (strlen($HTTP_VARS['status_comment']) > 0) { // Default status_comment match is exact match. $HTTP_VARS['status_comment_match'] = ifempty($HTTP_VARS['status_comment_match'], 'exact'); if ($HTTP_VARS['status_comment_match'] == 'word' || $HTTP_VARS['status_comment_match'] == 'partial' || $HTTP_VARS['status_comment_match'] == 'exact') { if (is_null($HTTP_VARS['status_comment_case'])) { $searches[] = array(prompt => get_opendb_lang_var('status_comment') . ' (<em>' . get_match_type($HTTP_VARS['status_comment_match']) . '</em>)', field => $HTTP_VARS['status_comment']); } else { $searches[] = array(prompt => get_opendb_lang_var('status_comment') . ' (<em>' . get_match_type($HTTP_VARS['status_comment_match']) . ', ' . get_opendb_lang_var('case_sensitive') . '</em>)', field => $HTTP_VARS['status_comment']); } } else { $searches[] = array(prompt => get_opendb_lang_var('status_comment'), field => $HTTP_VARS['status_comment']); } } if (is_numeric($HTTP_VARS['interest_level']) && $HTTP_VARS['interest_level'] > 0) { $searches[] = array(prompt => get_opendb_lang_var('interest'), field => theme_image("interest_1.gif", get_opendb_lang_var('interest'), 's_item_type')); } return $searches; }
function format_lookup_display_field($item_attribute_type_r, $attribute_value_r) { $display_value = format_display_value($item_attribute_type_r['display_type_arg1'], $attribute_value_r['img'], $attribute_value_r['value'], $attribute_value_r['display']); // Add listings.php link if required. if ($item_attribute_type_r['listing_link_ind'] == 'Y') { $display_value = format_listing_link($attribute_value_r['value'], $display_value, $item_attribute_type_r, $item_attribute_type_r['display_type'] == 'category' ? 'category' : 'exact'); } return $display_value; }