|
|
|
@ -31,7 +31,7 @@ function search_widget_prepare(&$htmlHeadXtra) { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr='size="7" class="sf-select-multiple"') { |
|
|
|
function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr='size="7" class="sf-select-multiple"') { |
|
|
|
global $charset; |
|
|
|
global $charset; |
|
|
|
$multiple_select .= '<select '. $extra_select_attr .' title="'. $prefix .'" id="sf-'. $prefix .'" name="sf_'. $prefix .'[]">'; |
|
|
|
$multiple_select = '<select '. $extra_select_attr .' title="'. $prefix .'" id="sf-'. $prefix .'" name="sf_'. $prefix .'[]">'; |
|
|
|
|
|
|
|
|
|
|
|
$all_selected = ''; |
|
|
|
$all_selected = ''; |
|
|
|
if (!empty($_REQUEST['sf_'. $prefix]) ) { |
|
|
|
if (!empty($_REQUEST['sf_'. $prefix]) ) { |
|
|
|
@ -302,11 +302,11 @@ function display_search_form($action, $show_thesaurus, $sf_terms, $op) { |
|
|
|
* @param string $action Just in case your action is not |
|
|
|
* @param string $action Just in case your action is not |
|
|
|
* index.php |
|
|
|
* index.php |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function search_widget_show($action='index.php') { |
|
|
|
function search_widget_show($action='index.php') |
|
|
|
global $charset; |
|
|
|
{ |
|
|
|
require_once api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php'; |
|
|
|
require_once api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php'; |
|
|
|
// TODO: load images dinamically when they're avalaible from specific field ui to add |
|
|
|
// TODO: load images dinamically when they're avalaible from specific field ui to add |
|
|
|
$icons_for_search_terms = array(); |
|
|
|
$groupId = api_get_group_id(); |
|
|
|
|
|
|
|
|
|
|
|
$sf_terms = array(); |
|
|
|
$sf_terms = array(); |
|
|
|
$specific_fields = get_specific_field_list(); |
|
|
|
$specific_fields = get_specific_field_list(); |
|
|
|
@ -330,31 +330,25 @@ function search_widget_show($action='index.php') { |
|
|
|
$url_params[] = 'sf_'.$specific_field['code']; |
|
|
|
$url_params[] = 'sf_'.$specific_field['code']; |
|
|
|
unset($temp); |
|
|
|
unset($temp); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { // without cid |
|
|
|
} else { // without cid |
|
|
|
|
|
|
|
|
|
|
|
// prepare specific fields names (and also get possible URL param names) |
|
|
|
// prepare specific fields names (and also get possible URL param names) |
|
|
|
foreach ($specific_fields as $specific_field) { |
|
|
|
foreach ($specific_fields as $specific_field) { |
|
|
|
//get Xapian terms for a specific term prefix, in ISO, apparently |
|
|
|
//get Xapian terms for a specific term prefix, in ISO, apparently |
|
|
|
$sf_terms[$specific_field['code']] = xapian_get_all_terms(1000, $specific_field['code']); |
|
|
|
$sf_terms[$specific_field['code']] = xapian_get_all_terms(1000, $specific_field['code']); |
|
|
|
$url_params[] = 'sf_'.$specific_field['code']; |
|
|
|
$url_params[] = 'sf_'.$specific_field['code']; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
echo '<h2>'.get_lang('Search').'</h2>'; |
|
|
|
echo '<h2>'.get_lang('Search').'</h2>'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Tool introduction |
|
|
|
// Tool introduction |
|
|
|
// TODO: Settings for the online editor to be checked (insert an image for example). Probably this is a special case here. |
|
|
|
// TODO: Settings for the online editor to be checked (insert an image for example). Probably this is a special case here. |
|
|
|
if (api_get_course_id() !== -1) |
|
|
|
if (api_get_course_id() !== -1) |
|
|
|
if (!empty($_SESSION['_gid'])) { |
|
|
|
if (!empty($groupId)) { |
|
|
|
Display::display_introduction_section(TOOL_SEARCH.$_SESSION['_gid']); |
|
|
|
Display::display_introduction_section(TOOL_SEARCH.$groupId); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Display::display_introduction_section(TOOL_SEARCH); |
|
|
|
Display::display_introduction_section(TOOL_SEARCH); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$op = 'or'; |
|
|
|
$op = 'or'; |
|
|
|
if (!empty($_REQUEST['operator']) && in_array($op,array('or','and'))) { |
|
|
|
if (!empty($_REQUEST['operator']) && in_array($op,array('or','and'))) { |
|
|
|
$op = $_REQUEST['operator']; |
|
|
|
$op = $_REQUEST['operator']; |
|
|
|
@ -379,5 +373,4 @@ function search_widget_show($action='index.php') { |
|
|
|
// create the form |
|
|
|
// create the form |
|
|
|
// TODO: use FormValidator |
|
|
|
// TODO: use FormValidator |
|
|
|
display_search_form($action, $show_thesaurus, $sf_terms, $op); |
|
|
|
display_search_form($action, $show_thesaurus, $sf_terms, $op); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|